From nobody Mon Oct 18 00:54:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 60A6B1802C5D; Mon, 18 Oct 2021 00:54: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXdgh1xGKz4Z94; Mon, 18 Oct 2021 00:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 224D8174C2; Mon, 18 Oct 2021 00:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19I0seI0000682; Mon, 18 Oct 2021 00:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19I0seBh000681; Mon, 18 Oct 2021 00:54:40 GMT (envelope-from git) Date: Mon, 18 Oct 2021 00:54:40 GMT Message-Id: <202110180054.19I0seBh000681@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: d95c0a12a2dd - main - nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e commit d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e Author: Rick Macklem AuthorDate: 2021-10-18 00:50:56 +0000 Commit: Rick Macklem CommitDate: 2021-10-18 00:50:56 +0000 nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2 This patch modifies the function that does the Close RPC (nfsrpc_closerpc) so that it does not use the open_owner (nfso_own) for NFSv4.1/4.2. Use of the seqid in the open_owner structure is only needed for NFSv4.0. Same applies to a NFSERR_STALESTATEID reply, which should only happen for NFSv4.0. This allows nfsrpc_closerpc() to be called when nfso_own is no longer valid. This, in turn, allows nfsrpc_closerpc() to be called after the shared lock on the clientID is released, for NFSv4.1/4.2. This is being done to prepare the code for a future patch that fixes the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation. MFC after: 2 week --- sys/fs/nfsclient/nfs_clrpcops.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 08c9117a8fc1..6b6fdc03441f 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -868,11 +868,13 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, op->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); - *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); - if (NFSHASNFSV4N(nmp)) + if (NFSHASNFSV4N(nmp)) { *tl++ = 0; - else + *tl++ = 0; + } else { + *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = op->nfso_stateid.seqid; + } *tl++ = op->nfso_stateid.other[0]; *tl++ = op->nfso_stateid.other[1]; *tl = op->nfso_stateid.other[2]; @@ -882,11 +884,12 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); if (error) return (error); - NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); + if (!NFSHASNFSV4N(nmp)) + NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID) + if (!NFSHASNFSV4N(nmp) && error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: m_freem(nd->nd_mrep); From nobody Mon Oct 18 06:18:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2A29717F39C9 for ; Mon, 18 Oct 2021 06:18: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXms90lh2z4h3P; Mon, 18 Oct 2021 06:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E20071B5EE; Mon, 18 Oct 2021 06:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19I6IKOV028241; Mon, 18 Oct 2021 06:18:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19I6IKMH028240; Mon, 18 Oct 2021 06:18:20 GMT (envelope-from git) Date: Mon, 18 Oct 2021 06:18:20 GMT Message-Id: <202110180618.19I6IKMH028240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: 9530c11c3570..c28d35783173 - vendor/tzdata - vendor branch updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/vendor/tzdata X-Git-Reftype: branch X-Git-Commit: c28d35783173c0b09ca1f7e29d2565b1602f733d X-Git-Oldrev: 9530c11c35707c2ed4a95aa90097b30f8a230563 X-Git-Newrev: c28d35783173c0b09ca1f7e29d2565b1602f733d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch vendor/tzdata has been updated by philip: URL: https://cgit.FreeBSD.org/src/log/?id=9530c11c3570..c28d35783173 c28d35783173 Import tzcode 2021d From nobody Mon Oct 18 06:18:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 303C917F3A20 for ; Mon, 18 Oct 2021 06:18: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXms90yQwz4gmR; Mon, 18 Oct 2021 06:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F296C1BAB6; Mon, 18 Oct 2021 06:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19I6IKiO028267; Mon, 18 Oct 2021 06:18:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19I6IKQM028266; Mon, 18 Oct 2021 06:18:20 GMT (envelope-from git) Date: Mon, 18 Oct 2021 06:18:20 GMT Message-Id: <202110180618.19I6IKQM028266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: f22e7f5f7e9c - Create tag vendor/tzdata/tzdata2021d List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/tags/vendor/tzdata/tzdata2021d X-Git-Reftype: annotated tag X-Git-Commit: f22e7f5f7e9ccf76de9ab110e9fc15ef7a0c3ffc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The annotated tag vendor/tzdata/tzdata2021d has been created by philip: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tzdata/tzdata2021d tag vendor/tzdata/tzdata2021d Tagger: Philip Paeps TaggerDate: 2021-10-18 06:17:35 +0000 Tag import of tzdata 2021d commit c28d35783173c0b09ca1f7e29d2565b1602f733d Author: Philip Paeps AuthorDate: 2021-10-18 06:17:22 +0000 Commit: Philip Paeps CommitDate: 2021-10-18 06:17:22 +0000 Import tzcode 2021d From nobody Mon Oct 18 06:22:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0DE0917F69AD; Mon, 18 Oct 2021 06:22: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXmxy73Njz4jy4; Mon, 18 Oct 2021 06:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D27B51BB99; Mon, 18 Oct 2021 06:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19I6MUti040968; Mon, 18 Oct 2021 06:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19I6MSpc040964; Mon, 18 Oct 2021 06:22:28 GMT (envelope-from git) Date: Mon, 18 Oct 2021 06:22:28 GMT Message-Id: <202110180622.19I6MSpc040964@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: 6b7d3b4de8bc - main - contrib/tzdata: import tzdata 2021d List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 6b7d3b4de8bc80d0c67a9ab2768405d4545d66a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=6b7d3b4de8bc80d0c67a9ab2768405d4545d66a7 commit 6b7d3b4de8bc80d0c67a9ab2768405d4545d66a7 Merge: d95c0a12a2dd c28d35783173 Author: Philip Paeps AuthorDate: 2021-10-18 06:19:42 +0000 Commit: Philip Paeps CommitDate: 2021-10-18 06:19:42 +0000 contrib/tzdata: import tzdata 2021d Merge commit 'c28d35783173c0b09ca1f7e29d2565b1602f733d' Changes: https://github.com/eggert/tz/blob/2021d/NEWS MFC after: 3 days contrib/tzdata/NEWS | 23 +++++++++++++++++++++-- contrib/tzdata/australasia | 24 +++++++++++++++++++----- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- contrib/tzdata/version | 2 +- 5 files changed, 52 insertions(+), 16 deletions(-) From nobody Mon Oct 18 06:24:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0A2C517F748D for ; Mon, 18 Oct 2021 06:24:58 +0000 (UTC) (envelope-from philip@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXn0n6blyz4kK3; Mon, 18 Oct 2021 06:24:57 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: philip/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id BE830E874; Mon, 18 Oct 2021 06:24:57 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 5BECA27C0054; Mon, 18 Oct 2021 02:24:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 18 Oct 2021 02:24:57 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdduledguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjohesth dtredttddtvdenucfhrhhomheprfhhihhlihhpucfrrggvphhsuceophhhihhlihhpsehf rhgvvggsshgurdhorhhgqeenucggtffrrghtthgvrhhnpeelffffjeeugfeigfduffdvgf ffgeevkedvkeehuddvudegveekteduheehuddvfeenucffohhmrghinhepfhhrvggvsghs ugdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehphhhilhhiphdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduieei vdeivdegkedqvdefhedukedttdekqdhphhhilhhipheppehfrhgvvggsshgurdhorhhgse htrhhouhgslhgvrdhish X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Oct 2021 02:24:56 -0400 (EDT) Date: Mon, 18 Oct 2021 14:24:54 +0800 From: Philip Paeps To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org Subject: Re: git: 9530c11c3570..c28d35783173 - vendor/tzdata - vendor branch updated Message-ID: Mail-Followup-To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org References: <202110180618.19I6IKMH028240@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <202110180618.19I6IKMH028240@gitrepo.freebsd.org> X-PGP-Fingerprint: B851 CD3A C248 F2ED 3E2C C18C BB6D 8A14 AFE7 D96B X-Date: Today is Sweetmorn, the 72nd day of Bureaucracy in the YOLD 3187 X-Phase-of-Moon: The Moon is Waxing Gibbous (94% of Full) X-Clacks-Overhead: GNU Terry Pratchett Organization: Happily Disorganized X-ThisMailContainsUnwantedMimeParts: N On 2021-10-18 06:18:20 (+0000), Philip Paeps wrote: >The branch vendor/tzdata has been updated by philip: > >URL: https://cgit.FreeBSD.org/src/log/?id=9530c11c3570..c28d35783173 > >c28d35783173 Import tzcode 2021d Typo. That should say tzdata, not tzcode. Sorry. The merge itself is correct. (I'm working on tzcode too.) Philip -- Philip Paeps Senior Reality Engineer Alternative Enterprises From nobody Mon Oct 18 07:40:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F364F18170A7; Mon, 18 Oct 2021 07:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXpgs6X9Fz3Ktr; Mon, 18 Oct 2021 07:40:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5FE11CB86; Mon, 18 Oct 2021 07:40:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19I7ePDs044734; Mon, 18 Oct 2021 07:40:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19I7ePlP044733; Mon, 18 Oct 2021 07:40:25 GMT (envelope-from git) Date: Mon, 18 Oct 2021 07:40:25 GMT Message-Id: <202110180740.19I7ePlP044733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 26c1772071f7 - main - stress2: Added a syzkaller reproducer List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26c1772071f70b6266fe95a2f235c7a50813732b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=26c1772071f70b6266fe95a2f235c7a50813732b commit 26c1772071f70b6266fe95a2f235c7a50813732b Author: Peter Holm AuthorDate: 2021-10-18 07:39:55 +0000 Commit: Peter Holm CommitDate: 2021-10-18 07:39:55 +0000 stress2: Added a syzkaller reproducer --- syzkaller45.sh | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) diff --git a/syzkaller45.sh b/syzkaller45.sh new file mode 100755 index 000000000000..6c38b96ab12b --- /dev/null +++ b/syzkaller45.sh @@ -0,0 +1,289 @@ +#!/bin/sh + +# panic: Assertion (cnp->cn_flags & (LOCKPARENT | WANTPARENT)) == 0 failed at ../../../kern/vfs_cache.c:4790 +# cpuid = 5 +# time = 1634453452 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0146912830 +# vpanic() at vpanic+0x187/frame 0xfffffe0146912890 +# panic() at panic+0x43/frame 0xfffffe01469128f0 +# cache_fplookup_emptypath() at cache_fplookup_emptypath+0x1b2/frame 0xfffffe0146912930 +# cache_fplookup_noentry() at cache_fplookup_noentry+0xbc/frame 0xfffffe01469129a0 +# cache_fplookup() at cache_fplookup+0x605/frame 0xfffffe0146912a90 +# namei() at namei+0x203/frame 0xfffffe0146912b50 +# vn_open_cred() at vn_open_cred+0x12c/frame 0xfffffe0146912cb0 +# kern_openat() at kern_openat+0x285/frame 0xfffffe0146912e00 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe0146912f30 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0146912f30 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003aeafa, rsp = 0x7fffdfffdf28, rbp = 0x7fffdfffdf70 --- +# KDB: enter: panic +# [ thread pid 2864 tid 100315 ] +# Stopped at kdb_enter+0x37: movq $0,0x126f74e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n250087-a7d137fcbcac: Sun Oct 17 08:46:08 CEST 2021 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012 +# db> + +# Fixed by 1045352f1503 + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller45.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static __thread int skip_segv; +static __thread jmp_buf segv_env; + +static void segv_handler(int sig, siginfo_t* info, void* ctx __unused) +{ + uintptr_t addr = (uintptr_t)info->si_addr; + const uintptr_t prog_start = 1 << 20; + const uintptr_t prog_end = 100 << 20; + int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; + int valid = addr < prog_start || addr > prog_end; + if (sig == SIGBUS) + valid = 1; + if (skip && valid) { + _longjmp(segv_env, 1); + } + exit(sig); +} + +static void install_segv_handler(void) +{ + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction = segv_handler; + sa.sa_flags = SA_NODEFER | SA_SIGINFO; + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); +} + +#define NONFAILING(...) \ + ({ \ + int ok = 1; \ + __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ + if (_setjmp(segv_env) == 0) { \ + __VA_ARGS__; \ + } else \ + ok = 0; \ + __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ + ok; \ + }) + +static void sleep_ms(uint64_t ms) +{ + usleep(ms * 1000); +} + +static uint64_t current_time_ms(void) +{ + struct timespec ts; + if (clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(1); + return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; +} + +static void thread_start(void* (*fn)(void*), void* arg) +{ + pthread_t th; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 128 << 10); + int i = 0; + for (; i < 100; i++) { + if (pthread_create(&th, &attr, fn, arg) == 0) { + pthread_attr_destroy(&attr); + return; + } + if (errno == EAGAIN) { + usleep(50); + continue; + } + break; + } + exit(1); +} + +typedef struct { + pthread_mutex_t mu; + pthread_cond_t cv; + int state; +} event_t; + +static void event_init(event_t* ev) +{ + if (pthread_mutex_init(&ev->mu, 0)) + exit(1); + if (pthread_cond_init(&ev->cv, 0)) + exit(1); + ev->state = 0; +} + +static void event_reset(event_t* ev) +{ + ev->state = 0; +} + +static void event_set(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + if (ev->state) + exit(1); + ev->state = 1; + pthread_mutex_unlock(&ev->mu); + pthread_cond_broadcast(&ev->cv); +} + +static void event_wait(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + while (!ev->state) + pthread_cond_wait(&ev->cv, &ev->mu); + pthread_mutex_unlock(&ev->mu); +} + +static int event_isset(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +static int event_timedwait(event_t* ev, uint64_t timeout) +{ + uint64_t start = current_time_ms(); + uint64_t now = start; + pthread_mutex_lock(&ev->mu); + for (;;) { + if (ev->state) + break; + uint64_t remain = timeout - (now - start); + struct timespec ts; + ts.tv_sec = remain / 1000; + ts.tv_nsec = (remain % 1000) * 1000 * 1000; + pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); + now = current_time_ms(); + if (now - start > timeout) + break; + } + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +struct thread_t { + int created, call; + event_t ready, done; +}; + +static struct thread_t threads[16]; +static void execute_call(int call); +static int running; + +static void* thr(void* arg) +{ + struct thread_t* th = (struct thread_t*)arg; + for (;;) { + event_wait(&th->ready); + event_reset(&th->ready); + execute_call(th->call); + __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); + event_set(&th->done); + } + return 0; +} + +static void loop(void) +{ + int i, call, thread; + int collide = 0; +again: + for (call = 0; call < 3; call++) { + for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); + thread++) { + struct thread_t* th = &threads[thread]; + if (!th->created) { + th->created = 1; + event_init(&th->ready); + event_init(&th->done); + event_set(&th->done); + thread_start(thr, th); + } + if (!event_isset(&th->done)) + continue; + event_reset(&th->done); + th->call = call; + __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); + event_set(&th->ready); + if (collide && (call % 2) == 0) + break; + event_timedwait(&th->done, 50); + break; + } + } + for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) + sleep_ms(1); + if (!collide) { + collide = 1; + goto again; + } +} + +uint64_t r[1] = {0xffffffffffffffff}; + +void execute_call(int call) +{ + intptr_t res = 0; + switch (call) { + case 0: + NONFAILING(memcpy((void*)0x20000480, "./file0\000", 8)); + res = syscall(SYS_open, 0x20000480ul, 0x80400000000206ul, 0ul); + if (res != -1) + r[0] = res; + break; + case 1: + syscall(SYS_mmap, 0x20000000ul, 0x200000ul, 1ul, 0x12ul, r[0], 0ul); + break; + case 2: + syscall(SYS_ftruncate, r[0], 5ul); + break; + } +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + install_segv_handler(); + loop(); + return 0; +} +EOF +mycc -o /tmp/syzkaller45 -Wall -Wextra -O0 /tmp/syzkaller45.c -lpthread || exit 1 + +(cd /tmp; ./syzkaller45) + +rm -rf /tmp/syzkaller45 /tmp/syzkaller45.c /tmp/syzkaller.* /tmp/file0 +exit 0 From nobody Mon Oct 18 11:02:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 35FF517FF925 for ; Mon, 18 Oct 2021 11:03:05 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXv9h1bYZz3MNf for ; Mon, 18 Oct 2021 11:03:04 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-yb1-xb2f.google.com with SMTP id r184so167679ybc.10 for ; Mon, 18 Oct 2021 04:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jcUtu16+f1FP5Oa8/QOstqsGOXBRU7A22DSEpTV6yvs=; b=J0jrZcULks6TUBGlY3/RoQ8e0YzgWpjpEPO5WNm14MM2sp52f/X49Nx9nsHUtLZo2c kJoSrtgjz2t9hL73ncWy2G+osKZmT5Lp1VS/OEaMffwnHZrcY6jWnLYZ4kasqIhWP+EC hzBubJh+kuRnkJI22IDlnlOn9VNRYqcdUpAsyMF+/t3jThVNqHyb6ovQqv66TPGFDefY inBuEk4invtanhsm1DQVwsoRpDP2eh6U93vcHBMb0sU9PM9mUCwGxhs4D2zEJ185co8M EWpDJrhskfoQD70bprByfmwHSL53N1dkea8EnfrrCyRqYptftJbZjgfDItqSVW8GCby/ 4k8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jcUtu16+f1FP5Oa8/QOstqsGOXBRU7A22DSEpTV6yvs=; b=RHd5G7tdV0yi2QazPxNBcwu6/4wU3c2dDB6FY6Iy2fHlxqAY+xEpdzSXNGPhV3Gand nzOC39sDTeluMaeatOIw2ujSyQRHdZF40l2DwiWNr6Be6aW8sWJGpCN3YHA+I5Ea21eE HW2XZnSJMOQATIoI7/az8murRSuow7ACr6AhhZSNt07jU9gR9e2VTW+iN74fTwCd0uvJ lVi3H0Dy1+Leb98R2WvKzYz92MU+rYNG3bLVlfqMX/aixGMx+jt72RmNDsyZYh8TtlId mYcnmstHkhL5K0EJZvLce7Ej2J0KJIZmz9La70EDct/JePIqAk/LrPvcmXkNx4TAxWDD Swbg== X-Gm-Message-State: AOAM533Lc0NDVT1UEHCRhFIFdFCREo+4Q/4Kb/2qnus83+3W7kzyxXqk I/iURF20E748DIE+wnDu95BXjjYtnkxFgoOOfyFnUA== X-Google-Smtp-Source: ABdhPJwnwMLArsfCLjcH9C3DhjmUD12ssbdXTkNUCZMrrqbLtEEIuaFLAqO/Q+IGnkLZ7qEHQJwGpT03tze19LIfT+I= X-Received: by 2002:a25:2c01:: with SMTP id s1mr29590261ybs.159.1634554983488; Mon, 18 Oct 2021 04:03:03 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110150823.19F8NEr9047194@gitrepo.freebsd.org> <202110161602.19GG2FYs004292@slippy.cwsent.com> In-Reply-To: <202110161602.19GG2FYs004292@slippy.cwsent.com> From: Marcin Wojtas Date: Mon, 18 Oct 2021 13:02:52 +0200 Message-ID: Subject: Re: git: 889b56c8cd84 - main - setrlimit: Take stack gap into account. To: Cy Schubert Cc: Marcin Wojtas , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HXv9h1bYZz3MNf X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20210112.gappssmtp.com header.s=20210112 header.b=J0jrZcUL; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::b2f) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [0.70 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[semihalf-com.20210112.gappssmtp.com:s=20210112]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20210112.gappssmtp.com:+]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b2f:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Cy, sob., 16 pa=C5=BA 2021 o 18:02 Cy Schubert napi= sa=C5=82(a): > > In message <202110150823.19F8NEr9047194@gitrepo.freebsd.org>, Marcin Wojt= as > wri > tes: > > The branch main has been updated by mw: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D889b56c8cd84c9a9f2d9e3b0= 19c154d6 > > f14d9021 > > > > commit 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 > > Author: Dawid Gorecki > > AuthorDate: 2021-10-13 19:01:08 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-10-15 08:21:47 +0000 > > > > setrlimit: Take stack gap into account. > > > > Calling setrlimit with stack gap enabled and with low values of sta= ck > > resource limit often caused the program to abort immediately after > > exiting the syscall. This happened due to the fact that the resourc= e > > limit was calculated assuming that the stack started at sv_usrstack= , > > while with stack gap enabled the stack is moved by a random number > > of bytes. > > > > Save information about stack size in struct vmspace and adjust the > > rlim_cur value. If the rlim_cur and stack gap is bigger than rlim_m= ax, > > then the value is truncated to rlim_max. > > > > PR: 253208 > > Reviewed by: kib > > Obtained from: Semihalf > > Sponsored by: Stormshield > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D31516 > > --- > > sys/kern/imgact_elf.c | 5 +++-- > > sys/kern/kern_exec.c | 11 ++++++++--- > > sys/kern/kern_resource.c | 3 +++ > > sys/sys/imgact_elf.h | 2 +- > > sys/sys/sysent.h | 2 +- > > sys/vm/vm_map.c | 2 ++ > > sys/vm/vm_map.h | 1 + > > 7 files changed, 19 insertions(+), 7 deletions(-) > > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > index ef1edfcabaf0..898f0f66a532 100644 > > --- a/sys/kern/imgact_elf.c > > +++ b/sys/kern/imgact_elf.c > > @@ -2684,7 +2684,7 @@ __elfN(untrans_prot)(vm_prot_t prot) > > return (flags); > > } > > > > -void > > +vm_size_t > > __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base) > > { > > uintptr_t range, rbase, gap; > > @@ -2692,7 +2692,7 @@ __elfN(stackgap)(struct image_params *imgp, uintp= tr_t * > > stack_base) > > > > pct =3D __elfN(aslr_stack_gap); > > if (pct =3D=3D 0) > > - return; > > + return (0); > > if (pct > 50) > > pct =3D 50; > > range =3D imgp->eff_stack_sz * pct / 100; > > @@ -2700,4 +2700,5 @@ __elfN(stackgap)(struct image_params *imgp, uintp= tr_t * > > stack_base) > > gap =3D rbase % range; > > gap &=3D ~(sizeof(u_long) - 1); > > *stack_base -=3D gap; > > + return (gap); > > } > > diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c > > index 50e75fda6cfb..9dceebdd8441 100644 > > --- a/sys/kern/kern_exec.c > > +++ b/sys/kern/kern_exec.c > > @@ -1148,6 +1148,7 @@ exec_new_vmspace(struct image_params *imgp, struc= t syse > > ntvec *sv) > > stack_prot, error, vm_mmap_to_errno(error)); > > return (vm_mmap_to_errno(error)); > > } > > + vmspace->vm_stkgap =3D 0; > > > > /* > > * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but= they > > @@ -1493,12 +1494,16 @@ exec_args_get_begin_envv(struct image_args *arg= s) > > void > > exec_stackgap(struct image_params *imgp, uintptr_t *dp) > > { > > + struct proc *p =3D imgp->proc; > > + > > if (imgp->sysent->sv_stackgap =3D=3D NULL || > > - (imgp->proc->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > + (p->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > NT_FREEBSD_FCTL_ASG_DISABLE)) !=3D 0 || > > - (imgp->map_flags & MAP_ASLR) =3D=3D 0) > > + (imgp->map_flags & MAP_ASLR) =3D=3D 0) { > > + p->p_vmspace->vm_stkgap =3D 0; > > return; > > - imgp->sysent->sv_stackgap(imgp, dp); > > + } > > + p->p_vmspace->vm_stkgap =3D imgp->sysent->sv_stackgap(imgp, dp); > > } > > > > /* > > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > > index 4c62961e1bc4..b556d4fded51 100644 > > --- a/sys/kern/kern_resource.c > > +++ b/sys/kern/kern_resource.c > > @@ -671,6 +671,9 @@ kern_proc_setrlimit(struct thread *td, struct proc = *p, u_ > > int which, > > if (limp->rlim_max < 0) > > limp->rlim_max =3D RLIM_INFINITY; > > > > + if (which =3D=3D RLIMIT_STACK && limp->rlim_cur !=3D RLIM_INFINIT= Y) > > + limp->rlim_cur +=3D p->p_vmspace->vm_stkgap; > > + > > oldssiz.rlim_cur =3D 0; > > newlim =3D lim_alloc(); > > PROC_LOCK(p); > > diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h > > index 97383c6eeeb8..294f17c87b6f 100644 > > --- a/sys/sys/imgact_elf.h > > +++ b/sys/sys/imgact_elf.h > > @@ -118,7 +118,7 @@ int __elfN(remove_brand_entry)(Elf_Brandinfo = *entry > > ); > > int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *); > > int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); > > size_t __elfN(populate_note)(int, void *, void *, size_t, void *= *); > > -void __elfN(stackgap)(struct image_params *, uintptr_t *); > > +vm_size_t __elfN(stackgap)(struct image_params *, uintptr_t *); > > int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t)= ; > > void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int)= ; > > void __elfN(prepare_notes)(struct thread *, struct note_info_list *, > > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > > index ad50bf56e87d..ea96c87a79af 100644 > > --- a/sys/sys/sysent.h > > +++ b/sys/sys/sysent.h > > @@ -119,7 +119,7 @@ struct sysentvec { > > void (*sv_elf_core_prepare_notes)(struct thread *, > > struct note_info_list *, size_t *); > > int (*sv_imgact_try)(struct image_params *); > > - void (*sv_stackgap)(struct image_params *, uintptr_t *= ); > > + vm_size_t (*sv_stackgap)(struct image_params *, uintptr_t *= ); > > int (*sv_copyout_auxargs)(struct image_params *, > > uintptr_t); > > int sv_minsigstksz; /* minimum signal stack size */ > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c > > index 1ac4ccf72f11..87a290b998b9 100644 > > --- a/sys/vm/vm_map.c > > +++ b/sys/vm/vm_map.c > > @@ -343,6 +343,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, pma= p_pini > > t_t pinit) > > vm->vm_taddr =3D 0; > > vm->vm_daddr =3D 0; > > vm->vm_maxsaddr =3D 0; > > + vm->vm_stkgap =3D 0; > > return (vm); > > } > > > > @@ -4265,6 +4266,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *f= ork_ch > > arge) > > vm2->vm_taddr =3D vm1->vm_taddr; > > vm2->vm_daddr =3D vm1->vm_daddr; > > vm2->vm_maxsaddr =3D vm1->vm_maxsaddr; > > + vm2->vm_stkgap =3D vm1->vm_stkgap; > > vm_map_lock(old_map); > > if (old_map->busy) > > vm_map_wait_busy(old_map); > > diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h > > index ace205b21b42..873ff62eec4a 100644 > > --- a/sys/vm/vm_map.h > > +++ b/sys/vm/vm_map.h > > @@ -293,6 +293,7 @@ struct vmspace { > > caddr_t vm_taddr; /* (c) user virtual address of text */ > > caddr_t vm_daddr; /* (c) user virtual address of data */ > > caddr_t vm_maxsaddr; /* user VA at max stack growth */ > > + vm_size_t vm_stkgap; /* stack gap size in bytes */ > > u_int vm_refcnt; /* number of references */ > > /* > > * Keep the PMAP last, so that CPU-specific variations of that > > > > Is it possible to have a __FreeBSD_version bump for ports? > > At a first glance I don't see the ports' global versioning apart from creating tags, but maybe ports' maintainers will have more insight. Best regards, Marcin From nobody Mon Oct 18 11:16:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3EFFE180531B; Mon, 18 Oct 2021 11:16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXvTd0tL6z3QTk; Mon, 18 Oct 2021 11:16:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1E431F0FD; Mon, 18 Oct 2021 11:16:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IBGqwG039501; Mon, 18 Oct 2021 11:16:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IBGqJj039500; Mon, 18 Oct 2021 11:16:52 GMT (envelope-from git) Date: Mon, 18 Oct 2021 11:16:52 GMT Message-Id: <202110181116.19IBGqJj039500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: 3bfe213143c5 - stable/13 - unzip: Fix segmentation fault if a zip file contains buggy filename. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3bfe213143c562154e04d840380651f182df04de Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=3bfe213143c562154e04d840380651f182df04de commit 3bfe213143c562154e04d840380651f182df04de Author: Yoshihiro Takahashi AuthorDate: 2021-10-10 11:49:19 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-18 11:16:02 +0000 unzip: Fix segmentation fault if a zip file contains buggy filename. PR: 259011 Reported by: Robert Morris Submitted by: ak (cherry picked from commit 2c614481fd5248c1685e713f67d40cf2d5fba494) --- usr.bin/unzip/unzip.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index e5ca1ff2c939..0b564b0f08ec 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -211,6 +211,9 @@ pathdup(const char *path) char *str; size_t i, len; + if (path == NULL || path[0] == '\0') + return (NULL); + len = strlen(path); while (len && path[len - 1] == '/') len--; @@ -697,7 +700,11 @@ extract(struct archive *a, struct archive_entry *e) mode_t filetype; char *p, *q; - pathname = pathdup(archive_entry_pathname(e)); + if ((pathname = pathdup(archive_entry_pathname(e))) == NULL) { + warningx("skipping empty or unreadable filename entry"); + ac(archive_read_data_skip(a)); + return; + } filetype = archive_entry_filetype(e); /* sanity checks */ @@ -760,7 +767,11 @@ extract_stdout(struct archive *a, struct archive_entry *e) char *pathname; mode_t filetype; - pathname = pathdup(archive_entry_pathname(e)); + if ((pathname = pathdup(archive_entry_pathname(e))) == NULL) { + warningx("skipping empty or unreadable filename entry"); + ac(archive_read_data_skip(a)); + return; + } filetype = archive_entry_filetype(e); /* I don't think this can happen in a zipfile.. */ From nobody Mon Oct 18 11:18:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C74081805913; Mon, 18 Oct 2021 11:18: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXvWD56pGz3QsR; Mon, 18 Oct 2021 11:18:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EBA11F741; Mon, 18 Oct 2021 11:18:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IBIGJF039707; Mon, 18 Oct 2021 11:18:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IBIGPX039706; Mon, 18 Oct 2021 11:18:16 GMT (envelope-from git) Date: Mon, 18 Oct 2021 11:18:16 GMT Message-Id: <202110181118.19IBIGPX039706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: 94c3735b74f7 - stable/12 - unzip: Fix segmentation fault if a zip file contains buggy filename. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 94c3735b74f796a8b271091a8ebc276021345d79 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=94c3735b74f796a8b271091a8ebc276021345d79 commit 94c3735b74f796a8b271091a8ebc276021345d79 Author: Yoshihiro Takahashi AuthorDate: 2021-10-10 11:49:19 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-18 11:17:27 +0000 unzip: Fix segmentation fault if a zip file contains buggy filename. PR: 259011 Reported by: Robert Morris Submitted by: ak (cherry picked from commit 2c614481fd5248c1685e713f67d40cf2d5fba494) --- usr.bin/unzip/unzip.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index e5ca1ff2c939..0b564b0f08ec 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -211,6 +211,9 @@ pathdup(const char *path) char *str; size_t i, len; + if (path == NULL || path[0] == '\0') + return (NULL); + len = strlen(path); while (len && path[len - 1] == '/') len--; @@ -697,7 +700,11 @@ extract(struct archive *a, struct archive_entry *e) mode_t filetype; char *p, *q; - pathname = pathdup(archive_entry_pathname(e)); + if ((pathname = pathdup(archive_entry_pathname(e))) == NULL) { + warningx("skipping empty or unreadable filename entry"); + ac(archive_read_data_skip(a)); + return; + } filetype = archive_entry_filetype(e); /* sanity checks */ @@ -760,7 +767,11 @@ extract_stdout(struct archive *a, struct archive_entry *e) char *pathname; mode_t filetype; - pathname = pathdup(archive_entry_pathname(e)); + if ((pathname = pathdup(archive_entry_pathname(e))) == NULL) { + warningx("skipping empty or unreadable filename entry"); + ac(archive_read_data_skip(a)); + return; + } filetype = archive_entry_filetype(e); /* I don't think this can happen in a zipfile.. */ From nobody Mon Oct 18 13:02:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 697BB180FDD0; Mon, 18 Oct 2021 13:02:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXxqf1WXCz4cPS; Mon, 18 Oct 2021 13:02:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id cRVBm8gYWczbLcSHlmm6y7; Mon, 18 Oct 2021 13:02:37 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id cSHjm7lzVa8XRcSHkmmT5q; Mon, 18 Oct 2021 13:02:37 +0000 X-Authority-Analysis: v=2.4 cv=Ov8sdwzt c=1 sm=1 tr=0 ts=616d706d a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=8nJEP1OIZ-IA:10 a=8gfv0ekSlNoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=oCJs8q-oAAAA:8 a=EkcXrb_YAAAA:8 a=lYWpZslvAE-qNA2gE9QA:9 a=wPNLvfGTeEIA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=qUF70SbvcHBaGhGVny9j:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id D7181298; Mon, 18 Oct 2021 06:02:34 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19ID2YGj005682; Mon, 18 Oct 2021 06:02:34 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110181302.19ID2YGj005682@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Marcin Wojtas cc: Cy Schubert , Marcin Wojtas , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 889b56c8cd84 - main - setrlimit: Take stack gap into account. In-reply-to: References: <202110150823.19F8NEr9047194@gitrepo.freebsd.org> <202110161602.19GG2FYs004292@slippy.cwsent.com> Comments: In-reply-to Marcin Wojtas message dated "Mon, 18 Oct 2021 13:02:52 +0200." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 18 Oct 2021 06:02:34 -0700 X-CMAE-Envelope: MS4xfBaLWPMcMT+qelIXGJqz+HK9cnldawPOOQRl6/32w+/PgnZVFkLseBDP4wBZ6j1fjOBs3d4uI6jlhUpEA6xY99QqPyZCyNoYPgA8uTZmbf/fzklcfNOz WDlSa+lmWYVhaNugNfivnjuhq+bBRD9xP22ZqEWPtAeXVm885Ib4BT+/y6LukcPziItu498rO8pDMQJXggF37hWu1wGiwjYau/EZ3fY+ehpDCSgMX0afQ3/q fx9YcxCtw3mBKyED0sgZI+TcQsKvoQO0nafgQ5th7Z5tbbYIM4Fg5+fESj4NP4ohJRpqd1A9jIY3J6SEjHjbeW84aQk4kRutYcqoUzCWF/ij2OGIXuWSrC4K S4nnx1Xw X-Rspamd-Queue-Id: 4HXxqf1WXCz4cPS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , Marcin Wojtas writes: > Hi Cy, > > > > sob., 16 paź 2021 o 18:02 Cy Schubert napisał(a > ): > > > > In message <202110150823.19F8NEr9047194@gitrepo.freebsd.org>, Marcin Wojtas > > wri > > tes: > > > The branch main has been updated by mw: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=889b56c8cd84c9a9f2d9e3b019c1 > 54d6 > > > f14d9021 > > > > > > commit 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 > > > Author: Dawid Gorecki > > > AuthorDate: 2021-10-13 19:01:08 +0000 > > > Commit: Marcin Wojtas > > > CommitDate: 2021-10-15 08:21:47 +0000 > > > > > > setrlimit: Take stack gap into account. > > > > > > Calling setrlimit with stack gap enabled and with low values of stack > > > resource limit often caused the program to abort immediately after > > > exiting the syscall. This happened due to the fact that the resource > > > limit was calculated assuming that the stack started at sv_usrstack, > > > while with stack gap enabled the stack is moved by a random number > > > of bytes. > > > > > > Save information about stack size in struct vmspace and adjust the > > > rlim_cur value. If the rlim_cur and stack gap is bigger than rlim_max > , > > > then the value is truncated to rlim_max. > > > > > > PR: 253208 > > > Reviewed by: kib > > > Obtained from: Semihalf > > > Sponsored by: Stormshield > > > MFC after: 1 month > > > Differential Revision: https://reviews.freebsd.org/D31516 > > > --- > > > sys/kern/imgact_elf.c | 5 +++-- > > > sys/kern/kern_exec.c | 11 ++++++++--- > > > sys/kern/kern_resource.c | 3 +++ > > > sys/sys/imgact_elf.h | 2 +- > > > sys/sys/sysent.h | 2 +- > > > sys/vm/vm_map.c | 2 ++ > > > sys/vm/vm_map.h | 1 + > > > 7 files changed, 19 insertions(+), 7 deletions(-) > > > > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > > index ef1edfcabaf0..898f0f66a532 100644 > > > --- a/sys/kern/imgact_elf.c > > > +++ b/sys/kern/imgact_elf.c > > > @@ -2684,7 +2684,7 @@ __elfN(untrans_prot)(vm_prot_t prot) > > > return (flags); > > > } > > > > > > -void > > > +vm_size_t > > > __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base) > > > { > > > uintptr_t range, rbase, gap; > > > @@ -2692,7 +2692,7 @@ __elfN(stackgap)(struct image_params *imgp, uintptr > _t * > > > stack_base) > > > > > > pct = __elfN(aslr_stack_gap); > > > if (pct == 0) > > > - return; > > > + return (0); > > > if (pct > 50) > > > pct = 50; > > > range = imgp->eff_stack_sz * pct / 100; > > > @@ -2700,4 +2700,5 @@ __elfN(stackgap)(struct image_params *imgp, uintptr > _t * > > > stack_base) > > > gap = rbase % range; > > > gap &= ~(sizeof(u_long) - 1); > > > *stack_base -= gap; > > > + return (gap); > > > } > > > diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c > > > index 50e75fda6cfb..9dceebdd8441 100644 > > > --- a/sys/kern/kern_exec.c > > > +++ b/sys/kern/kern_exec.c > > > @@ -1148,6 +1148,7 @@ exec_new_vmspace(struct image_params *imgp, struct > syse > > > ntvec *sv) > > > stack_prot, error, vm_mmap_to_errno(error)); > > > return (vm_mmap_to_errno(error)); > > > } > > > + vmspace->vm_stkgap = 0; > > > > > > /* > > > * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but t > hey > > > @@ -1493,12 +1494,16 @@ exec_args_get_begin_envv(struct image_args *args) > > > void > > > exec_stackgap(struct image_params *imgp, uintptr_t *dp) > > > { > > > + struct proc *p = imgp->proc; > > > + > > > if (imgp->sysent->sv_stackgap == NULL || > > > - (imgp->proc->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > + (p->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > NT_FREEBSD_FCTL_ASG_DISABLE)) != 0 || > > > - (imgp->map_flags & MAP_ASLR) == 0) > > > + (imgp->map_flags & MAP_ASLR) == 0) { > > > + p->p_vmspace->vm_stkgap = 0; > > > return; > > > - imgp->sysent->sv_stackgap(imgp, dp); > > > + } > > > + p->p_vmspace->vm_stkgap = imgp->sysent->sv_stackgap(imgp, dp); > > > } > > > > > > /* > > > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > > > index 4c62961e1bc4..b556d4fded51 100644 > > > --- a/sys/kern/kern_resource.c > > > +++ b/sys/kern/kern_resource.c > > > @@ -671,6 +671,9 @@ kern_proc_setrlimit(struct thread *td, struct proc *p > , u_ > > > int which, > > > if (limp->rlim_max < 0) > > > limp->rlim_max = RLIM_INFINITY; > > > > > > + if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY) > > > + limp->rlim_cur += p->p_vmspace->vm_stkgap; > > > + > > > oldssiz.rlim_cur = 0; > > > newlim = lim_alloc(); > > > PROC_LOCK(p); > > > diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h > > > index 97383c6eeeb8..294f17c87b6f 100644 > > > --- a/sys/sys/imgact_elf.h > > > +++ b/sys/sys/imgact_elf.h > > > @@ -118,7 +118,7 @@ int __elfN(remove_brand_entry)(Elf_Brandinfo *e > ntry > > > ); > > > int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *); > > > int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); > > > size_t __elfN(populate_note)(int, void *, void *, size_t, void **) > ; > > > -void __elfN(stackgap)(struct image_params *, uintptr_t *); > > > +vm_size_t __elfN(stackgap)(struct image_params *, uintptr_t *); > > > int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t); > > > void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); > > > void __elfN(prepare_notes)(struct thread *, struct note_info_list *, > > > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > > > index ad50bf56e87d..ea96c87a79af 100644 > > > --- a/sys/sys/sysent.h > > > +++ b/sys/sys/sysent.h > > > @@ -119,7 +119,7 @@ struct sysentvec { > > > void (*sv_elf_core_prepare_notes)(struct thread *, > > > struct note_info_list *, size_t *); > > > int (*sv_imgact_try)(struct image_params *); > > > - void (*sv_stackgap)(struct image_params *, uintptr_t *); > > > + vm_size_t (*sv_stackgap)(struct image_params *, uintptr_t *); > > > int (*sv_copyout_auxargs)(struct image_params *, > > > uintptr_t); > > > int sv_minsigstksz; /* minimum signal stack size */ > > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c > > > index 1ac4ccf72f11..87a290b998b9 100644 > > > --- a/sys/vm/vm_map.c > > > +++ b/sys/vm/vm_map.c > > > @@ -343,6 +343,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, pmap_ > pini > > > t_t pinit) > > > vm->vm_taddr = 0; > > > vm->vm_daddr = 0; > > > vm->vm_maxsaddr = 0; > > > + vm->vm_stkgap = 0; > > > return (vm); > > > } > > > > > > @@ -4265,6 +4266,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *for > k_ch > > > arge) > > > vm2->vm_taddr = vm1->vm_taddr; > > > vm2->vm_daddr = vm1->vm_daddr; > > > vm2->vm_maxsaddr = vm1->vm_maxsaddr; > > > + vm2->vm_stkgap = vm1->vm_stkgap; > > > vm_map_lock(old_map); > > > if (old_map->busy) > > > vm_map_wait_busy(old_map); > > > diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h > > > index ace205b21b42..873ff62eec4a 100644 > > > --- a/sys/vm/vm_map.h > > > +++ b/sys/vm/vm_map.h > > > @@ -293,6 +293,7 @@ struct vmspace { > > > caddr_t vm_taddr; /* (c) user virtual address of text */ > > > caddr_t vm_daddr; /* (c) user virtual address of data */ > > > caddr_t vm_maxsaddr; /* user VA at max stack growth */ > > > + vm_size_t vm_stkgap; /* stack gap size in bytes */ > > > u_int vm_refcnt; /* number of references */ > > > /* > > > * Keep the PMAP last, so that CPU-specific variations of that > > > > > > > Is it possible to have a __FreeBSD_version bump for ports? > > > > > > At a first glance I don't see the ports' global versioning apart from > creating tags, but maybe ports' maintainers will have more insight. I'm also the ntp port maintainer, hence the request. But no worries. I used the prior __FreeBSD_version bump at the time. There was another __FreeBSD_version bump yesterday (Sunday). Since this commit is in between the two I'll update the patch to use the second one and send the patch upstream. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Mon Oct 18 13:03:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CA4821810538 for ; Mon, 18 Oct 2021 13:03:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXxrv0br6z4ctW for ; Mon, 18 Oct 2021 13:03:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x931.google.com with SMTP id r17so1064780uaf.8 for ; Mon, 18 Oct 2021 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hwMbT7zkAaodKlgdcGGK6mQsGWZRjNtTeoX9mF3fpkI=; b=cl3wPFmcpO14gHMsZRttrZ60l4O7Pty0JQqCgrY10rCMMlsFNCpWbaZvEHjjc4g6IG H1hYTKkJQFSdqfbWlXSCe8Kj4u4sCRXsrEqnp6Arsh0fYac906ja6n+hxIdLtDG/Rd5q 70rR3roD7WhsoML8UX/lgkkTeniTI3yo7MsECp/dozKamP5xCTP8jPuBIKkOU20laurF RR3evk/XkIN/MyOuPXVZaZpmYb4E1C5MLCaLsmcuExGnXVJkbX+MwEr34fonXGuqMclJ af3N3oH6O+jy18fM0k1cxhacWEh26zPuvPBszzVvPa4rJ01gKS5zdJZr0Yxx39Okz1pZ wAcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hwMbT7zkAaodKlgdcGGK6mQsGWZRjNtTeoX9mF3fpkI=; b=tN0SjZIO4jqt/EmoZNGx9XDwL/2VHIDe+8UCjzUok00s+DcwKfN3eUQuC3she8goWF AFyml9QufU8WK1rSos9q5FZF7w88txuy3OLXrQcFQTCr0l2aaRmAdD2KP3ag3Oq+GMy9 4aL8QqSPwXmgIgEOXRCToPX7orlRCsN/0bI4lxuZBQljx0Fh/v7EjwEdederhlK7KZTF qrAv/F3OFsPYWzkC4ALMkRE5VJIKe7xjUoB0DZT5auK11yGj06EgECG7zM+LVMILMyG7 Og5g1LLAwxJSR8j7W41NSubeSUjU5TpSXFOwASmSH/Cy/hFKXRwezhy828feGzs9HuM6 PqOw== X-Gm-Message-State: AOAM530ioZMeC1MQOMYaknvN5xfOty1z4Po0/Cetaarl0syUZY50KRkd sve2bh12RXVhCam16dCvv5O6YfRRKYeUUHGyMsLgtA== X-Google-Smtp-Source: ABdhPJyVGkRQ2dTHXH67ihoWxOh/LHqy9oSrx9r8zxvivnug6X9g19Bv2EihFAE2JDG+GEQCpnpeybhaWO2auVNBSh8= X-Received: by 2002:ab0:3010:: with SMTP id f16mr1576390ual.11.1634562222176; Mon, 18 Oct 2021 06:03:42 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110150823.19F8NEr9047194@gitrepo.freebsd.org> <202110161602.19GG2FYs004292@slippy.cwsent.com> In-Reply-To: <202110161602.19GG2FYs004292@slippy.cwsent.com> From: Warner Losh Date: Mon, 18 Oct 2021 07:03:29 -0600 Message-ID: Subject: Re: git: 889b56c8cd84 - main - setrlimit: Take stack gap into account. To: Cy Schubert Cc: Marcin Wojtas , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000009dcc8205cea02c1b" X-Rspamd-Queue-Id: 4HXxrv0br6z4ctW X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=cl3wPFmc; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::931) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-0.83 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::931:from]; NEURAL_HAM_SHORT(-0.83)[-0.829]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --0000000000009dcc8205cea02c1b Content-Type: text/plain; charset="UTF-8" On Sat, Oct 16, 2021, 10:02 AM Cy Schubert wrote: > In message <202110150823.19F8NEr9047194@gitrepo.freebsd.org>, Marcin > Wojtas > wri > tes: > > The branch main has been updated by mw: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=889b56c8cd84c9a9f2d9e3b019c154d6 > > f14d9021 > > > > commit 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 > > Author: Dawid Gorecki > > AuthorDate: 2021-10-13 19:01:08 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-10-15 08:21:47 +0000 > > > > setrlimit: Take stack gap into account. > > > > Calling setrlimit with stack gap enabled and with low values of stack > > resource limit often caused the program to abort immediately after > > exiting the syscall. This happened due to the fact that the resource > > limit was calculated assuming that the stack started at sv_usrstack, > > while with stack gap enabled the stack is moved by a random number > > of bytes. > > > > Save information about stack size in struct vmspace and adjust the > > rlim_cur value. If the rlim_cur and stack gap is bigger than > rlim_max, > > then the value is truncated to rlim_max. > > > > PR: 253208 > > Reviewed by: kib > > Obtained from: Semihalf > > Sponsored by: Stormshield > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D31516 > > --- > > sys/kern/imgact_elf.c | 5 +++-- > > sys/kern/kern_exec.c | 11 ++++++++--- > > sys/kern/kern_resource.c | 3 +++ > > sys/sys/imgact_elf.h | 2 +- > > sys/sys/sysent.h | 2 +- > > sys/vm/vm_map.c | 2 ++ > > sys/vm/vm_map.h | 1 + > > 7 files changed, 19 insertions(+), 7 deletions(-) > > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > index ef1edfcabaf0..898f0f66a532 100644 > > --- a/sys/kern/imgact_elf.c > > +++ b/sys/kern/imgact_elf.c > > @@ -2684,7 +2684,7 @@ __elfN(untrans_prot)(vm_prot_t prot) > > return (flags); > > } > > > > -void > > +vm_size_t > > __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base) > > { > > uintptr_t range, rbase, gap; > > @@ -2692,7 +2692,7 @@ __elfN(stackgap)(struct image_params *imgp, > uintptr_t * > > stack_base) > > > > pct = __elfN(aslr_stack_gap); > > if (pct == 0) > > - return; > > + return (0); > > if (pct > 50) > > pct = 50; > > range = imgp->eff_stack_sz * pct / 100; > > @@ -2700,4 +2700,5 @@ __elfN(stackgap)(struct image_params *imgp, > uintptr_t * > > stack_base) > > gap = rbase % range; > > gap &= ~(sizeof(u_long) - 1); > > *stack_base -= gap; > > + return (gap); > > } > > diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c > > index 50e75fda6cfb..9dceebdd8441 100644 > > --- a/sys/kern/kern_exec.c > > +++ b/sys/kern/kern_exec.c > > @@ -1148,6 +1148,7 @@ exec_new_vmspace(struct image_params *imgp, struct > syse > > ntvec *sv) > > stack_prot, error, vm_mmap_to_errno(error)); > > return (vm_mmap_to_errno(error)); > > } > > + vmspace->vm_stkgap = 0; > > > > /* > > * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but > they > > @@ -1493,12 +1494,16 @@ exec_args_get_begin_envv(struct image_args *args) > > void > > exec_stackgap(struct image_params *imgp, uintptr_t *dp) > > { > > + struct proc *p = imgp->proc; > > + > > if (imgp->sysent->sv_stackgap == NULL || > > - (imgp->proc->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > + (p->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > NT_FREEBSD_FCTL_ASG_DISABLE)) != 0 || > > - (imgp->map_flags & MAP_ASLR) == 0) > > + (imgp->map_flags & MAP_ASLR) == 0) { > > + p->p_vmspace->vm_stkgap = 0; > > return; > > - imgp->sysent->sv_stackgap(imgp, dp); > > + } > > + p->p_vmspace->vm_stkgap = imgp->sysent->sv_stackgap(imgp, dp); > > } > > > > /* > > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > > index 4c62961e1bc4..b556d4fded51 100644 > > --- a/sys/kern/kern_resource.c > > +++ b/sys/kern/kern_resource.c > > @@ -671,6 +671,9 @@ kern_proc_setrlimit(struct thread *td, struct proc > *p, u_ > > int which, > > if (limp->rlim_max < 0) > > limp->rlim_max = RLIM_INFINITY; > > > > + if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY) > > + limp->rlim_cur += p->p_vmspace->vm_stkgap; > > + > > oldssiz.rlim_cur = 0; > > newlim = lim_alloc(); > > PROC_LOCK(p); > > diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h > > index 97383c6eeeb8..294f17c87b6f 100644 > > --- a/sys/sys/imgact_elf.h > > +++ b/sys/sys/imgact_elf.h > > @@ -118,7 +118,7 @@ int __elfN(remove_brand_entry)(Elf_Brandinfo > *entry > > ); > > int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *); > > int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); > > size_t __elfN(populate_note)(int, void *, void *, size_t, void > **); > > -void __elfN(stackgap)(struct image_params *, uintptr_t *); > > +vm_size_t __elfN(stackgap)(struct image_params *, uintptr_t *); > > int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t); > > void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); > > void __elfN(prepare_notes)(struct thread *, struct note_info_list *, > > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > > index ad50bf56e87d..ea96c87a79af 100644 > > --- a/sys/sys/sysent.h > > +++ b/sys/sys/sysent.h > > @@ -119,7 +119,7 @@ struct sysentvec { > > void (*sv_elf_core_prepare_notes)(struct thread *, > > struct note_info_list *, size_t *); > > int (*sv_imgact_try)(struct image_params *); > > - void (*sv_stackgap)(struct image_params *, uintptr_t *); > > + vm_size_t (*sv_stackgap)(struct image_params *, uintptr_t *); > > int (*sv_copyout_auxargs)(struct image_params *, > > uintptr_t); > > int sv_minsigstksz; /* minimum signal stack size */ > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c > > index 1ac4ccf72f11..87a290b998b9 100644 > > --- a/sys/vm/vm_map.c > > +++ b/sys/vm/vm_map.c > > @@ -343,6 +343,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, > pmap_pini > > t_t pinit) > > vm->vm_taddr = 0; > > vm->vm_daddr = 0; > > vm->vm_maxsaddr = 0; > > + vm->vm_stkgap = 0; > > return (vm); > > } > > > > @@ -4265,6 +4266,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t > *fork_ch > > arge) > > vm2->vm_taddr = vm1->vm_taddr; > > vm2->vm_daddr = vm1->vm_daddr; > > vm2->vm_maxsaddr = vm1->vm_maxsaddr; > > + vm2->vm_stkgap = vm1->vm_stkgap; > > vm_map_lock(old_map); > > if (old_map->busy) > > vm_map_wait_busy(old_map); > > diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h > > index ace205b21b42..873ff62eec4a 100644 > > --- a/sys/vm/vm_map.h > > +++ b/sys/vm/vm_map.h > > @@ -293,6 +293,7 @@ struct vmspace { > > caddr_t vm_taddr; /* (c) user virtual address of text */ > > caddr_t vm_daddr; /* (c) user virtual address of data */ > > caddr_t vm_maxsaddr; /* user VA at max stack growth */ > > + vm_size_t vm_stkgap; /* stack gap size in bytes */ > > u_int vm_refcnt; /* number of references */ > > /* > > * Keep the PMAP last, so that CPU-specific variations of that > > > > Is it possible to have a __FreeBSD_version bump for ports? > There was a bump for linuxkpi you should use for this. It was a day or so after the stackgap change. Warner Warner -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org > > The need of the many outweighs the greed of the few. > > > > --0000000000009dcc8205cea02c1b-- From nobody Mon Oct 18 13:08:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 094561812E78; Mon, 18 Oct 2021 13:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXxyk6sxkz4f6f; Mon, 18 Oct 2021 13:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C89C020F30; Mon, 18 Oct 2021 13:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19ID8kAV086648; Mon, 18 Oct 2021 13:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19ID8kGP086647; Mon, 18 Oct 2021 13:08:46 GMT (envelope-from git) Date: Mon, 18 Oct 2021 13:08:46 GMT Message-Id: <202110181308.19ID8kGP086647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 116a988f99cd - stable/12 - geom_label: Add more validation for NTFS volume tasting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 116a988f99cd9fcac1a34c17ec0aa81be70d5e4f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=116a988f99cd9fcac1a34c17ec0aa81be70d5e4f commit 116a988f99cd9fcac1a34c17ec0aa81be70d5e4f Author: Mark Johnston AuthorDate: 2021-10-04 21:48:44 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:08:32 +0000 geom_label: Add more validation for NTFS volume tasting - Ensure that the computed MFT record size isn't negative or larger than maxphys before trying to read $Volume. - Guard against truncated records in volume metadata. - Ensure that the record length is large enough to contain the volume name. - Verify that the (UTF-16-encoded) volume name's length is a multiple of two. PR: 258833, 258914 Sponsored by: The FreeBSD Foundation (cherry picked from commit f0a08fa9f532a58f5d7a4814d6eb7ddd49f368da) --- sys/geom/label/g_label_ntfs.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/sys/geom/label/g_label_ntfs.c b/sys/geom/label/g_label_ntfs.c index 653524ab654c..bcf6a3a72b36 100644 --- a/sys/geom/label/g_label_ntfs.c +++ b/sys/geom/label/g_label_ntfs.c @@ -101,7 +101,8 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) struct ntfs_filerec *fr; struct ntfs_attr *atr; off_t voloff; - char *filerecp, *ap; + size_t recoff; + char *filerecp; int8_t mftrecsz; char vnchar; int recsize, j; @@ -117,8 +118,9 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) goto done; mftrecsz = bf->bf_mftrecsz; - recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); - if (recsize == 0 || recsize % pp->sectorsize != 0) + recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : + (1 << -mftrecsz); + if (recsize <= 0 || recsize > maxphys || recsize % pp->sectorsize != 0) goto done; voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps + @@ -130,24 +132,33 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) if (filerecp == NULL) goto done; fr = (struct ntfs_filerec *)filerecp; - if (fr->fr_hdrmagic != NTFS_FILEMAGIC) goto done; - for (ap = filerecp + fr->fr_attroff; - atr = (struct ntfs_attr *)ap, atr->a_type != -1; - ap += atr->reclen) { + for (recoff = fr->fr_attroff; + recoff <= recsize - 2 * sizeof(uint32_t); + recoff += atr->reclen) { + atr = (struct ntfs_attr *)(filerecp + recoff); + if (atr->a_type == -1) + break; + if (atr->reclen < sizeof(*atr)) + break; + if (recsize - recoff < atr->reclen) + break; if (atr->a_type == NTFS_A_VOLUMENAME) { - if(atr->a_datalen >= size *2){ - label[0] = 0; - goto done; - } + if (atr->a_dataoff > atr->reclen || + atr->a_datalen > atr->reclen - atr->a_dataoff) + break; + /* - *UNICODE to ASCII. + * UNICODE to ASCII. * Should we need to use iconv(9)? */ + if (atr->a_datalen >= size * 2 || + atr->a_datalen % 2 != 0) + break; for (j = 0; j < atr->a_datalen; j++) { - vnchar = *(ap + atr->a_dataoff + j); + vnchar = ((char *)atr)[atr->a_dataoff + j]; if (j & 1) { if (vnchar) { label[0] = 0; From nobody Mon Oct 18 13:08:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3C1591812F6A; Mon, 18 Oct 2021 13:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXxyq104Pz4fKW; Mon, 18 Oct 2021 13:08:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F367320FDB; Mon, 18 Oct 2021 13:08:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19ID8o8l086776; Mon, 18 Oct 2021 13:08:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19ID8oGD086775; Mon, 18 Oct 2021 13:08:50 GMT (envelope-from git) Date: Mon, 18 Oct 2021 13:08:50 GMT Message-Id: <202110181308.19ID8oGD086775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 41dbff735184 - stable/13 - geom_label: Add more validation for NTFS volume tasting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 41dbff735184337b910b36a4ce963b36233916e4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=41dbff735184337b910b36a4ce963b36233916e4 commit 41dbff735184337b910b36a4ce963b36233916e4 Author: Mark Johnston AuthorDate: 2021-10-04 21:48:44 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:07:58 +0000 geom_label: Add more validation for NTFS volume tasting - Ensure that the computed MFT record size isn't negative or larger than maxphys before trying to read $Volume. - Guard against truncated records in volume metadata. - Ensure that the record length is large enough to contain the volume name. - Verify that the (UTF-16-encoded) volume name's length is a multiple of two. PR: 258833, 258914 Sponsored by: The FreeBSD Foundation (cherry picked from commit f0a08fa9f532a58f5d7a4814d6eb7ddd49f368da) --- sys/geom/label/g_label_ntfs.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/sys/geom/label/g_label_ntfs.c b/sys/geom/label/g_label_ntfs.c index f78d4d28b967..888096164b09 100644 --- a/sys/geom/label/g_label_ntfs.c +++ b/sys/geom/label/g_label_ntfs.c @@ -99,7 +99,8 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) struct ntfs_filerec *fr; struct ntfs_attr *atr; off_t voloff; - char *filerecp, *ap; + size_t recoff; + char *filerecp; int8_t mftrecsz; char vnchar; int recsize, j; @@ -119,8 +120,9 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) goto done; mftrecsz = bf->bf_mftrecsz; - recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); - if (recsize == 0 || recsize % pp->sectorsize != 0) + recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : + (1 << -mftrecsz); + if (recsize <= 0 || recsize > maxphys || recsize % pp->sectorsize != 0) goto done; voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps + @@ -132,24 +134,33 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) if (filerecp == NULL) goto done; fr = (struct ntfs_filerec *)filerecp; - if (fr->fr_hdrmagic != NTFS_FILEMAGIC) goto done; - for (ap = filerecp + fr->fr_attroff; - atr = (struct ntfs_attr *)ap, atr->a_type != -1; - ap += atr->reclen) { + for (recoff = fr->fr_attroff; + recoff <= recsize - 2 * sizeof(uint32_t); + recoff += atr->reclen) { + atr = (struct ntfs_attr *)(filerecp + recoff); + if (atr->a_type == -1) + break; + if (atr->reclen < sizeof(*atr)) + break; + if (recsize - recoff < atr->reclen) + break; if (atr->a_type == NTFS_A_VOLUMENAME) { - if(atr->a_datalen >= size *2){ - label[0] = 0; - goto done; - } + if (atr->a_dataoff > atr->reclen || + atr->a_datalen > atr->reclen - atr->a_dataoff) + break; + /* - *UNICODE to ASCII. + * UNICODE to ASCII. * Should we need to use iconv(9)? */ + if (atr->a_datalen >= size * 2 || + atr->a_datalen % 2 != 0) + break; for (j = 0; j < atr->a_datalen; j++) { - vnchar = *(ap + atr->a_dataoff + j); + vnchar = ((char *)atr)[atr->a_dataoff + j]; if (j & 1) { if (vnchar) { label[0] = 0; From nobody Mon Oct 18 13:09:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A0C8A1813A85; Mon, 18 Oct 2021 13:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXxzX431zz4g8r; Mon, 18 Oct 2021 13:09:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 682D720EE2; Mon, 18 Oct 2021 13:09:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19ID9SVh086961; Mon, 18 Oct 2021 13:09:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19ID9SYs086960; Mon, 18 Oct 2021 13:09:28 GMT (envelope-from git) Date: Mon, 18 Oct 2021 13:09:28 GMT Message-Id: <202110181309.19ID9SYs086960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: feb3289f4977 - stable/13 - libctf: Improve check for duplicate SOU definitions in ctf_add_type() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: feb3289f497719267ae2fb95d38d6352dbac784e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=feb3289f497719267ae2fb95d38d6352dbac784e commit feb3289f497719267ae2fb95d38d6352dbac784e Author: Mark Johnston AuthorDate: 2021-10-04 16:28:22 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:09:02 +0000 libctf: Improve check for duplicate SOU definitions in ctf_add_type() When copying a struct or union from one CTF container to another, ctf_add_type() checks whether it matches an existing type in the destination container. It does so by looking for a type with the same name and kind as the new type, and if one exists, it iterates over all members of the source type and checks whether a member with matching name and offset exists in the matched destination type. This can produce false positives, for example because member types are not compared, but this is not expected to arise in practice. If the match fails, ctf_add_type() returns an error. The procedure used for member comparison breaks down in the face of anonymous struct and union members. ctf_member_iter() visits each member in the source definition and looks up the corresponding member in the desination definition by name using ctf_member_info(), but this function will descend into anonymous members and thus fail to match. Fix the problem by introducing a custom comparison routine which does not assume member names are unique. This should also be faster for types with many members; in the previous scheme, membcmp() would perform a linear scan of the desination type's members to perform a lookup by name. The new routine steps through the members of both types in a single loop. PR: 258763 Sponsored by: The FreeBSD Foundation (cherry picked from commit 105fd928b0b5b35ab529e5f6914788dc49582901) --- cddl/contrib/opensolaris/common/ctf/ctf_create.c | 100 +++++++++++++++++------ 1 file changed, 73 insertions(+), 27 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_create.c b/cddl/contrib/opensolaris/common/ctf/ctf_create.c index ae4cc7f31176..3a080e71baa0 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_create.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_create.c @@ -1196,17 +1196,6 @@ enumadd(const char *name, int value, void *arg) name, value) == CTF_ERR); } -/*ARGSUSED*/ -static int -membcmp(const char *name, ctf_id_t type, ulong_t offset, void *arg) -{ - ctf_bundle_t *ctb = arg; - ctf_membinfo_t ctm; - - return (ctf_member_info(ctb->ctb_file, ctb->ctb_type, - name, &ctm) == CTF_ERR || ctm.ctm_offset != offset); -} - static int membadd(const char *name, ctf_id_t type, ulong_t offset, void *arg) { @@ -1240,6 +1229,71 @@ membadd(const char *name, ctf_id_t type, ulong_t offset, void *arg) return (0); } +static long +soucmp(ctf_file_t *src_fp, ctf_id_t src_type, ctf_file_t *dst_fp, + ctf_id_t dst_type) +{ + const struct ctf_type *src_tp, *dst_tp; + const char *src_name, *dst_name; + ssize_t src_sz, dst_sz, src_inc, dst_inc; + uint_t kind, n; + + if ((src_type = ctf_type_resolve(src_fp, src_type)) == CTF_ERR) + return (CTF_ERR); + if ((dst_type = ctf_type_resolve(dst_fp, dst_type)) == CTF_ERR) + return (CTF_ERR); + + if ((src_tp = ctf_lookup_by_id(&src_fp, src_type)) == NULL) + return (CTF_ERR); + if ((dst_tp = ctf_lookup_by_id(&dst_fp, dst_type)) == NULL) + return (CTF_ERR); + + if ((kind = LCTF_INFO_KIND(src_fp, src_tp->ctt_info)) != + LCTF_INFO_KIND(dst_fp, dst_tp->ctt_info)) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + if ((n = LCTF_INFO_VLEN(src_fp, src_tp->ctt_info)) != + LCTF_INFO_VLEN(dst_fp, dst_tp->ctt_info)) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + + (void) ctf_get_ctt_size(src_fp, src_tp, &src_sz, &src_inc); + (void) ctf_get_ctt_size(dst_fp, dst_tp, &dst_sz, &dst_inc); + if (src_sz != dst_sz || src_inc != dst_inc) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + + if (src_sz < CTF_LSTRUCT_THRESH) { + const ctf_member_t *src_mp, *dst_mp; + + src_mp = (const ctf_member_t *)((uintptr_t)src_tp + src_inc); + dst_mp = (const ctf_member_t *)((uintptr_t)dst_tp + dst_inc); + for (; n != 0; n--, src_mp++, dst_mp++) { + if (src_mp->ctm_offset != dst_mp->ctm_offset) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + src_name = ctf_strptr(src_fp, src_mp->ctm_name); + dst_name = ctf_strptr(dst_fp, dst_mp->ctm_name); + if (strcmp(src_name, dst_name) != 0) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + } + } else { + const ctf_lmember_t *src_mp, *dst_mp; + + src_mp = (const ctf_lmember_t *)((uintptr_t)src_tp + src_inc); + dst_mp = (const ctf_lmember_t *)((uintptr_t)dst_tp + dst_inc); + for (; n != 0; n--, src_mp++, dst_mp++) { + if (src_mp->ctlm_offsethi != dst_mp->ctlm_offsethi || + src_mp->ctlm_offsetlo != dst_mp->ctlm_offsetlo) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + src_name = ctf_strptr(src_fp, src_mp->ctlm_name); + dst_name = ctf_strptr(dst_fp, dst_mp->ctlm_name); + if (strcmp(src_name, dst_name) != 0) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + } + } + + return (0); +} + /* * The ctf_add_type routine is used to copy a type from a source CTF container * to a dynamic destination container. This routine operates recursively by @@ -1460,23 +1514,15 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type) ctf_dmdef_t *dmd; int errs = 0; - /* - * Technically to match a struct or union we need to check both - * ways (src members vs. dst, dst members vs. src) but we make - * this more optimal by only checking src vs. dst and comparing - * the total size of the structure (which we must do anyway) - * which covers the possibility of dst members not in src. - * This optimization can be defeated for unions, but is so - * pathological as to render it irrelevant for our purposes. - */ if (dst_type != CTF_ERR && dst_kind != CTF_K_FORWARD) { - if (ctf_type_size(src_fp, src_type) != - ctf_type_size(dst_fp, dst_type)) - return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); - - if (ctf_member_iter(src_fp, src_type, membcmp, &dst)) - return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); - + /* + * Compare the sizes and fields of the two types. + * The field comparisons only check the names and + * offsets, so this is not perfect but is good enough + * for scenarios that we care about. + */ + if (soucmp(src_fp, src_type, dst_fp, dst_type) != 0) + return (CTF_ERR); /* errno is set for us */ break; } From nobody Mon Oct 18 13:10:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06E731813D7D; Mon, 18 Oct 2021 13:10:14 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXy0P66SCz4gWg; Mon, 18 Oct 2021 13:10:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id c6DimkAQWps7PcSP7mGSyG; Mon, 18 Oct 2021 13:10:13 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id cSP6m7oVva8XRcSP6mmUDZ; Mon, 18 Oct 2021 13:10:13 +0000 X-Authority-Analysis: v=2.4 cv=Ov8sdwzt c=1 sm=1 tr=0 ts=616d7235 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=8gfv0ekSlNoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=oCJs8q-oAAAA:8 a=EkcXrb_YAAAA:8 a=lYWpZslvAE-qNA2gE9QA:9 a=CjuIK1q_8ugA:10 a=UJ0tAi3fqDAA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=qUF70SbvcHBaGhGVny9j:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id A2200263; Mon, 18 Oct 2021 06:10:11 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19IDABYd005908; Mon, 18 Oct 2021 06:10:11 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110181310.19IDABYd005908@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Warner Losh cc: Cy Schubert , Marcin Wojtas , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 889b56c8cd84 - main - setrlimit: Take stack gap into account. In-reply-to: References: <202110150823.19F8NEr9047194@gitrepo.freebsd.org> <202110161602.19GG2FYs004292@slippy.cwsent.com> Comments: In-reply-to Warner Losh message dated "Mon, 18 Oct 2021 07:03:29 -0600." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 18 Oct 2021 06:10:11 -0700 X-CMAE-Envelope: MS4xfHOq2+XhK3NvqIqSNoPxGrc7cG2ZWu0LATSbjfiOT+pHENzlcqKU4h4z003n4OZ0ouV3NZGTultcQwlEWDvoAE78BCz0ABuJTi/cu3owZT/lgcc35pGF NUji0TDndOWbaPaZ85Ewo/09ZfxkW/GN80M8IUsjXnM7iryqHEhAmfHfiu1NAzJ1DO/+Zb3LAQ4diEpxxYMNmHRNUjjp4sCAdB4RgwhR9jgjkiwcQlVMGaH3 GGEkvFK6hlZoGRtS/aWHBgMGU+BNgMVYzNac2P50yQi0uxoLlBFJD7ZKBk1ZoadP0rCohYf57mO8Qc0A27CKNO9xDrrk3vxP4SswKSLHZJVon4c5kIzEvbJ6 gGzsXCgf X-Rspamd-Queue-Id: 4HXy0P66SCz4gWg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , Warner Losh writes: > On Sat, Oct 16, 2021, 10:02 AM Cy Schubert > wrote: > > > In message <202110150823.19F8NEr9047194@gitrepo.freebsd.org>, Marcin > > Wojtas > > wri > > tes: > > > The branch main has been updated by mw: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=889b56c8cd84c9a9f2d9e3b019c154d6 > > > f14d9021 > > > > > > commit 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 > > > Author: Dawid Gorecki > > > AuthorDate: 2021-10-13 19:01:08 +0000 > > > Commit: Marcin Wojtas > > > CommitDate: 2021-10-15 08:21:47 +0000 > > > > > > setrlimit: Take stack gap into account. > > > > > > Calling setrlimit with stack gap enabled and with low values of stack > > > resource limit often caused the program to abort immediately after > > > exiting the syscall. This happened due to the fact that the resource > > > limit was calculated assuming that the stack started at sv_usrstack, > > > while with stack gap enabled the stack is moved by a random number > > > of bytes. > > > > > > Save information about stack size in struct vmspace and adjust the > > > rlim_cur value. If the rlim_cur and stack gap is bigger than > > rlim_max, > > > then the value is truncated to rlim_max. > > > > > > PR: 253208 > > > Reviewed by: kib > > > Obtained from: Semihalf > > > Sponsored by: Stormshield > > > MFC after: 1 month > > > Differential Revision: https://reviews.freebsd.org/D31516 > > > --- > > > sys/kern/imgact_elf.c | 5 +++-- > > > sys/kern/kern_exec.c | 11 ++++++++--- > > > sys/kern/kern_resource.c | 3 +++ > > > sys/sys/imgact_elf.h | 2 +- > > > sys/sys/sysent.h | 2 +- > > > sys/vm/vm_map.c | 2 ++ > > > sys/vm/vm_map.h | 1 + > > > 7 files changed, 19 insertions(+), 7 deletions(-) > > > > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > > index ef1edfcabaf0..898f0f66a532 100644 > > > --- a/sys/kern/imgact_elf.c > > > +++ b/sys/kern/imgact_elf.c > > > @@ -2684,7 +2684,7 @@ __elfN(untrans_prot)(vm_prot_t prot) > > > return (flags); > > > } > > > > > > -void > > > +vm_size_t > > > __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base) > > > { > > > uintptr_t range, rbase, gap; > > > @@ -2692,7 +2692,7 @@ __elfN(stackgap)(struct image_params *imgp, > > uintptr_t * > > > stack_base) > > > > > > pct = __elfN(aslr_stack_gap); > > > if (pct == 0) > > > - return; > > > + return (0); > > > if (pct > 50) > > > pct = 50; > > > range = imgp->eff_stack_sz * pct / 100; > > > @@ -2700,4 +2700,5 @@ __elfN(stackgap)(struct image_params *imgp, > > uintptr_t * > > > stack_base) > > > gap = rbase % range; > > > gap &= ~(sizeof(u_long) - 1); > > > *stack_base -= gap; > > > + return (gap); > > > } > > > diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c > > > index 50e75fda6cfb..9dceebdd8441 100644 > > > --- a/sys/kern/kern_exec.c > > > +++ b/sys/kern/kern_exec.c > > > @@ -1148,6 +1148,7 @@ exec_new_vmspace(struct image_params *imgp, struct > > syse > > > ntvec *sv) > > > stack_prot, error, vm_mmap_to_errno(error)); > > > return (vm_mmap_to_errno(error)); > > > } > > > + vmspace->vm_stkgap = 0; > > > > > > /* > > > * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but > > they > > > @@ -1493,12 +1494,16 @@ exec_args_get_begin_envv(struct image_args *args) > > > void > > > exec_stackgap(struct image_params *imgp, uintptr_t *dp) > > > { > > > + struct proc *p = imgp->proc; > > > + > > > if (imgp->sysent->sv_stackgap == NULL || > > > - (imgp->proc->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > + (p->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > NT_FREEBSD_FCTL_ASG_DISABLE)) != 0 || > > > - (imgp->map_flags & MAP_ASLR) == 0) > > > + (imgp->map_flags & MAP_ASLR) == 0) { > > > + p->p_vmspace->vm_stkgap = 0; > > > return; > > > - imgp->sysent->sv_stackgap(imgp, dp); > > > + } > > > + p->p_vmspace->vm_stkgap = imgp->sysent->sv_stackgap(imgp, dp); > > > } > > > > > > /* > > > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > > > index 4c62961e1bc4..b556d4fded51 100644 > > > --- a/sys/kern/kern_resource.c > > > +++ b/sys/kern/kern_resource.c > > > @@ -671,6 +671,9 @@ kern_proc_setrlimit(struct thread *td, struct proc > > *p, u_ > > > int which, > > > if (limp->rlim_max < 0) > > > limp->rlim_max = RLIM_INFINITY; > > > > > > + if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY) > > > + limp->rlim_cur += p->p_vmspace->vm_stkgap; > > > + > > > oldssiz.rlim_cur = 0; > > > newlim = lim_alloc(); > > > PROC_LOCK(p); > > > diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h > > > index 97383c6eeeb8..294f17c87b6f 100644 > > > --- a/sys/sys/imgact_elf.h > > > +++ b/sys/sys/imgact_elf.h > > > @@ -118,7 +118,7 @@ int __elfN(remove_brand_entry)(Elf_Brandinfo > > *entry > > > ); > > > int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *); > > > int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); > > > size_t __elfN(populate_note)(int, void *, void *, size_t, void > > **); > > > -void __elfN(stackgap)(struct image_params *, uintptr_t *); > > > +vm_size_t __elfN(stackgap)(struct image_params *, uintptr_t *); > > > int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t); > > > void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); > > > void __elfN(prepare_notes)(struct thread *, struct note_info_list *, > > > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > > > index ad50bf56e87d..ea96c87a79af 100644 > > > --- a/sys/sys/sysent.h > > > +++ b/sys/sys/sysent.h > > > @@ -119,7 +119,7 @@ struct sysentvec { > > > void (*sv_elf_core_prepare_notes)(struct thread *, > > > struct note_info_list *, size_t *); > > > int (*sv_imgact_try)(struct image_params *); > > > - void (*sv_stackgap)(struct image_params *, uintptr_t *); > > > + vm_size_t (*sv_stackgap)(struct image_params *, uintptr_t *); > > > int (*sv_copyout_auxargs)(struct image_params *, > > > uintptr_t); > > > int sv_minsigstksz; /* minimum signal stack size */ > > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c > > > index 1ac4ccf72f11..87a290b998b9 100644 > > > --- a/sys/vm/vm_map.c > > > +++ b/sys/vm/vm_map.c > > > @@ -343,6 +343,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, > > pmap_pini > > > t_t pinit) > > > vm->vm_taddr = 0; > > > vm->vm_daddr = 0; > > > vm->vm_maxsaddr = 0; > > > + vm->vm_stkgap = 0; > > > return (vm); > > > } > > > > > > @@ -4265,6 +4266,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t > > *fork_ch > > > arge) > > > vm2->vm_taddr = vm1->vm_taddr; > > > vm2->vm_daddr = vm1->vm_daddr; > > > vm2->vm_maxsaddr = vm1->vm_maxsaddr; > > > + vm2->vm_stkgap = vm1->vm_stkgap; > > > vm_map_lock(old_map); > > > if (old_map->busy) > > > vm_map_wait_busy(old_map); > > > diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h > > > index ace205b21b42..873ff62eec4a 100644 > > > --- a/sys/vm/vm_map.h > > > +++ b/sys/vm/vm_map.h > > > @@ -293,6 +293,7 @@ struct vmspace { > > > caddr_t vm_taddr; /* (c) user virtual address of text */ > > > caddr_t vm_daddr; /* (c) user virtual address of data */ > > > caddr_t vm_maxsaddr; /* user VA at max stack growth */ > > > + vm_size_t vm_stkgap; /* stack gap size in bytes */ > > > u_int vm_refcnt; /* number of references */ > > > /* > > > * Keep the PMAP last, so that CPU-specific variations of that > > > > > > > Is it possible to have a __FreeBSD_version bump for ports? > > > > There was a bump for linuxkpi you should use for this. It was a day or so > after the stackgap change. That's the one I intend to use. I used the prior one at the time but will update the patch to use this one instead. Probably today sometime. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Mon Oct 18 13:18:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AD5B17F0F84; Mon, 18 Oct 2021 13:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXyBR2wYbz4kR2; Mon, 18 Oct 2021 13:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 459E72140C; Mon, 18 Oct 2021 13:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IDItZM000183; Mon, 18 Oct 2021 13:18:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IDItLQ000182; Mon, 18 Oct 2021 13:18:55 GMT (envelope-from git) Date: Mon, 18 Oct 2021 13:18:55 GMT Message-Id: <202110181318.19IDItLQ000182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 35f1d655819e - stable/12 - geom_label: Fix the stable/12 build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 35f1d655819e5d4d11ea1a11061f80e48e35f173 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=35f1d655819e5d4d11ea1a11061f80e48e35f173 commit 35f1d655819e5d4d11ea1a11061f80e48e35f173 Author: Mark Johnston AuthorDate: 2021-10-18 13:16:47 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:16:47 +0000 geom_label: Fix the stable/12 build MAXPHYS is a constant here, use the right name. This is a direct commit to stable/12. Fixes: 116a988f99cd ("geom_label: Add more validation for NTFS volume tasting") Reported by: Jenkins --- sys/geom/label/g_label_ntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/label/g_label_ntfs.c b/sys/geom/label/g_label_ntfs.c index bcf6a3a72b36..dad55f601e16 100644 --- a/sys/geom/label/g_label_ntfs.c +++ b/sys/geom/label/g_label_ntfs.c @@ -120,7 +120,7 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) mftrecsz = bf->bf_mftrecsz; recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); - if (recsize <= 0 || recsize > maxphys || recsize % pp->sectorsize != 0) + if (recsize <= 0 || recsize > MAXPHYS || recsize % pp->sectorsize != 0) goto done; voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps + From nobody Mon Oct 18 13:32:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D9B9717F7396; Mon, 18 Oct 2021 13:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXyVN5h6zz4p0v; Mon, 18 Oct 2021 13:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3BE6213EB; Mon, 18 Oct 2021 13:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IDWiIY026218; Mon, 18 Oct 2021 13:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IDWiRF026217; Mon, 18 Oct 2021 13:32:44 GMT (envelope-from git) Date: Mon, 18 Oct 2021 13:32:44 GMT Message-Id: <202110181332.19IDWiRF026217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 6deacc1b3b7a - main - stress2: Move test added by mistake Reported by: markj List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6deacc1b3b7a11eee90815d51fb046f019ecfa6a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=6deacc1b3b7a11eee90815d51fb046f019ecfa6a commit 6deacc1b3b7a11eee90815d51fb046f019ecfa6a Author: Peter Holm AuthorDate: 2021-10-18 13:30:42 +0000 Commit: Peter Holm CommitDate: 2021-10-18 13:30:42 +0000 stress2: Move test added by mistake Reported by: markj --- syzkaller45.sh => tools/test/stress2/misc/syzkaller45.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/syzkaller45.sh b/tools/test/stress2/misc/syzkaller45.sh similarity index 100% rename from syzkaller45.sh rename to tools/test/stress2/misc/syzkaller45.sh From nobody Mon Oct 18 14:08:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2C79618042BB; Mon, 18 Oct 2021 14:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHG0f8Kz3C0n; Mon, 18 Oct 2021 14:08:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5B1421AF3; Mon, 18 Oct 2021 14:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE89ip066376; Mon, 18 Oct 2021 14:08:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE89dK066375; Mon, 18 Oct 2021 14:08:09 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:09 GMT Message-Id: <202110181408.19IE89dK066375@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: b0423d0f5eec - main - amd64: Zero the PML5 PTI page when initializing a pmap List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0423d0f5eec89bd6c11c32649603031e3dbbfe1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b0423d0f5eec89bd6c11c32649603031e3dbbfe1 commit b0423d0f5eec89bd6c11c32649603031e3dbbfe1 Author: Mark Johnston AuthorDate: 2021-10-18 13:29:20 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:50:42 +0000 amd64: Zero the PML5 PTI page when initializing a pmap The root page is not zeroed at allocation time since with 4-level tables each entry is copied from a template. However, with 5-level tables only a single entry is filled, so the rest need to be cleared. Reported by: alc Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32525 --- sys/amd64/amd64/pmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f1ddbe548c0f..168c9eec1b66 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4293,6 +4293,7 @@ pmap_pinit_pml5_pti(vm_page_t pml5pgu) pml5_entry_t *pm_pml5u; pm_pml5u = (pml5_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pml5pgu)); + pagezero(pm_pml5u); /* * Add pml5 entry at top of KVA pointing to existing pml4 pti From nobody Mon Oct 18 14:08:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A1991180442F; Mon, 18 Oct 2021 14:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHH1Pnvz3CD3; Mon, 18 Oct 2021 14:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FD1C21D45; Mon, 18 Oct 2021 14:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8AR1066400; Mon, 18 Oct 2021 14:08:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8AK1066399; Mon, 18 Oct 2021 14:08:10 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:10 GMT Message-Id: <202110181408.19IE8AK1066399@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: 36e4dcf47d45 - main - safexcel: Set the context record unconditionally List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36e4dcf47d45bbb87875ee4a9f5cc26a72a9f048 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36e4dcf47d45bbb87875ee4a9f5cc26a72a9f048 commit 36e4dcf47d45bbb87875ee4a9f5cc26a72a9f048 Author: Mark Johnston AuthorDate: 2021-10-18 13:40:47 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:50:42 +0000 safexcel: Set the context record unconditionally The condition added in commit 5bdb8b273aaf excludes plain SHA transforms, so for such sessions crypto operations would return incorrect results. Fixes: 5bdb8b273aaf ("safexcel: Maintain per-session context records") MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/safexcel/safexcel.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index b844a167b078..36bd65642403 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2520,15 +2520,12 @@ safexcel_newsession(device_t dev, crypto_session_t cses, if (csp->csp_auth_mlen != 0) sess->digestlen = csp->csp_auth_mlen; - if ((csp->csp_cipher_alg == 0 || csp->csp_cipher_key != NULL) && - (csp->csp_auth_alg == 0 || csp->csp_auth_key != NULL)) { - sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, - CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, - CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - } + sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, + CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); + sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, + CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); return (0); } From nobody Mon Oct 18 14:08:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D67E21804275; Mon, 18 Oct 2021 14:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHJ2v87z3C89; Mon, 18 Oct 2021 14:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D31421D46; Mon, 18 Oct 2021 14:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8CWO066424; Mon, 18 Oct 2021 14:08:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8CSq066423; Mon, 18 Oct 2021 14:08:12 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:12 GMT Message-Id: <202110181408.19IE8CSq066423@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: 51425cb2107c - main - bitset: Reimplement BIT_FOREACH_IS(SET|CLR) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51425cb2107c07ff379639edfbad65c77b55c3b8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=51425cb2107c07ff379639edfbad65c77b55c3b8 commit 51425cb2107c07ff379639edfbad65c77b55c3b8 Author: Mark Johnston AuthorDate: 2021-10-16 13:38:26 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:58 +0000 bitset: Reimplement BIT_FOREACH_IS(SET|CLR) Eliminate the nested loops and re-implement following a suggestion from rlibby. Add some simple regression tests. Reviewed by: rlibby, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32472 --- share/man/man9/bitset.9 | 4 +++ sys/sys/bitset.h | 31 ++++++++++++---- tests/sys/sys/Makefile | 7 +++- tests/sys/sys/bitset_test.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 7 deletions(-) diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index 5788f09f2465..1a5ec05b01c6 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -357,6 +357,10 @@ Similarly, .Fn BIT_FOREACH_ISCLR iterates over all clear bits in .Fa bitset . +In the loop body, the currently indexed bit may be set or cleared. +However, setting or clearing bits other than the currently indexed +bit does not guarantee that they will or will not be returned in +subsequent iterations of the same loop. .Pp The .Fn BIT_COUNT diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index ab6eaf85b8df..1c154d5601ab 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -271,12 +271,31 @@ __count; \ }) -/* Non-destructively loop over all set or clear bits in the set. */ -#define _BIT_FOREACH(_s, i, p, op) \ - for (__size_t __i = 0; __i < __bitset_words(_s); __i++) \ - for (long __j = op((p)->__bits[__i]), __b = ffsl(__j); \ - (i = (__b - 1) + __i * _BITSET_BITS), __j != 0; \ - __j &= ~(1l << i), __b = ffsl(__j)) +#define _BIT_FOREACH_ADVANCE(_s, i, p, op) __extension__ ({ \ + int __found; \ + for (;;) { \ + if (__bits != 0) { \ + int __bit = ffsl(__bits) - 1; \ + __bits &= ~(1ul << __bit); \ + (i) = __i * _BITSET_BITS + __bit; \ + __found = 1; \ + break; \ + } \ + if (++__i == __bitset_words(_s)) { \ + __found = 0; \ + break; \ + } \ + __bits = op((p)->__bits[__i]); \ + } \ + __found != 0; \ +}) + +/* + * Non-destructively loop over all set or clear bits in the set. + */ +#define _BIT_FOREACH(_s, i, p, op) \ + for (long __i = -1, __bits = 0; \ + _BIT_FOREACH_ADVANCE(_s, i, p, op); ) #define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) #define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) diff --git a/tests/sys/sys/Makefile b/tests/sys/sys/Makefile index 95739c127632..f6c45971d93c 100644 --- a/tests/sys/sys/Makefile +++ b/tests/sys/sys/Makefile @@ -4,7 +4,12 @@ TESTSDIR= ${TESTSBASE}/sys/sys -ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test +ATF_TESTS_C= arb_test \ + bitset_test \ + bitstring_test \ + qmath_test \ + rb_test \ + splay_test .if ${COMPILER_TYPE} == "gcc" CFLAGS.bitstring_test= -fno-strict-overflow diff --git a/tests/sys/sys/bitset_test.c b/tests/sys/sys/bitset_test.c new file mode 100644 index 000000000000..781b523dae97 --- /dev/null +++ b/tests/sys/sys/bitset_test.c @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software was developed by Mark Johnston under sponsorship from + * the FreeBSD Foundation. + */ + +#include +#include +#include +#include +#include + +#include + +BITSET_DEFINE(bs256, 256); + +ATF_TC_WITHOUT_HEAD(bit_foreach); +ATF_TC_BODY(bit_foreach, tc) +{ + struct bs256 bs0, bs1, bsrand; + int setc, clrc, i; + +#define _BIT_FOREACH_COUNT(s, bs) do { \ + int prev = -1; \ + setc = clrc = 0; \ + BIT_FOREACH_ISSET((s), i, (bs)) { \ + ATF_REQUIRE_MSG(prev < i, "incorrect bit ordering"); \ + ATF_REQUIRE_MSG(BIT_ISSET((s), i, (bs)), \ + "bit %d is not set", i); \ + setc++; \ + prev = i; \ + } \ + prev = -1; \ + BIT_FOREACH_ISCLR((s), i, (bs)) { \ + ATF_REQUIRE_MSG(prev < i, "incorrect bit ordering"); \ + ATF_REQUIRE_MSG(!BIT_ISSET((s), i, (bs)), \ + "bit %d is set", i); \ + clrc++; \ + prev = i; \ + } \ +} while (0) + + /* + * Create several bitsets, and for each one count the number + * of set and clear bits and make sure they match what we expect. + */ + + BIT_FILL(256, &bs1); + _BIT_FOREACH_COUNT(256, &bs1); + ATF_REQUIRE_MSG(setc == 256, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 0, "incorrect clear count %d", clrc); + + BIT_ZERO(256, &bs0); + _BIT_FOREACH_COUNT(256, &bs0); + ATF_REQUIRE_MSG(setc == 0, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 256, "incorrect clear count %d", clrc); + + BIT_ZERO(256, &bsrand); + for (i = 0; i < 256; i++) + if (random() % 2 != 0) + BIT_SET(256, i, &bsrand); + _BIT_FOREACH_COUNT(256, &bsrand); + ATF_REQUIRE_MSG(setc + clrc == 256, "incorrect counts %d, %d", + setc, clrc); + + /* + * Try to verify that we can safely clear bits in the set while + * iterating. + */ + BIT_FOREACH_ISSET(256, i, &bsrand) { + ATF_REQUIRE(setc-- > 0); + BIT_CLR(256, i, &bsrand); + } + _BIT_FOREACH_COUNT(256, &bsrand); + ATF_REQUIRE_MSG(setc == 0, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 256, "incorrect clear count %d", clrc); + +#undef _BIT_FOREACH_COUNT +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, bit_foreach); + return (atf_no_error()); +} From nobody Mon Oct 18 14:08:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8135D18043D0; Mon, 18 Oct 2021 14:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHK4bxBz3C8L; Mon, 18 Oct 2021 14:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5655721E88; Mon, 18 Oct 2021 14:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8DSk066448; Mon, 18 Oct 2021 14:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8Deb066447; Mon, 18 Oct 2021 14:08:13 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:13 GMT Message-Id: <202110181408.19IE8Deb066447@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: de8554295b47 - main - cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de8554295b47475e758a573ab7418265f21fee7e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=de8554295b47475e758a573ab7418265f21fee7e commit de8554295b47475e758a573ab7418265f21fee7e Author: Mark Johnston AuthorDate: 2021-09-21 15:36:55 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:58 +0000 cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it This implementation is faster and doesn't modify the cpuset, so it lets us avoid some unnecessary copying as well. No functional change intended. This is a re-application of commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e. Reviewed by: cem, kib, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32029 --- sys/amd64/amd64/mp_machdep.c | 11 +++-------- sys/amd64/vmm/io/vlapic.c | 13 +++---------- sys/amd64/vmm/vmm_lapic.c | 4 +--- sys/i386/i386/mp_machdep.c | 4 +--- sys/sys/cpuset.h | 2 ++ sys/x86/x86/mp_x86.c | 4 +--- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 6c66bd622855..16ec277e9c34 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus, mask1; + cpuset_t other_cpus; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,10 +662,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - mask1 = mask; - while ((cpu = CPU_FFS(&mask1)) != 0) { - cpu--; - CPU_CLR(cpu, &mask1); + CPU_FOREACH_ISSET(cpu, &mask) { KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -686,9 +683,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 06df1c1a87e5..4e7ddbafd447 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,10 +860,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - while ((vcpuid = CPU_FFS(&amask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &amask); - + CPU_FOREACH_ISSET(vcpuid, &amask) { vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1003,9 +1000,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - while ((i = CPU_FFS(&dmask)) != 0) { - i--; - CPU_CLR(i, &dmask); + CPU_FOREACH_ISSET(i, &dmask) { if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1554,9 +1549,7 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - while ((vcpuid = CPU_FFS(&dmask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &dmask); + CPU_FOREACH_ISSET(vcpuid, &dmask) { if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 89a1ebc8eff9..8191da758100 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,9 +87,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - while ((cpu = CPU_FFS(&dmask)) != 0) { - cpu--; - CPU_CLR(cpu, &dmask); + CPU_FOREACH_ISSET(cpu, &dmask) { vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 156702118c45..777aefa021b3 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,9 +598,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 1a96bb4766ce..9ef1a65f4506 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,6 +66,8 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) +#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) +#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 54ca82a2c90d..ca1125886619 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1346,9 +1346,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - while ((cpu = CPU_FFS(&cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &cpus); + CPU_FOREACH_ISSET(cpu, &cpus) { CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From nobody Mon Oct 18 14:08:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6109018042E6; Mon, 18 Oct 2021 14:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHL6KDtz3C13; Mon, 18 Oct 2021 14:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75F0621AF4; Mon, 18 Oct 2021 14:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8Ep2066478; Mon, 18 Oct 2021 14:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8EQq066477; Mon, 18 Oct 2021 14:08:14 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:14 GMT Message-Id: <202110181408.19IE8EQq066477@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: 81f2e9063d64 - main - signal: Add SIG_FOREACH and refactor issignal() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81f2e9063d64cc976b47e7ee1e9c35692cda7cb4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81f2e9063d64cc976b47e7ee1e9c35692cda7cb4 commit 81f2e9063d64cc976b47e7ee1e9c35692cda7cb4 Author: Mark Johnston AuthorDate: 2021-10-16 13:44:40 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:58 +0000 signal: Add SIG_FOREACH and refactor issignal() Add a SIG_FOREACH macro that can be used to iterate over a signal set. This is a bit cleaner and more efficient than calling sig_ffs() in a loop. The implementation is based on BIT_FOREACH_ISSET(), except that the bitset limbs are always 32 bits wide, and signal sets are 1-indexed rather than 0-indexed like bitset(9) sets. issignal() cannot really be modified to use SIG_FOREACH() directly. Take this opportunity to split the function into two explicit loops. I've always found this function hard to read and think that this change is an improvement. Remove sig_ffs(), nothing uses it now. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32473 --- sys/kern/kern_sig.c | 386 +++++++++++++++++++++++++++++----------------------- sys/sys/signalvar.h | 1 - 2 files changed, 217 insertions(+), 170 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index b7155074aa5a..d6826e8dc507 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -249,6 +249,29 @@ static int sigproptbl[NSIG] = { [SIGUSR2] = SIGPROP_KILL, }; +#define _SIG_FOREACH_ADVANCE(i, set) ({ \ + int __found; \ + for (;;) { \ + if (__bits != 0) { \ + int __sig = ffs(__bits); \ + __bits &= ~(1u << (__sig - 1)); \ + sig = __i * sizeof((set)->__bits[0]) * NBBY + __sig; \ + __found = 1; \ + break; \ + } \ + if (++__i == _SIG_WORDS) { \ + __found = 0; \ + break; \ + } \ + __bits = (set)->__bits[__i]; \ + } \ + __found != 0; \ +}) + +#define SIG_FOREACH(i, set) \ + for (int32_t __i = -1, __bits = 0; \ + _SIG_FOREACH_ADVANCE(i, set); ) \ + sigset_t fastblock_mask; static void @@ -660,17 +683,6 @@ sigprop(int sig) return (0); } -int -sig_ffs(sigset_t *set) -{ - int i; - - for (i = 0; i < _SIG_WORDS; i++) - if (set->__bits[i]) - return (ffs(set->__bits[i]) + (i * 32)); - return (0); -} - static bool sigact_flag_test(const struct sigaction *act, int flag) { @@ -2761,8 +2773,7 @@ reschedule_signals(struct proc *p, sigset_t block, int flags) return; SIGSETAND(block, p->p_siglist); fastblk = (flags & SIGPROCMASK_FASTBLK) != 0; - while ((sig = sig_ffs(&block)) != 0) { - SIGDELSET(block, sig); + SIG_FOREACH(sig, &block) { td = sigtd(p, sig, fastblk); /* @@ -2894,13 +2905,188 @@ sigallowstop_impl(int prev) } } +enum sigstatus { + SIGSTATUS_HANDLE, + SIGSTATUS_HANDLED, + SIGSTATUS_IGNORE, + SIGSTATUS_SBDRY_STOP, +}; + +/* + * The thread has signal "sig" pending. Figure out what to do with it: + * + * _HANDLE -> the caller should handle the signal + * _HANDLED -> handled internally, reload pending signal set + * _IGNORE -> ignored, remove from the set of pending signals and try the + * next pending signal + * _SBDRY_STOP -> the signal should stop the thread but this is not + * permitted in the current context + */ +static enum sigstatus +sigprocess(struct thread *td, int sig) +{ + struct proc *p; + struct sigacts *ps; + struct sigqueue *queue; + ksiginfo_t ksi; + int prop; + + KASSERT(_SIG_VALID(sig), ("%s: invalid signal %d", __func__, sig)); + + p = td->td_proc; + ps = p->p_sigacts; + mtx_assert(&ps->ps_mtx, MA_OWNED); + PROC_LOCK_ASSERT(p, MA_OWNED); + + /* + * We should allow pending but ignored signals below + * only if there is sigwait() active, or P_TRACED was + * on when they were posted. + */ + if (SIGISMEMBER(ps->ps_sigignore, sig) && + (p->p_flag & P_TRACED) == 0 && + (td->td_flags & TDF_SIGWAIT) == 0) { + return (SIGSTATUS_IGNORE); + } + + if ((p->p_flag & (P_TRACED | P_PPTRACE)) == P_TRACED) { + /* + * If traced, always stop. + * Remove old signal from queue before the stop. + * XXX shrug off debugger, it causes siginfo to + * be thrown away. + */ + queue = &td->td_sigqueue; + ksiginfo_init(&ksi); + if (sigqueue_get(queue, sig, &ksi) == 0) { + queue = &p->p_sigqueue; + sigqueue_get(queue, sig, &ksi); + } + td->td_si = ksi.ksi_info; + + mtx_unlock(&ps->ps_mtx); + sig = ptracestop(td, sig, &ksi); + mtx_lock(&ps->ps_mtx); + + td->td_si.si_signo = 0; + + /* + * Keep looking if the debugger discarded or + * replaced the signal. + */ + if (sig == 0) + return (SIGSTATUS_HANDLED); + + /* + * If the signal became masked, re-queue it. + */ + if (SIGISMEMBER(td->td_sigmask, sig)) { + ksi.ksi_flags |= KSI_HEAD; + sigqueue_add(&p->p_sigqueue, sig, &ksi); + return (SIGSTATUS_HANDLED); + } + + /* + * If the traced bit got turned off, requeue the signal and + * reload the set of pending signals. This ensures that p_sig* + * and p_sigact are consistent. + */ + if ((p->p_flag & P_TRACED) == 0) { + ksi.ksi_flags |= KSI_HEAD; + sigqueue_add(queue, sig, &ksi); + return (SIGSTATUS_HANDLED); + } + } + + /* + * Decide whether the signal should be returned. + * Return the signal's number, or fall through + * to clear it from the pending mask. + */ + switch ((intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)]) { + case (intptr_t)SIG_DFL: + /* + * Don't take default actions on system processes. + */ + if (p->p_pid <= 1) { +#ifdef DIAGNOSTIC + /* + * Are you sure you want to ignore SIGSEGV + * in init? XXX + */ + printf("Process (pid %lu) got signal %d\n", + (u_long)p->p_pid, sig); +#endif + return (SIGSTATUS_IGNORE); + } + + /* + * If there is a pending stop signal to process with + * default action, stop here, then clear the signal. + * Traced or exiting processes should ignore stops. + * Additionally, a member of an orphaned process group + * should ignore tty stops. + */ + prop = sigprop(sig); + if (prop & SIGPROP_STOP) { + mtx_unlock(&ps->ps_mtx); + if ((p->p_flag & (P_TRACED | P_WEXIT | + P_SINGLE_EXIT)) != 0 || ((p->p_pgrp-> + pg_flags & PGRP_ORPHANED) != 0 && + (prop & SIGPROP_TTYSTOP) != 0)) { + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_IGNORE); + } + if (TD_SBDRY_INTR(td)) { + KASSERT((td->td_flags & TDF_SBDRY) != 0, + ("lost TDF_SBDRY")); + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_SBDRY_STOP); + } + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, + &p->p_mtx.lock_object, "Catching SIGSTOP"); + sigqueue_delete(&td->td_sigqueue, sig); + sigqueue_delete(&p->p_sigqueue, sig); + p->p_flag |= P_STOPPED_SIG; + p->p_xsig = sig; + PROC_SLOCK(p); + sig_suspend_threads(td, p, 0); + thread_suspend_switch(td, p); + PROC_SUNLOCK(p); + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_HANDLED); + } else if ((prop & SIGPROP_IGNORE) != 0 && + (td->td_flags & TDF_SIGWAIT) == 0) { + /* + * Default action is to ignore; drop it if + * not in kern_sigtimedwait(). + */ + return (SIGSTATUS_IGNORE); + } else { + return (SIGSTATUS_HANDLE); + } + + case (intptr_t)SIG_IGN: + if ((td->td_flags & TDF_SIGWAIT) == 0) + return (SIGSTATUS_IGNORE); + else + return (SIGSTATUS_HANDLE); + + default: + /* + * This signal has an action, let postsig() process it. + */ + return (SIGSTATUS_HANDLE); + } +} + /* * If the current process has received a signal (should be caught or cause * termination, should interrupt current syscall), return the signal number. * Stop signals with default action are processed immediately, then cleared; * they aren't returned. This is checked after each entry to the system for - * a syscall or trap (though this can usually be done without calling issignal - * by checking the pending signal masks in cursig.) The normal call + * a syscall or trap (though this can usually be done without calling + * issignal by checking the pending signal masks in cursig.) The normal call * sequence is * * while (sig = cursig(curthread)) @@ -2910,16 +3096,12 @@ static int issignal(struct thread *td) { struct proc *p; - struct sigacts *ps; - struct sigqueue *queue; sigset_t sigpending; - ksiginfo_t ksi; - int prop, sig; + int sig; p = td->td_proc; - ps = p->p_sigacts; - mtx_assert(&ps->ps_mtx, MA_OWNED); PROC_LOCK_ASSERT(p, MA_OWNED); + for (;;) { sigpending = td->td_sigqueue.sq_signals; SIGSETOR(sigpending, p->p_sigqueue.sq_signals); @@ -2957,160 +3139,27 @@ issignal(struct thread *td) * execute the debugger attach ritual in * order. */ - sig = SIGSTOP; td->td_dbgflags |= TDB_FSTP; - } else { - sig = sig_ffs(&sigpending); + SIGEMPTYSET(sigpending); + SIGADDSET(sigpending, SIGSTOP); } - /* - * We should allow pending but ignored signals below - * only if there is sigwait() active, or P_TRACED was - * on when they were posted. - */ - if (SIGISMEMBER(ps->ps_sigignore, sig) && - (p->p_flag & P_TRACED) == 0 && - (td->td_flags & TDF_SIGWAIT) == 0) { - sigqueue_delete(&td->td_sigqueue, sig); - sigqueue_delete(&p->p_sigqueue, sig); - continue; - } - if ((p->p_flag & (P_TRACED | P_PPTRACE)) == P_TRACED) { - /* - * If traced, always stop. - * Remove old signal from queue before the stop. - * XXX shrug off debugger, it causes siginfo to - * be thrown away. - */ - queue = &td->td_sigqueue; - ksiginfo_init(&ksi); - if (sigqueue_get(queue, sig, &ksi) == 0) { - queue = &p->p_sigqueue; - sigqueue_get(queue, sig, &ksi); - } - td->td_si = ksi.ksi_info; - - mtx_unlock(&ps->ps_mtx); - sig = ptracestop(td, sig, &ksi); - mtx_lock(&ps->ps_mtx); - - td->td_si.si_signo = 0; - - /* - * Keep looking if the debugger discarded or - * replaced the signal. - */ - if (sig == 0) - continue; - - /* - * If the signal became masked, re-queue it. - */ - if (SIGISMEMBER(td->td_sigmask, sig)) { - ksi.ksi_flags |= KSI_HEAD; - sigqueue_add(&p->p_sigqueue, sig, &ksi); - continue; - } - - /* - * If the traced bit got turned off, requeue - * the signal and go back up to the top to - * rescan signals. This ensures that p_sig* - * and p_sigact are consistent. - */ - if ((p->p_flag & P_TRACED) == 0) { - ksi.ksi_flags |= KSI_HEAD; - sigqueue_add(queue, sig, &ksi); - continue; - } - } - - prop = sigprop(sig); - - /* - * Decide whether the signal should be returned. - * Return the signal's number, or fall through - * to clear it from the pending mask. - */ - switch ((intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)]) { - case (intptr_t)SIG_DFL: - /* - * Don't take default actions on system processes. - */ - if (p->p_pid <= 1) { -#ifdef DIAGNOSTIC - /* - * Are you sure you want to ignore SIGSEGV - * in init? XXX - */ - printf("Process (pid %lu) got signal %d\n", - (u_long)p->p_pid, sig); -#endif - break; /* == ignore */ - } - /* - * If there is a pending stop signal to process with - * default action, stop here, then clear the signal. - * Traced or exiting processes should ignore stops. - * Additionally, a member of an orphaned process group - * should ignore tty stops. - */ - if (prop & SIGPROP_STOP) { - mtx_unlock(&ps->ps_mtx); - if ((p->p_flag & (P_TRACED | P_WEXIT | - P_SINGLE_EXIT)) != 0 || ((p->p_pgrp-> - pg_flags & PGRP_ORPHANED) != 0 && - (prop & SIGPROP_TTYSTOP) != 0)) { - mtx_lock(&ps->ps_mtx); - break; /* == ignore */ - } - if (TD_SBDRY_INTR(td)) { - KASSERT((td->td_flags & TDF_SBDRY) != 0, - ("lost TDF_SBDRY")); - mtx_lock(&ps->ps_mtx); - return (-1); - } - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, - &p->p_mtx.lock_object, "Catching SIGSTOP"); + SIG_FOREACH(sig, &sigpending) { + switch (sigprocess(td, sig)) { + case SIGSTATUS_HANDLE: + return (sig); + case SIGSTATUS_HANDLED: + goto next; + case SIGSTATUS_IGNORE: sigqueue_delete(&td->td_sigqueue, sig); sigqueue_delete(&p->p_sigqueue, sig); - p->p_flag |= P_STOPPED_SIG; - p->p_xsig = sig; - PROC_SLOCK(p); - sig_suspend_threads(td, p, 0); - thread_suspend_switch(td, p); - PROC_SUNLOCK(p); - mtx_lock(&ps->ps_mtx); - goto next; - } else if ((prop & SIGPROP_IGNORE) != 0 && - (td->td_flags & TDF_SIGWAIT) == 0) { - /* - * Default action is to ignore; drop it if - * not in kern_sigtimedwait(). - */ - break; /* == ignore */ - } else - return (sig); - /*NOTREACHED*/ - - case (intptr_t)SIG_IGN: - if ((td->td_flags & TDF_SIGWAIT) == 0) - break; /* == ignore */ - else - return (sig); - - default: - /* - * This signal has an action, let - * postsig() process it. - */ - return (sig); + break; + case SIGSTATUS_SBDRY_STOP: + return (-1); + } } - sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ - sigqueue_delete(&p->p_sigqueue, sig); next:; } - /* NOTREACHED */ } void @@ -4119,8 +4168,7 @@ sig_drop_caught(struct proc *p) ps = p->p_sigacts; PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&ps->ps_mtx, MA_OWNED); - while (SIGNOTEMPTY(ps->ps_sigcatch)) { - sig = sig_ffs(&ps->ps_sigcatch); + SIG_FOREACH(sig, &ps->ps_sigcatch) { sigdflt(ps, sig); if ((sigprop(sig) & SIGPROP_IGNORE) != 0) sigqueue_delete_proc(p, sig); diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index a7fe174b40bf..4e86f54856f6 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -404,7 +404,6 @@ int sig_ast_needsigchk(struct thread *td); void sig_drop_caught(struct proc *p); void sigexit(struct thread *td, int sig) __dead2; int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **); -int sig_ffs(sigset_t *set); void sigfastblock_clear(struct thread *td); void sigfastblock_fetch(struct thread *td); void sigfastblock_setpend(struct thread *td, bool resched); From nobody Mon Oct 18 14:08:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 704E918044DA; Mon, 18 Oct 2021 14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHN2frrz3CDm; Mon, 18 Oct 2021 14:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A5E21AF5; Mon, 18 Oct 2021 14:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8F2d066503; Mon, 18 Oct 2021 14:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8F9q066502; Mon, 18 Oct 2021 14:08:15 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:15 GMT Message-Id: <202110181408.19IE8F9q066502@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: 06ebadc5f555 - main - x86: Remove some leftover APM support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06ebadc5f555fd7fa6f869af1e5daf834b1bb04e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=06ebadc5f555fd7fa6f869af1e5daf834b1bb04e commit 06ebadc5f555fd7fa6f869af1e5daf834b1bb04e Author: Mark Johnston AuthorDate: 2021-10-16 13:46:43 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:59 +0000 x86: Remove some leftover APM support This is obsolete since commit 8c576a279ed5 ("Remove APM BIOS support"). Reviewed by: imp, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32510 --- sys/x86/x86/tsc.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 15e6037c68ee..a6c7ec7a8307 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -585,23 +584,6 @@ init_TSC_tc(void) */ max_freq = UINT_MAX; - /* - * We can not use the TSC if we support APM. Precise timekeeping - * on an APM'ed machine is at best a fools pursuit, since - * any and all of the time spent in various SMM code can't - * be reliably accounted for. Reading the RTC is your only - * source of reliable time info. The i8254 loses too, of course, - * but we need to have some kind of time... - * We don't know at this point whether APM is going to be used - * or not, nor when it might be activated. Play it safe. - */ - if (power_pm_get_type() == POWER_PM_TYPE_APM) { - tsc_timecounter.tc_quality = -1000; - if (bootverbose) - printf("TSC timecounter disabled: APM enabled.\n"); - goto init; - } - /* * Intel CPUs without a C-state invariant TSC can stop the TSC * in either C2 or C3. Disable use of C2 and C3 while using @@ -637,7 +619,6 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = 1000; max_freq >>= tsc_shift; -init: for (shift = 0; shift <= 31 && (tsc_freq >> shift) > max_freq; shift++) ; From nobody Mon Oct 18 14:08:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C95041804539; Mon, 18 Oct 2021 14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHP2vMnz3CDq; Mon, 18 Oct 2021 14:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCFA521CC8; Mon, 18 Oct 2021 14:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8GwB066527; Mon, 18 Oct 2021 14:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8G8T066526; Mon, 18 Oct 2021 14:08:16 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:16 GMT Message-Id: <202110181408.19IE8G8T066526@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: 621fd9dcb2d8 - main - timecounter: Lock the timecounter list List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 621fd9dcb2d83daab477c130bc99b905f6fc27dc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=621fd9dcb2d83daab477c130bc99b905f6fc27dc commit 621fd9dcb2d83daab477c130bc99b905f6fc27dc Author: Mark Johnston AuthorDate: 2021-10-16 13:46:55 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:59 +0000 timecounter: Lock the timecounter list Timecounter registration is dynamic, i.e., there is no requirement that timecounters must be registered during single-threaded boot. Loadable drivers may in principle register timecounters (which can be switched to automatically). Timecounters cannot be unregistered, though this could be implemented. Registered timecounters belong to a global linked list. Add a mutex to synchronize insertions and the traversals done by (mpsafe) sysctl handlers. No functional change intended. Reviewed by: imp, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32511 --- sys/kern/kern_tc.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index be4142e19d77..9a928ca37aff 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -97,6 +97,10 @@ static struct timehands *volatile timehands = &ths[0]; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; +/* Mutex to protect the timecounter list. */ +static struct mtx tc_lock; +MTX_SYSINIT(tc_lock, &tc_lock, "tc", MTX_DEF); + int tc_min_ticktock_freq = 1; volatile time_t time_second = 1; @@ -1188,8 +1192,6 @@ tc_init(struct timecounter *tc) tc->tc_quality); } - tc->tc_next = timecounters; - timecounters = tc; /* * Set up sysctl tree for this counter. */ @@ -1211,6 +1213,11 @@ tc_init(struct timecounter *tc) SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(tc_root), OID_AUTO, "quality", CTLFLAG_RD, &(tc->tc_quality), 0, "goodness of time counter"); + + mtx_lock(&tc_lock); + tc->tc_next = timecounters; + timecounters = tc; + /* * Do not automatically switch if the current tc was specifically * chosen. Never automatically use a timecounter with negative quality. @@ -1218,22 +1225,24 @@ tc_init(struct timecounter *tc) * worse since this timecounter may not be monotonic. */ if (tc_chosen) - return; + goto unlock; if (tc->tc_quality < 0) - return; + goto unlock; if (tc_from_tunable[0] != '\0' && strcmp(tc->tc_name, tc_from_tunable) == 0) { tc_chosen = 1; tc_from_tunable[0] = '\0'; } else { if (tc->tc_quality < timecounter->tc_quality) - return; + goto unlock; if (tc->tc_quality == timecounter->tc_quality && tc->tc_frequency < timecounter->tc_frequency) - return; + goto unlock; } (void)tc->tc_get_timecount(tc); timecounter = tc; +unlock: + mtx_unlock(&tc_lock); } /* Report the frequency of the current timecounter. */ @@ -1479,16 +1488,22 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) struct timecounter *newtc, *tc; int error; + mtx_lock(&tc_lock); tc = timecounter; strlcpy(newname, tc->tc_name, sizeof(newname)); + mtx_unlock(&tc_lock); error = sysctl_handle_string(oidp, &newname[0], sizeof(newname), req); if (error != 0 || req->newptr == NULL) return (error); + + mtx_lock(&tc_lock); /* Record that the tc in use now was specifically chosen. */ tc_chosen = 1; - if (strcmp(newname, tc->tc_name) == 0) + if (strcmp(newname, tc->tc_name) == 0) { + mtx_unlock(&tc_lock); return (0); + } for (newtc = timecounters; newtc != NULL; newtc = newtc->tc_next) { if (strcmp(newname, newtc->tc_name) != 0) continue; @@ -1506,11 +1521,11 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) * use any locking and that it can be called in hard interrupt * context via 'tc_windup()'. */ - return (0); + break; } - return (EINVAL); + mtx_unlock(&tc_lock); + return (newtc != NULL ? 0 : EINVAL); } - SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_hardware, "A", @@ -1524,12 +1539,17 @@ sysctl_kern_timecounter_choice(SYSCTL_HANDLER_ARGS) struct timecounter *tc; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sb, NULL, 0, req); + mtx_lock(&tc_lock); for (tc = timecounters; tc != NULL; tc = tc->tc_next) { if (tc != timecounters) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s(%d)", tc->tc_name, tc->tc_quality); } + mtx_unlock(&tc_lock); error = sbuf_finish(&sb); sbuf_delete(&sb); return (error); From nobody Mon Oct 18 14:08:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99F1A180470D; Mon, 18 Oct 2021 14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzHQ1LLnz3CPQ; Mon, 18 Oct 2021 14:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D64F521F80; Mon, 18 Oct 2021 14:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IE8HUp066551; Mon, 18 Oct 2021 14:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IE8HIS066550; Mon, 18 Oct 2021 14:08:17 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:08:17 GMT Message-Id: <202110181408.19IE8HIS066550@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: 77bc75c7abd2 - main - bhyve: Fix the WITH_BHYVE_SNAPSHOT build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77bc75c7abd29de69d3ef35b66c23c7baba95094 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=77bc75c7abd29de69d3ef35b66c23c7baba95094 commit 77bc75c7abd29de69d3ef35b66c23c7baba95094 Author: Mark Johnston AuthorDate: 2021-10-16 17:13:26 +0000 Commit: Mark Johnston CommitDate: 2021-10-18 13:56:59 +0000 bhyve: Fix the WITH_BHYVE_SNAPSHOT build Note, this breaks compatibility with snapshots generated by older builds of bhyve(8). Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough") Reported by: Greg V Reviewed by: grehan, bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32523 --- usr.sbin/bhyve/pci_emul.c | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index fd18fdbdaeab..86a2f995126e 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -2079,7 +2079,6 @@ pci_snapshot_pci_dev(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_offset, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_size, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.function_mask, meta, ret, done); - SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_page_offset, meta, ret, done); SNAPSHOT_BUF_OR_LEAVE(pi->pi_cfgdata, sizeof(pi->pi_cfgdata), meta, ret, done); From nobody Mon Oct 18 14:17:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0FF52180A5A8 for ; Mon, 18 Oct 2021 14:18:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa36.google.com (mail-vk1-xa36.google.com [IPv6:2607:f8b0:4864:20::a36]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXzVn6bVwz3Jcf for ; Mon, 18 Oct 2021 14:18:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa36.google.com with SMTP id o42so8659815vkf.9 for ; Mon, 18 Oct 2021 07:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gyr9lZWmZ96MuJxr4ILM+Z/OtD+ZO7YgM4PwlUs5v/w=; b=ALcgnSm+8he/K6Ps+9iq9xAb4ssWuHk1UaDe6FmIA66hJMIk/MgDUU4IEcdMHULNKT tlg5ZUNTKFXGG48Z1ReLSrYRRNaZnbFHRqvGqdG8xzJFbFZNmvmQOQi7y22sjedIhU3m 6g0kV1ggue6JVc2RhxQ7VAroezy3bvPYhFzBFAvbAhY18HZ9GS64hIGUWyo0+uVXmHDZ D7sFg1siXFOM3KVupcX1HTAsKpy9ND2/B4InFRWtA14qo7ynQ7aROVfT2nIbnXaRNS44 0B0SsSVouD69IH9w9tsyCDWNJudpJg1GyfNLHbwF+3akIF8stL/AkBvGIcIevRck5nsN 0xxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gyr9lZWmZ96MuJxr4ILM+Z/OtD+ZO7YgM4PwlUs5v/w=; b=37U8u9Feqzc+rncBpsmCNi61hovWk/MrdRE2grF61lou9M9zQEEG9XCZseaXZRSHk2 XNOyMy2R3jOhSTxB28CzOmgBQ+Cxnl5QysmHlWXKQuHNELIEUVRiKTtnD7zy6qd7akXg 72gnFKfHttKZQXoc7clN7gRQOVGwb9E6saqcZD6tPc0LxZN7OcRHwHDg0+DGQcB4Sf/d jCHe/FuiFg1l/0PwjTupXXdUhxDmvBySvOZSqgimpyHKC2rMBKYgT3VQke3pzLorszbn z1w4TdyBRo7pU9f1rDD7qHYqW5PuBXlbEc/8VgjO0dBmPkDmnffb6mSao7WEpgc6PJRP ghng== X-Gm-Message-State: AOAM531UelRWH6us2MFqLKEFL75inmTP3sAsHhImnPheohCdJlGZC0ps jGZmCPz2x/yAfGpmtzN94q+ydpjeAPKeuwF7xaIkbQ== X-Google-Smtp-Source: ABdhPJxNX5H0sarq7Y9pFR7qwsE3JQyhtsNyGuW7LObPxkJqciisBpShc/kW33nO/Bv9XC1Wf3qcSPtu9ttDNw5vyOQ= X-Received: by 2002:a1f:264a:: with SMTP id m71mr24982713vkm.5.1634566688072; Mon, 18 Oct 2021 07:18:08 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110150823.19F8NEr9047194@gitrepo.freebsd.org> <202110161602.19GG2FYs004292@slippy.cwsent.com> <202110181310.19IDABYd005908@slippy.cwsent.com> In-Reply-To: <202110181310.19IDABYd005908@slippy.cwsent.com> From: Warner Losh Date: Mon, 18 Oct 2021 08:17:56 -0600 Message-ID: Subject: Re: git: 889b56c8cd84 - main - setrlimit: Take stack gap into account. To: Cy Schubert Cc: Marcin Wojtas , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000ce3ee805cea136fb" X-Rspamd-Queue-Id: 4HXzVn6bVwz3Jcf X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=ALcgnSm+; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::a36) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [0.09 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.09)[0.091]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::a36:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] X-ThisMailContainsUnwantedMimeParts: N --000000000000ce3ee805cea136fb Content-Type: text/plain; charset="UTF-8" On Mon, Oct 18, 2021 at 7:10 AM Cy Schubert wrote: > In message > om> > , Warner Losh writes: > > On Sat, Oct 16, 2021, 10:02 AM Cy Schubert > > wrote: > > > > > In message <202110150823.19F8NEr9047194@gitrepo.freebsd.org>, Marcin > > > Wojtas > > > wri > > > tes: > > > > The branch main has been updated by mw: > > > > > > > > URL: > > > > https://cgit.FreeBSD.org/src/commit/?id=889b56c8cd84c9a9f2d9e3b019c154d6 > > > > f14d9021 > > > > > > > > commit 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 > > > > Author: Dawid Gorecki > > > > AuthorDate: 2021-10-13 19:01:08 +0000 > > > > Commit: Marcin Wojtas > > > > CommitDate: 2021-10-15 08:21:47 +0000 > > > > > > > > setrlimit: Take stack gap into account. > > > > > > > > Calling setrlimit with stack gap enabled and with low values of > stack > > > > resource limit often caused the program to abort immediately > after > > > > exiting the syscall. This happened due to the fact that the > resource > > > > limit was calculated assuming that the stack started at > sv_usrstack, > > > > while with stack gap enabled the stack is moved by a random > number > > > > of bytes. > > > > > > > > Save information about stack size in struct vmspace and adjust > the > > > > rlim_cur value. If the rlim_cur and stack gap is bigger than > > > rlim_max, > > > > then the value is truncated to rlim_max. > > > > > > > > PR: 253208 > > > > Reviewed by: kib > > > > Obtained from: Semihalf > > > > Sponsored by: Stormshield > > > > MFC after: 1 month > > > > Differential Revision: https://reviews.freebsd.org/D31516 > > > > --- > > > > sys/kern/imgact_elf.c | 5 +++-- > > > > sys/kern/kern_exec.c | 11 ++++++++--- > > > > sys/kern/kern_resource.c | 3 +++ > > > > sys/sys/imgact_elf.h | 2 +- > > > > sys/sys/sysent.h | 2 +- > > > > sys/vm/vm_map.c | 2 ++ > > > > sys/vm/vm_map.h | 1 + > > > > 7 files changed, 19 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > > > index ef1edfcabaf0..898f0f66a532 100644 > > > > --- a/sys/kern/imgact_elf.c > > > > +++ b/sys/kern/imgact_elf.c > > > > @@ -2684,7 +2684,7 @@ __elfN(untrans_prot)(vm_prot_t prot) > > > > return (flags); > > > > } > > > > > > > > -void > > > > +vm_size_t > > > > __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base) > > > > { > > > > uintptr_t range, rbase, gap; > > > > @@ -2692,7 +2692,7 @@ __elfN(stackgap)(struct image_params *imgp, > > > uintptr_t * > > > > stack_base) > > > > > > > > pct = __elfN(aslr_stack_gap); > > > > if (pct == 0) > > > > - return; > > > > + return (0); > > > > if (pct > 50) > > > > pct = 50; > > > > range = imgp->eff_stack_sz * pct / 100; > > > > @@ -2700,4 +2700,5 @@ __elfN(stackgap)(struct image_params *imgp, > > > uintptr_t * > > > > stack_base) > > > > gap = rbase % range; > > > > gap &= ~(sizeof(u_long) - 1); > > > > *stack_base -= gap; > > > > + return (gap); > > > > } > > > > diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c > > > > index 50e75fda6cfb..9dceebdd8441 100644 > > > > --- a/sys/kern/kern_exec.c > > > > +++ b/sys/kern/kern_exec.c > > > > @@ -1148,6 +1148,7 @@ exec_new_vmspace(struct image_params *imgp, > struct > > > syse > > > > ntvec *sv) > > > > stack_prot, error, vm_mmap_to_errno(error)); > > > > return (vm_mmap_to_errno(error)); > > > > } > > > > + vmspace->vm_stkgap = 0; > > > > > > > > /* > > > > * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, > but > > > they > > > > @@ -1493,12 +1494,16 @@ exec_args_get_begin_envv(struct image_args > *args) > > > > void > > > > exec_stackgap(struct image_params *imgp, uintptr_t *dp) > > > > { > > > > + struct proc *p = imgp->proc; > > > > + > > > > if (imgp->sysent->sv_stackgap == NULL || > > > > - (imgp->proc->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > > + (p->p_fctl0 & (NT_FREEBSD_FCTL_ASLR_DISABLE | > > > > NT_FREEBSD_FCTL_ASG_DISABLE)) != 0 || > > > > - (imgp->map_flags & MAP_ASLR) == 0) > > > > + (imgp->map_flags & MAP_ASLR) == 0) { > > > > + p->p_vmspace->vm_stkgap = 0; > > > > return; > > > > - imgp->sysent->sv_stackgap(imgp, dp); > > > > + } > > > > + p->p_vmspace->vm_stkgap = imgp->sysent->sv_stackgap(imgp, dp); > > > > } > > > > > > > > /* > > > > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > > > > index 4c62961e1bc4..b556d4fded51 100644 > > > > --- a/sys/kern/kern_resource.c > > > > +++ b/sys/kern/kern_resource.c > > > > @@ -671,6 +671,9 @@ kern_proc_setrlimit(struct thread *td, struct > proc > > > *p, u_ > > > > int which, > > > > if (limp->rlim_max < 0) > > > > limp->rlim_max = RLIM_INFINITY; > > > > > > > > + if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY) > > > > + limp->rlim_cur += p->p_vmspace->vm_stkgap; > > > > + > > > > oldssiz.rlim_cur = 0; > > > > newlim = lim_alloc(); > > > > PROC_LOCK(p); > > > > diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h > > > > index 97383c6eeeb8..294f17c87b6f 100644 > > > > --- a/sys/sys/imgact_elf.h > > > > +++ b/sys/sys/imgact_elf.h > > > > @@ -118,7 +118,7 @@ int > __elfN(remove_brand_entry)(Elf_Brandinfo > > > *entry > > > > ); > > > > int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *); > > > > int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); > > > > size_t __elfN(populate_note)(int, void *, void *, size_t, void > > > **); > > > > -void __elfN(stackgap)(struct image_params *, uintptr_t *); > > > > +vm_size_t __elfN(stackgap)(struct image_params *, uintptr_t *); > > > > int __elfN(freebsd_copyout_auxargs)(struct image_params *, > uintptr_t); > > > > void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, > int); > > > > void __elfN(prepare_notes)(struct thread *, struct note_info_list *, > > > > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > > > > index ad50bf56e87d..ea96c87a79af 100644 > > > > --- a/sys/sys/sysent.h > > > > +++ b/sys/sys/sysent.h > > > > @@ -119,7 +119,7 @@ struct sysentvec { > > > > void (*sv_elf_core_prepare_notes)(struct thread *, > > > > struct note_info_list *, size_t *); > > > > int (*sv_imgact_try)(struct image_params *); > > > > - void (*sv_stackgap)(struct image_params *, > uintptr_t *); > > > > + vm_size_t (*sv_stackgap)(struct image_params *, > uintptr_t *); > > > > int (*sv_copyout_auxargs)(struct image_params *, > > > > uintptr_t); > > > > int sv_minsigstksz; /* minimum signal stack size */ > > > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c > > > > index 1ac4ccf72f11..87a290b998b9 100644 > > > > --- a/sys/vm/vm_map.c > > > > +++ b/sys/vm/vm_map.c > > > > @@ -343,6 +343,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, > > > pmap_pini > > > > t_t pinit) > > > > vm->vm_taddr = 0; > > > > vm->vm_daddr = 0; > > > > vm->vm_maxsaddr = 0; > > > > + vm->vm_stkgap = 0; > > > > return (vm); > > > > } > > > > > > > > @@ -4265,6 +4266,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t > > > *fork_ch > > > > arge) > > > > vm2->vm_taddr = vm1->vm_taddr; > > > > vm2->vm_daddr = vm1->vm_daddr; > > > > vm2->vm_maxsaddr = vm1->vm_maxsaddr; > > > > + vm2->vm_stkgap = vm1->vm_stkgap; > > > > vm_map_lock(old_map); > > > > if (old_map->busy) > > > > vm_map_wait_busy(old_map); > > > > diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h > > > > index ace205b21b42..873ff62eec4a 100644 > > > > --- a/sys/vm/vm_map.h > > > > +++ b/sys/vm/vm_map.h > > > > @@ -293,6 +293,7 @@ struct vmspace { > > > > caddr_t vm_taddr; /* (c) user virtual address of text */ > > > > caddr_t vm_daddr; /* (c) user virtual address of data */ > > > > caddr_t vm_maxsaddr; /* user VA at max stack growth */ > > > > + vm_size_t vm_stkgap; /* stack gap size in bytes */ > > > > u_int vm_refcnt; /* number of references */ > > > > /* > > > > * Keep the PMAP last, so that CPU-specific variations of that > > > > > > > > > > Is it possible to have a __FreeBSD_version bump for ports? > > > > > > > There was a bump for linuxkpi you should use for this. It was a day or so > > after the stackgap change. > > That's the one I intend to use. I used the prior one at the time but will > update the patch to use this one instead. Probably today sometime. > Might want to document it in the handbook as well. The 'doubling up' changes are harder to reconstruct later... Warner > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org > > The need of the many outweighs the greed of the few. > > > > --000000000000ce3ee805cea136fb-- From nobody Mon Oct 18 14:45:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD4EC17F507D; Mon, 18 Oct 2021 14:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY05q5Wkpz3QPq; Mon, 18 Oct 2021 14:45:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AF9F22718; Mon, 18 Oct 2021 14:45:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IEj3Xi019474; Mon, 18 Oct 2021 14:45:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IEj36g019473; Mon, 18 Oct 2021 14:45:03 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:45:03 GMT Message-Id: <202110181445.19IEj36g019473@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: 7881db834647 - main - Remove POWER_PM_TYPE_APM. It's now unused. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 7881db83464759ba783454d2d2eb1b970e352cd3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7881db83464759ba783454d2d2eb1b970e352cd3 commit 7881db83464759ba783454d2d2eb1b970e352cd3 Author: Warner Losh AuthorDate: 2021-10-18 14:41:17 +0000 Commit: Warner Losh CommitDate: 2021-10-18 14:41:17 +0000 Remove POWER_PM_TYPE_APM. It's now unused. Sponsored by: Netflix Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32549 --- sys/sys/power.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/sys/power.h b/sys/sys/power.h index 524bc3fabb24..b0535312d1f7 100644 --- a/sys/sys/power.h +++ b/sys/sys/power.h @@ -34,7 +34,6 @@ #include /* Power management system type */ -#define POWER_PM_TYPE_APM 0x00 #define POWER_PM_TYPE_ACPI 0x01 #define POWER_PM_TYPE_NONE 0xff From nobody Mon Oct 18 14:48:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4070017F8B40; Mon, 18 Oct 2021 14:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY09K1D9rz3jTw; Mon, 18 Oct 2021 14:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09F6D224E7; Mon, 18 Oct 2021 14:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IEm4p4019803; Mon, 18 Oct 2021 14:48:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IEm4XZ019802; Mon, 18 Oct 2021 14:48:04 GMT (envelope-from git) Date: Mon, 18 Oct 2021 14:48:04 GMT Message-Id: <202110181448.19IEm4XZ019802@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: 576b58108c17 - main - libssh: correct libssh src file list List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 576b58108c1723c85e4dd00355e29bfe301dab11 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=576b58108c1723c85e4dd00355e29bfe301dab11 commit 576b58108c1723c85e4dd00355e29bfe301dab11 Author: Ed Maste AuthorDate: 2021-10-15 16:21:23 +0000 Commit: Ed Maste CommitDate: 2021-10-18 14:47:20 +0000 libssh: correct libssh src file list Link against the ssh-sk-helper client rather than the sk internal implementation. PR: 258384 Tested by: madpilot Fixes: f448c3ed4ae1 ("openssh: Add new source files to libssl") Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32529 --- secure/lib/libssh/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index 95024efa192e..e835ef3c1b2a 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -5,7 +5,7 @@ LIB= ssh PRIVATELIB= true SHLIB_MAJOR= 5 -SRCS= ssh_api.c ssh-sk.c ssh-ecdsa-sk.c ssh-ed25519-sk.c ssherr.c \ +SRCS= ssh_api.c ssh-sk-client.c ssh-ecdsa-sk.c ssh-ed25519-sk.c ssherr.c \ sshbuf.c sshkey.c sshbuf-getput-basic.c \ sshbuf-misc.c sshbuf-getput-crypto.c krl.c bitmap.c SRCS+= authfd.c authfile.c \ From nobody Mon Oct 18 16:09:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E48BA17F06AD; Mon, 18 Oct 2021 16:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY1zK6BBVz4Yts; Mon, 18 Oct 2021 16:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE07236F2; Mon, 18 Oct 2021 16:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IG9XHx026768; Mon, 18 Oct 2021 16:09:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IG9XxW026767; Mon, 18 Oct 2021 16:09:33 GMT (envelope-from git) Date: Mon, 18 Oct 2021 16:09:33 GMT Message-Id: <202110181609.19IG9XxW026767@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: 8c22b9f3ba58 - main - Fix cross-building on Linux/aarch64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c22b9f3ba586e008e8e55a6215a1d46eb6830b9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8c22b9f3ba586e008e8e55a6215a1d46eb6830b9 commit 8c22b9f3ba586e008e8e55a6215a1d46eb6830b9 Author: Kyle Evans AuthorDate: 2021-10-18 02:26:47 +0000 Commit: Kyle Evans CommitDate: 2021-10-18 16:09:00 +0000 Fix cross-building on Linux/aarch64 Add necessary bits to detect ELF format on Linux/aarch64; note that Linux calls it aarch64 where we would typically call it arm64 (uname -m) Reviewed by: arichardson, emaste, imp Sponsored by: Ampere Computing LLC Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D32542 --- contrib/elftoolchain/common/native-elf-format | 2 ++ tools/build/Makefile | 3 +++ 2 files changed, 5 insertions(+) diff --git a/contrib/elftoolchain/common/native-elf-format b/contrib/elftoolchain/common/native-elf-format index cef29e75111e..903dc37d0fbe 100755 --- a/contrib/elftoolchain/common/native-elf-format +++ b/contrib/elftoolchain/common/native-elf-format @@ -39,6 +39,8 @@ $1 ~ "Machine:" { elfarch = "EM_X86_64"; } else if (match($0, "PowerPC64")) { elfarch = "EM_PPC64"; + } else if (match($0, "AArch64")) { + elfarch = "EM_AARCH64"; } else { elfarch = "unknown"; } diff --git a/tools/build/Makefile b/tools/build/Makefile index 742432872c49..ec9b11398ae9 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -125,6 +125,9 @@ _host_arch=${MACHINE} .if ${_host_arch} == "x86_64" # bmake on Linux/mac often prints that instead of amd64 _host_arch=amd64 +.elif ${_host_arch} == "aarch64" +# Linux calls arm64, aarch64, across the board +_host_arch=arm64 .elif ${_host_arch:Mppc*} _host_arch=powerpc .endif From nobody Mon Oct 18 16:37:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ABD3917FE264; Mon, 18 Oct 2021 16:37:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY2bv4V3sz4hjq; Mon, 18 Oct 2021 16:37:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0C36F22A4B; Mon, 18 Oct 2021 16:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 7881db834647 - main - Remove POWER_PM_TYPE_APM. It's now unused. To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110181445.19IEj36g019473@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Mon, 18 Oct 2021 09:37:45 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110181445.19IEj36g019473@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/18/21 7:45 AM, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=7881db83464759ba783454d2d2eb1b970e352cd3 > > commit 7881db83464759ba783454d2d2eb1b970e352cd3 > Author: Warner Losh > AuthorDate: 2021-10-18 14:41:17 +0000 > Commit: Warner Losh > CommitDate: 2021-10-18 14:41:17 +0000 > > Remove POWER_PM_TYPE_APM. It's now unused. > > Sponsored by: Netflix > Reviewed by: markj > Differential Revision: https://reviews.freebsd.org/D32549 > --- > sys/sys/power.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/sys/sys/power.h b/sys/sys/power.h > index 524bc3fabb24..b0535312d1f7 100644 > --- a/sys/sys/power.h > +++ b/sys/sys/power.h > @@ -34,7 +34,6 @@ > #include > > /* Power management system type */ > -#define POWER_PM_TYPE_APM 0x00 > #define POWER_PM_TYPE_ACPI 0x01 > #define POWER_PM_TYPE_NONE 0xff Do we want to leave a comment that 0x00 was previously used? I don't know if we ever exposed this value to userland as part of any ABI? -- John Baldwin From nobody Mon Oct 18 16:50:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F24D518042B5; Mon, 18 Oct 2021 16:50:31 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY2tb3fBtz4mWt; Mon, 18 Oct 2021 16:50:31 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19IGoN5D064503 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Oct 2021 09:50:23 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19IGoNT1064502; Mon, 18 Oct 2021 09:50:23 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 18 Oct 2021 09:50:23 -0700 From: Gleb Smirnoff To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0a76c63dd498 - main - ng_l2tp: improve seq structure locking. Message-ID: References: <202109101828.18AIS0W5077246@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109101828.18AIS0W5077246@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HY2tb3fBtz4mWt X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-ThisMailContainsUnwantedMimeParts: N Replying to my own commit. Looks like either this commit or following 89042ff77668 has a bug that leaks locked mutex to the kernel interrupt thread. It is really hard to reproduce it, happened just once for me. I failed to find the leak just reviewing the code. If you are using ng_l2tp and experience a bug when some network-associated program (usually ifconfig) blocks forever in kernel, please get in touch with me. On Fri, Sep 10, 2021 at 06:28:00PM +0000, Gleb Smirnoff wrote: T> The branch main has been updated by glebius: T> T> URL: https://cgit.FreeBSD.org/src/commit/?id=0a76c63dd4987d8f7af37fe93569ce8a020cf43e T> T> commit 0a76c63dd4987d8f7af37fe93569ce8a020cf43e T> Author: Gleb Smirnoff T> AuthorDate: 2021-08-06 22:49:51 +0000 T> Commit: Gleb Smirnoff T> CommitDate: 2021-09-10 18:27:13 +0000 T> T> ng_l2tp: improve seq structure locking. T> T> Cover few cases of access to seq without lock missed in 702f98951d5. T> There are no known bugs fixed with this change, however. With INVARIANTS T> embed ng_l2tp_seq_check() into lock/unlock macros. Slightly reduce number T> of locks/unlocks per packet keeping the lock between functions. T> T> Reviewed by: mjg, markj T> Differential Revision: https://reviews.freebsd.org/D31476 T> --- T> sys/netgraph/ng_l2tp.c | 147 ++++++++++++++++++++----------------------------- T> 1 file changed, 61 insertions(+), 86 deletions(-) T> T> diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c T> index 9b6f19f9f0ad..c62bde0c54f7 100644 T> --- a/sys/netgraph/ng_l2tp.c T> +++ b/sys/netgraph/ng_l2tp.c T> @@ -188,10 +188,6 @@ static void ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, T> static hookpriv_p ng_l2tp_find_session(priv_p privp, u_int16_t sid); T> static ng_fn_eachhook ng_l2tp_reset_session; T> T> -#ifdef INVARIANTS T> -static void ng_l2tp_seq_check(struct l2tp_seq *seq); T> -#endif T> - T> /* Parse type for struct ng_l2tp_seq_config. */ T> static const struct ng_parse_struct_field T> ng_l2tp_seq_config_fields[] = NG_L2TP_SEQ_CONFIG_TYPE_INFO; T> @@ -335,12 +331,22 @@ static struct ng_type ng_l2tp_typestruct = { T> }; T> NETGRAPH_INIT(l2tp, &ng_l2tp_typestruct); T> T> -/* Sequence number state sanity checking */ T> +/* Sequence number state locking & sanity checking */ T> #ifdef INVARIANTS T> -#define L2TP_SEQ_CHECK(seq) ng_l2tp_seq_check(seq) T> +static void ng_l2tp_seq_check(struct l2tp_seq *seq); T> +#define SEQ_LOCK(seq) do { \ T> + mtx_lock(&(seq)->mtx); \ T> + ng_l2tp_seq_check(seq); \ T> +} while (0) T> +#define SEQ_UNLOCK(seq) do { \ T> + ng_l2tp_seq_check(seq); \ T> + mtx_unlock(&(seq)->mtx); \ T> +} while (0) T> #else T> -#define L2TP_SEQ_CHECK(x) do { } while (0) T> +#define SEQ_LOCK(seq) mtx_lock(&(seq)->mtx) T> +#define SEQ_UNLOCK(seq) mtx_unlock(&(seq)->mtx) T> #endif T> +#define SEQ_LOCK_ASSERT(seq) mtx_assert(&(seq)->mtx, MA_OWNED) T> T> /* Whether to use m_copypacket() or m_dup() */ T> #define L2TP_COPY_MBUF m_copypacket T> @@ -650,11 +656,10 @@ ng_l2tp_shutdown(node_p node) T> const priv_p priv = NG_NODE_PRIVATE(node); T> struct l2tp_seq *const seq = &priv->seq; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> - T> /* Reset sequence number state */ T> + SEQ_LOCK(seq); T> ng_l2tp_seq_reset(priv); T> + SEQ_UNLOCK(seq); T> T> /* Free private data if neither timer is running */ T> ng_uncallout(&seq->rack_timer, node); T> @@ -757,9 +762,6 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> int error; T> int len, plen; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(&priv->seq); T> - T> /* If not configured, reject */ T> if (!priv->conf.enabled) { T> NG_FREE_ITEM(item); T> @@ -899,18 +901,20 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> if ((hdr & L2TP_HDR_CTRL) != 0) { T> struct l2tp_seq *const seq = &priv->seq; T> T> + SEQ_LOCK(seq); T> + T> /* Handle receive ack sequence number Nr */ T> ng_l2tp_seq_recv_nr(priv, nr); T> T> /* Discard ZLB packets */ T> if (m->m_pkthdr.len == 0) { T> + SEQ_UNLOCK(seq); T> priv->stats.recvZLBs++; T> NG_FREE_ITEM(item); T> NG_FREE_M(m); T> ERROUT(0); T> } T> T> - mtx_lock(&seq->mtx); T> /* T> * If not what we expect or we are busy, drop packet and T> * send an immediate ZLB ack. T> @@ -920,23 +924,16 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> priv->stats.recvDuplicates++; T> else T> priv->stats.recvOutOfOrder++; T> - mtx_unlock(&seq->mtx); T> ng_l2tp_xmit_ctrl(priv, NULL, seq->ns); T> NG_FREE_ITEM(item); T> NG_FREE_M(m); T> ERROUT(0); T> } T> - /* T> - * Until we deliver this packet we can't receive next one as T> - * we have no information for sending ack. T> - */ T> - seq->inproc = 1; T> - mtx_unlock(&seq->mtx); T> T> /* Prepend session ID to packet. */ T> M_PREPEND(m, 2, M_NOWAIT); T> if (m == NULL) { T> - seq->inproc = 0; T> + SEQ_UNLOCK(seq); T> priv->stats.memoryFailures++; T> NG_FREE_ITEM(item); T> ERROUT(ENOBUFS); T> @@ -944,10 +941,17 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> mtod(m, u_int8_t *)[0] = sid >> 8; T> mtod(m, u_int8_t *)[1] = sid & 0xff; T> T> + /* T> + * Until we deliver this packet we can't receive next one as T> + * we have no information for sending ack. T> + */ T> + seq->inproc = 1; T> + SEQ_UNLOCK(seq); T> + T> /* Deliver packet to upper layers */ T> NG_FWD_NEW_DATA(error, item, priv->ctrl, m); T> T> - mtx_lock(&seq->mtx); T> + SEQ_LOCK(seq); T> /* Ready to process next packet. */ T> seq->inproc = 0; T> T> @@ -962,7 +966,7 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> NULL, 0); T> } T> } T> - mtx_unlock(&seq->mtx); T> + SEQ_UNLOCK(seq); T> T> ERROUT(error); T> } T> @@ -997,8 +1001,6 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) T> /* Deliver data */ T> NG_FWD_NEW_DATA(error, item, hook, m); T> done: T> - /* Done */ T> - L2TP_SEQ_CHECK(&priv->seq); T> return (error); T> } T> T> @@ -1016,9 +1018,6 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) T> int i; T> u_int16_t ns; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(&priv->seq); T> - T> /* If not configured, reject */ T> if (!priv->conf.enabled) { T> NG_FREE_ITEM(item); T> @@ -1043,12 +1042,12 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) T> ERROUT(EOVERFLOW); T> } T> T> - mtx_lock(&seq->mtx); T> + SEQ_LOCK(seq); T> T> /* Find next empty slot in transmit queue */ T> for (i = 0; i < L2TP_MAX_XWIN && seq->xwin[i] != NULL; i++); T> if (i == L2TP_MAX_XWIN) { T> - mtx_unlock(&seq->mtx); T> + SEQ_UNLOCK(seq); T> priv->stats.xmitDrops++; T> m_freem(m); T> ERROUT(ENOBUFS); T> @@ -1057,7 +1056,7 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) T> T> /* If peer's receive window is already full, nothing else to do */ T> if (i >= seq->cwnd) { T> - mtx_unlock(&seq->mtx); T> + SEQ_UNLOCK(seq); T> ERROUT(0); T> } T> T> @@ -1068,10 +1067,9 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) T> T> ns = seq->ns++; T> T> - mtx_unlock(&seq->mtx); T> - T> /* Copy packet */ T> if ((m = L2TP_COPY_MBUF(m, M_NOWAIT)) == NULL) { T> + SEQ_UNLOCK(seq); T> priv->stats.memoryFailures++; T> ERROUT(ENOBUFS); T> } T> @@ -1079,8 +1077,6 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) T> /* Send packet and increment xmit sequence number */ T> error = ng_l2tp_xmit_ctrl(priv, m, ns); T> done: T> - /* Done */ T> - L2TP_SEQ_CHECK(&priv->seq); T> return (error); T> } T> T> @@ -1098,9 +1094,6 @@ ng_l2tp_rcvdata(hook_p hook, item_p item) T> int error; T> int i = 2; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(&priv->seq); T> - T> /* If not configured, reject */ T> if (!priv->conf.enabled) { T> NG_FREE_ITEM(item); T> @@ -1161,8 +1154,6 @@ ng_l2tp_rcvdata(hook_p hook, item_p item) T> /* Send packet */ T> NG_FWD_NEW_DATA(error, item, priv->lower, m); T> done: T> - /* Done */ T> - L2TP_SEQ_CHECK(&priv->seq); T> return (error); T> } T> T> @@ -1204,7 +1195,6 @@ ng_l2tp_seq_init(priv_p priv) T> ng_callout_init(&seq->rack_timer); T> ng_callout_init(&seq->xack_timer); T> mtx_init(&seq->mtx, "ng_l2tp", NULL, MTX_DEF); T> - L2TP_SEQ_CHECK(seq); T> } T> T> /* T> @@ -1240,10 +1230,13 @@ ng_l2tp_seq_adjust(priv_p priv, const struct ng_l2tp_config *conf) T> { T> struct l2tp_seq *const seq = &priv->seq; T> u_int16_t new_wmax; T> + int error = 0; T> T> + SEQ_LOCK(seq); T> /* If disabling node, reset state sequence number */ T> if (!conf->enabled) { T> ng_l2tp_seq_reset(priv); T> + SEQ_UNLOCK(seq); T> return (0); T> } T> T> @@ -1252,13 +1245,14 @@ ng_l2tp_seq_adjust(priv_p priv, const struct ng_l2tp_config *conf) T> if (new_wmax > L2TP_MAX_XWIN) T> new_wmax = L2TP_MAX_XWIN; T> if (new_wmax == 0) T> - return (EINVAL); T> + ERROUT(EINVAL); T> if (new_wmax < seq->wmax) T> - return (EBUSY); T> + ERROUT(EBUSY); T> seq->wmax = new_wmax; T> T> - /* Done */ T> - return (0); T> +done: T> + SEQ_UNLOCK(seq); T> + return (error); T> } T> T> /* T> @@ -1271,8 +1265,7 @@ ng_l2tp_seq_reset(priv_p priv) T> hook_p hook; T> int i; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> + SEQ_LOCK_ASSERT(seq); T> T> /* Stop timers */ T> ng_uncallout(&seq->rack_timer, priv->node); T> @@ -1299,9 +1292,6 @@ ng_l2tp_seq_reset(priv_p priv) T> seq->acks = 0; T> seq->rexmits = 0; T> bzero(seq->xwin, sizeof(seq->xwin)); T> - T> - /* Done */ T> - L2TP_SEQ_CHECK(seq); T> } T> T> /* T> @@ -1316,15 +1306,12 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) T> int i, j; T> uint16_t ns; T> T> - mtx_lock(&seq->mtx); T> + SEQ_LOCK_ASSERT(seq); T> T> /* Verify peer's ACK is in range */ T> - if ((nack = L2TP_SEQ_DIFF(nr, seq->rack)) <= 0) { T> - mtx_unlock(&seq->mtx); T> + if ((nack = L2TP_SEQ_DIFF(nr, seq->rack)) <= 0) T> return; /* duplicate ack */ T> - } T> if (L2TP_SEQ_DIFF(nr, seq->ns) > 0) { T> - mtx_unlock(&seq->mtx); T> priv->stats.recvBadAcks++; /* ack for packet not sent */ T> return; T> } T> @@ -1375,10 +1362,8 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) T> ng_uncallout(&seq->rack_timer, priv->node); T> T> /* If transmit queue is empty, we're done for now */ T> - if (seq->xwin[0] == NULL) { T> - mtx_unlock(&seq->mtx); T> + if (seq->xwin[0] == NULL) T> return; T> - } T> T> /* Start restransmit timer again */ T> ng_callout(&seq->rack_timer, priv->node, NULL, T> @@ -1396,8 +1381,6 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) T> seq->ns++; T> } T> T> - mtx_unlock(&seq->mtx); T> - T> /* T> * Send prepared. T> * If there is a memory error, pretend packet was sent, as it T> @@ -1407,8 +1390,10 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) T> struct mbuf *m; T> if ((m = L2TP_COPY_MBUF(xwin[i], M_NOWAIT)) == NULL) T> priv->stats.memoryFailures++; T> - else T> + else { T> ng_l2tp_xmit_ctrl(priv, m, ns); T> + SEQ_LOCK(seq); T> + } T> ns++; T> } T> } T> @@ -1428,17 +1413,13 @@ ng_l2tp_seq_xack_timeout(node_p node, hook_p hook, void *arg1, int arg2) T> (!callout_active(&seq->xack_timer))) T> return; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> + SEQ_LOCK(seq); T> T> /* Send a ZLB */ T> ng_l2tp_xmit_ctrl(priv, NULL, seq->ns); T> T> /* callout_deactivate() is not needed here T> as ng_uncallout() was called by ng_l2tp_xmit_ctrl() */ T> - T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> } T> T> /* T> @@ -1453,14 +1434,12 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) T> struct mbuf *m; T> u_int delay; T> T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> + SEQ_LOCK(seq); T> T> - mtx_lock(&seq->mtx); T> /* Make sure callout is still active before doing anything */ T> if (callout_pending(&seq->rack_timer) || T> !callout_active(&seq->rack_timer)) { T> - mtx_unlock(&seq->mtx); T> + SEQ_UNLOCK(seq); T> return; T> } T> T> @@ -1485,41 +1464,39 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) T> T> /* Retransmit oldest unack'd packet */ T> m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT); T> - mtx_unlock(&seq->mtx); T> - if (m == NULL) T> + if (m == NULL) { T> + SEQ_UNLOCK(seq); T> priv->stats.memoryFailures++; T> - else T> + } else T> ng_l2tp_xmit_ctrl(priv, m, seq->ns++); T> T> /* callout_deactivate() is not needed here T> as ng_callout() is getting called each time */ T> - T> - /* Sanity check */ T> - L2TP_SEQ_CHECK(seq); T> } T> T> /* T> * Transmit a control stream packet, payload optional. T> * The transmit sequence number is not incremented. T> + * Requires seq lock, returns unlocked. T> */ T> static int T> ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) T> { T> struct l2tp_seq *const seq = &priv->seq; T> uint8_t *p; T> - u_int16_t session_id = 0; T> + uint16_t nr, session_id = 0; T> int error; T> T> - mtx_lock(&seq->mtx); T> + SEQ_LOCK_ASSERT(seq); T> T> /* Stop ack timer: we're sending an ack with this packet. T> Doing this before to keep state predictable after error. */ T> if (callout_active(&seq->xack_timer)) T> ng_uncallout(&seq->xack_timer, priv->node); T> T> - seq->xack = seq->nr; T> + nr = seq->xack = seq->nr; T> T> - mtx_unlock(&seq->mtx); T> + SEQ_UNLOCK(seq); T> T> /* If no mbuf passed, send an empty packet (ZLB) */ T> if (m == NULL) { T> @@ -1570,8 +1547,8 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) T> p[7] = session_id & 0xff; T> p[8] = ns >> 8; T> p[9] = ns & 0xff; T> - p[10] = seq->nr >> 8; T> - p[11] = seq->nr & 0xff; T> + p[10] = nr >> 8; T> + p[11] = nr & 0xff; T> T> /* Update sequence number info and stats */ T> priv->stats.xmitPackets++; T> @@ -1594,7 +1571,7 @@ ng_l2tp_seq_check(struct l2tp_seq *seq) T> T> #define CHECK(p) KASSERT((p), ("%s: not: %s", __func__, #p)) T> T> - mtx_lock(&seq->mtx); T> + SEQ_LOCK_ASSERT(seq); T> T> self_unack = L2TP_SEQ_DIFF(seq->nr, seq->xack); T> peer_unack = L2TP_SEQ_DIFF(seq->ns, seq->rack); T> @@ -1617,8 +1594,6 @@ ng_l2tp_seq_check(struct l2tp_seq *seq) T> for ( ; i < seq->cwnd; i++) /* verify peer's recv window full */ T> CHECK(seq->xwin[i] == NULL); T> T> - mtx_unlock(&seq->mtx); T> - T> #undef CHECK T> } T> #endif /* INVARIANTS */ T> _______________________________________________ T> dev-commits-src-all@freebsd.org mailing list T> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all T> To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" -- Gleb Smirnoff From nobody Mon Oct 18 16:50:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F4961804731 for ; Mon, 18 Oct 2021 16:50:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY2tv5L3Fz4mYh for ; Mon, 18 Oct 2021 16:50:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92b.google.com with SMTP id h19so3262569uax.5 for ; Mon, 18 Oct 2021 09:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F8mO1182pyGjT9F2hZrNvrjWBm77zaBl9dQWHTXWexo=; b=f1/lHuBvxESqBnCEouWUB6h3IpBgWarrMeC9jFAUhzgN//86JsD7YCUtf/RoxAnxsx mxyI54iazmCoHW1F3iyyeKt2Be0CTrvLHJ6dJD+DztxdVBuZ7x3ZgNyCPFyk7ykkBqtG dM4Dl5gV6GNDWpwqmr4nzhLjIzu7/hgdLCRh0ADIP5X0m/O5vvYlJ6fcAZfBiDWV1+Gg 7QawG5Asijx/JP+BLfUelYAqqjs+kENSO/SO1HOsOjk7KxSNlY37r2LxYSGHEWBZOt3U Yi/85ouc9ftPX2/ECx2GiSSWL7VaBa3mTzFX/Dk9yBGLOSJB+Qhl7c2fakzAilF1JZD0 0Q3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F8mO1182pyGjT9F2hZrNvrjWBm77zaBl9dQWHTXWexo=; b=cGD1Sn7qjMds6BBojCOpgZ7cbNTD4Ga5PRZGFfKSEytLKfAH8W5Vtf7BxqPQRiETVG xGKfbX8wKq643y7yYGUCeL8XfluRZIBoBCmGLLnjj3/QvAy0BT1JTN1wk56wDWWTwIC2 nhcEJCtoabbVhHQ6ZQciB+AJD/0UDj42At/1tOQVCaXb9rnhaJ6cNFHSI0PZrhksJxG3 EI28ItflOV/trNx1s7zhwgMbvO933j43M9Qda7qQKPiA3/QHLsCqiQuI26Q1ZDORVTcx zaZ5yvLnUcYVJhdE5w8awk9GVfGV/YPTYX3wTzQIq/TndW7WmHqWUnhzfaHkVZtohtVd D3ng== X-Gm-Message-State: AOAM530/qucd8fO8YQMvZJAHZ0m3kdh9aX+YLOySB2MI3vhKqK7e+YZQ LzsaKOjKTDMMbGpp3tvy0cXqxQwY21S3mEOLd6wZax9duE9kog== X-Google-Smtp-Source: ABdhPJyb45XpOiveGyj6y6giFEFfNAb00qVzS2Q+1MDOrJobH5DYED/U2kuLYKKFjXFlm+4Gy04SPcWZCWTPINAvWsk= X-Received: by 2002:a67:c903:: with SMTP id w3mr28994375vsk.6.1634575847119; Mon, 18 Oct 2021 09:50:47 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110181445.19IEj36g019473@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Mon, 18 Oct 2021 10:50:36 -0600 Message-ID: Subject: Re: git: 7881db834647 - main - Remove POWER_PM_TYPE_APM. It's now unused. To: John Baldwin Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b9f10e05cea358cf" X-Rspamd-Queue-Id: 4HY2tv5L3Fz4mYh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000b9f10e05cea358cf Content-Type: text/plain; charset="UTF-8" On Mon, Oct 18, 2021 at 10:37 AM John Baldwin wrote: > On 10/18/21 7:45 AM, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=7881db83464759ba783454d2d2eb1b970e352cd3 > > > > commit 7881db83464759ba783454d2d2eb1b970e352cd3 > > Author: Warner Losh > > AuthorDate: 2021-10-18 14:41:17 +0000 > > Commit: Warner Losh > > CommitDate: 2021-10-18 14:41:17 +0000 > > > > Remove POWER_PM_TYPE_APM. It's now unused. > > > > Sponsored by: Netflix > > Reviewed by: markj > > Differential Revision: https://reviews.freebsd.org/D32549 > > --- > > sys/sys/power.h | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/sys/sys/power.h b/sys/sys/power.h > > index 524bc3fabb24..b0535312d1f7 100644 > > --- a/sys/sys/power.h > > +++ b/sys/sys/power.h > > @@ -34,7 +34,6 @@ > > #include > > > > /* Power management system type */ > > -#define POWER_PM_TYPE_APM 0x00 > > #define POWER_PM_TYPE_ACPI 0x01 > > #define POWER_PM_TYPE_NONE 0xff > > Do we want to leave a comment that 0x00 was previously used? I don't know > if we ever > exposed this value to userland as part of any ABI? > Good question, but I believe the answer is no. power_pm_type is static in sys/kern/subr_power.c. It's only exported from that module with power_pm_get_type(). This is only called from acpi.c to make decisions about whether or not to load, attach, or identify devices. There's also no sysctl that publish this, nor is this value used in userland in base. The whole sys/power.h file has the look of an internal kernel file because there's no #ifdef _KERNEL section around all the prototypes it defines. Have I missed something? Warner --000000000000b9f10e05cea358cf-- From nobody Mon Oct 18 17:33:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A05B117F7210; Mon, 18 Oct 2021 17:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY3rb3CzSz3H22; Mon, 18 Oct 2021 17:33:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E7EC24A1D; Mon, 18 Oct 2021 17:33:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IHXpgx045810; Mon, 18 Oct 2021 17:33:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IHXpHM045809; Mon, 18 Oct 2021 17:33:51 GMT (envelope-from git) Date: Mon, 18 Oct 2021 17:33:51 GMT Message-Id: <202110181733.19IHXpHM045809@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: 5a78df20ce77 - main - in_pcb: garbage collect unused structure in_pcblist List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 5a78df20ce77e418503d0264d3daa26487908b1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5a78df20ce77e418503d0264d3daa26487908b1f commit 5a78df20ce77e418503d0264d3daa26487908b1f Author: Gleb Smirnoff AuthorDate: 2021-04-27 17:43:56 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-18 17:06:39 +0000 in_pcb: garbage collect unused structure in_pcblist --- sys/netinet/in_pcb.c | 22 ---------------------- sys/netinet/in_pcb.h | 8 -------- 2 files changed, 30 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 189f73028198..fc2914730e43 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1665,28 +1665,6 @@ in_pcbrele(struct inpcb *inp) return (in_pcbrele_wlocked(inp)); } -void -in_pcblist_rele_rlocked(epoch_context_t ctx) -{ - struct in_pcblist *il; - struct inpcb *inp; - struct inpcbinfo *pcbinfo; - int i, n; - - il = __containerof(ctx, struct in_pcblist, il_epoch_ctx); - pcbinfo = il->il_pcbinfo; - n = il->il_count; - INP_INFO_WLOCK(pcbinfo); - for (i = 0; i < n; i++) { - inp = il->il_inp_list[i]; - INP_RLOCK(inp); - if (!in_pcbrele_rlocked(inp)) - INP_RUNLOCK(inp); - } - INP_INFO_WUNLOCK(pcbinfo); - free(il, M_TEMP); -} - static void inpcbport_free(epoch_context_t ctx) { diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index c20c516628b8..77a99e666663 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -407,13 +407,6 @@ struct inpcbport { u_short phd_port; }; -struct in_pcblist { - int il_count; - struct epoch_context il_epoch_ctx; - struct inpcbinfo *il_pcbinfo; - struct inpcb *il_inp_list[0]; -}; - /*- * Global data structure for each high-level protocol (UDP, TCP, ...) in both * IPv4 and IPv6. Holds inpcb lists and information for managing them. @@ -872,7 +865,6 @@ void in_pcbrehash_mbuf(struct inpcb *, struct mbuf *); int in_pcbrele(struct inpcb *); int in_pcbrele_rlocked(struct inpcb *); int in_pcbrele_wlocked(struct inpcb *); -void in_pcblist_rele_rlocked(epoch_context_t ctx); void in_losing(struct inpcb *); void in_pcbsetsolabel(struct socket *so); int in_getpeeraddr(struct socket *so, struct sockaddr **nam); From nobody Mon Oct 18 17:33:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F03017F73EE; Mon, 18 Oct 2021 17:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY3rc3v1Tz3GPH; Mon, 18 Oct 2021 17:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6608A24AB6; Mon, 18 Oct 2021 17:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IHXqad045834; Mon, 18 Oct 2021 17:33:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IHXqVf045833; Mon, 18 Oct 2021 17:33:52 GMT (envelope-from git) Date: Mon, 18 Oct 2021 17:33:52 GMT Message-Id: <202110181733.19IHXqVf045833@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: 744a64bd920c - main - in_pcb: garbage collect in_pcbrele() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 744a64bd920c79b74a695a53cddfbecee4935c05 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=744a64bd920c79b74a695a53cddfbecee4935c05 commit 744a64bd920c79b74a695a53cddfbecee4935c05 Author: Gleb Smirnoff AuthorDate: 2021-04-27 22:11:08 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-18 17:07:16 +0000 in_pcb: garbage collect in_pcbrele() --- sys/netinet/in_pcb.c | 10 ---------- sys/netinet/in_pcb.h | 1 - 2 files changed, 11 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index fc2914730e43..e267d25c4f69 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1655,16 +1655,6 @@ in_pcbrele_wlocked(struct inpcb *inp) return (1); } -/* - * Temporary wrapper. - */ -int -in_pcbrele(struct inpcb *inp) -{ - - return (in_pcbrele_wlocked(inp)); -} - static void inpcbport_free(epoch_context_t ctx) { diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 77a99e666663..861c0ba5f0aa 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -862,7 +862,6 @@ void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, void in_pcbref(struct inpcb *); void in_pcbrehash(struct inpcb *); void in_pcbrehash_mbuf(struct inpcb *, struct mbuf *); -int in_pcbrele(struct inpcb *); int in_pcbrele_rlocked(struct inpcb *); int in_pcbrele_wlocked(struct inpcb *); void in_losing(struct inpcb *); From nobody Mon Oct 18 17:33:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EDC6717F750E; Mon, 18 Oct 2021 17:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY3rd51w1z3H5n; Mon, 18 Oct 2021 17:33:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 866FE248E2; Mon, 18 Oct 2021 17:33:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IHXr7B045858; Mon, 18 Oct 2021 17:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IHXrFJ045857; Mon, 18 Oct 2021 17:33:53 GMT (envelope-from git) Date: Mon, 18 Oct 2021 17:33:53 GMT Message-Id: <202110181733.19IHXrFJ045857@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: 147f018a720b - main - Move in6_pcbsetport() to in6_pcb.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 147f018a720b80da4ba61bec90a6efc6eaa4913e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=147f018a720b80da4ba61bec90a6efc6eaa4913e commit 147f018a720b80da4ba61bec90a6efc6eaa4913e Author: Gleb Smirnoff AuthorDate: 2021-10-18 17:11:20 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-18 17:19:03 +0000 Move in6_pcbsetport() to in6_pcb.c This function was originally carved out of in6_pcbbind(), which is in in6_pcb.c. This function also uses KPI private to the PCB database - in_pcb_lport(). --- sys/netinet6/in6_pcb.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/netinet6/in6_src.c | 42 ------------------------------------------ 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 14b95dfe0254..10a29f339773 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -114,6 +114,44 @@ __FBSDID("$FreeBSD$"); #include #include +int +in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) +{ + struct socket *so = inp->inp_socket; + u_int16_t lport = 0; + int error, lookupflags = 0; +#ifdef INVARIANTS + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; +#endif + + INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(pcbinfo); + + error = prison_local_ip6(cred, laddr, + ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)); + if (error) + return(error); + + /* XXX: this is redundant when called from in6_pcbbind */ + if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT|SO_REUSEPORT_LB)) == 0) + lookupflags = INPLOOKUP_WILDCARD; + + inp->inp_flags |= INP_ANONPORT; + + error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags); + if (error != 0) + return (error); + + inp->inp_lport = lport; + if (in_pcbinshash(inp) != 0) { + inp->in6p_laddr = in6addr_any; + inp->inp_lport = 0; + return (EAGAIN); + } + + return (0); +} + int in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7f623709de13..875e0a63745c 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -926,48 +926,6 @@ in6_selecthlim(struct inpcb *inp, struct ifnet *ifp) return (V_ip6_defhlim); } -/* - * XXX: this is borrowed from in6_pcbbind(). If possible, we should - * share this function by all *bsd*... - */ -int -in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) -{ - struct socket *so = inp->inp_socket; - u_int16_t lport = 0; - int error, lookupflags = 0; -#ifdef INVARIANTS - struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; -#endif - - INP_WLOCK_ASSERT(inp); - INP_HASH_WLOCK_ASSERT(pcbinfo); - - error = prison_local_ip6(cred, laddr, - ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)); - if (error) - return(error); - - /* XXX: this is redundant when called from in6_pcbbind */ - if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT|SO_REUSEPORT_LB)) == 0) - lookupflags = INPLOOKUP_WILDCARD; - - inp->inp_flags |= INP_ANONPORT; - - error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags); - if (error != 0) - return (error); - - inp->inp_lport = lport; - if (in_pcbinshash(inp) != 0) { - inp->in6p_laddr = in6addr_any; - inp->inp_lport = 0; - return (EAGAIN); - } - - return (0); -} - void addrsel_policy_init(void) { From nobody Mon Oct 18 17:33:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B244A17F7590; Mon, 18 Oct 2021 17:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY3rf65fDz3Gw9; Mon, 18 Oct 2021 17:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A02A524B14; Mon, 18 Oct 2021 17:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IHXsqb045889; Mon, 18 Oct 2021 17:33:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IHXsqw045888; Mon, 18 Oct 2021 17:33:54 GMT (envelope-from git) Date: Mon, 18 Oct 2021 17:33:54 GMT Message-Id: <202110181733.19IHXsqw045888@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: 0f617ae48a91 - main - Add in_pcb_var.h for KPIs that are private to in_pcb.c and in6_pcb.c. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 0f617ae48a911caab3130d0e80cfb425bc3b653b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0f617ae48a911caab3130d0e80cfb425bc3b653b commit 0f617ae48a911caab3130d0e80cfb425bc3b653b Author: Gleb Smirnoff AuthorDate: 2021-10-18 17:14:03 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-18 17:19:57 +0000 Add in_pcb_var.h for KPIs that are private to in_pcb.c and in6_pcb.c. --- sys/netinet/in_pcb.c | 1 + sys/netinet/in_pcb.h | 8 ------- sys/netinet/in_pcb_var.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/netinet6/in6_pcb.c | 1 + 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index e267d25c4f69..1a7639c0137b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #if defined(INET) || defined(INET6) #include #include +#include #ifdef INET #include #include diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 861c0ba5f0aa..d6a335236599 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -826,11 +826,6 @@ void in_pcbgroup_update_mbuf(struct inpcb *, struct mbuf *); void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); int in_pcballoc(struct socket *, struct inpcbinfo *); int in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *); -int in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, - u_short *lportp, struct sockaddr *fsa, u_short fport, - struct ucred *cred, int lookupflags); -int in_pcb_lport(struct inpcb *, struct in_addr *, u_short *, - struct ucred *, int); int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *, u_short *, struct ucred *); int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *); @@ -848,9 +843,6 @@ int in_pcbinshash_mbuf(struct inpcb *, struct mbuf *); int in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *, struct ucred *); int in_pcblbgroup_numa(struct inpcb *, int arg); -struct inpcb * - in_pcblookup_local(struct inpcbinfo *, - struct in_addr, u_short, int, struct ucred *); struct inpcb * in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *); diff --git a/sys/netinet/in_pcb_var.h b/sys/netinet/in_pcb_var.h new file mode 100644 index 000000000000..5038ab404871 --- /dev/null +++ b/sys/netinet/in_pcb_var.h @@ -0,0 +1,55 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. + * Copyright (c) 2010-2011 Juniper Networks, Inc. + * All rights reserved. + * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD$ + */ + +#ifndef _NETINET_IN_PCB_VAR_H_ +#define _NETINET_IN_PCB_VAR_H_ + +/* + * Definitions shared between netinet/in_pcb.c and netinet6/in6_pcb.c + */ + +int in_pcb_lport(struct inpcb *, struct in_addr *, u_short *, + struct ucred *, int); +int in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, + u_short *lportp, struct sockaddr *fsa, u_short fport, + struct ucred *cred, int lookupflags); +struct inpcb * in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, + int, struct ucred *); + +#endif /* !_NETINET_IN_PCB_VAR_H_ */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 10a29f339773..9a5d69e16a1c 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From nobody Mon Oct 18 18:41:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8FCDB181553C; Mon, 18 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY5M93bdGz3t7d; Mon, 18 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CE8B256FD; Mon, 18 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IIfvSo037770; Mon, 18 Oct 2021 18:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IIfvA5037769; Mon, 18 Oct 2021 18:41:57 GMT (envelope-from git) Date: Mon, 18 Oct 2021 18:41:57 GMT Message-Id: <202110181841.19IIfvA5037769@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: 9b7501e7977c - main - in_mcast: garbage collect inp_gcmoptions() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 9b7501e7977c1f4a0a4a798cdf0af64846009df8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=9b7501e7977c1f4a0a4a798cdf0af64846009df8 commit 9b7501e7977c1f4a0a4a798cdf0af64846009df8 Author: Gleb Smirnoff AuthorDate: 2021-10-18 18:36:07 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-18 18:36:07 +0000 in_mcast: garbage collect inp_gcmoptions() It is is used only once, merge it into inp_freemoptions(). --- sys/netinet/in_mcast.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index ad2d7af799a5..f307be283e64 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -1588,13 +1588,16 @@ inp_findmoptions(struct inpcb *inp) return (imo); } -static void -inp_gcmoptions(struct ip_moptions *imo) +void +inp_freemoptions(struct ip_moptions *imo) { struct in_mfilter *imf; struct in_multi *inm; struct ifnet *ifp; + if (imo == NULL) + return; + while ((imf = ip_mfilter_first(&imo->imo_head)) != NULL) { ip_mfilter_remove(&imo->imo_head, imf); @@ -1613,20 +1616,6 @@ inp_gcmoptions(struct ip_moptions *imo) free(imo, M_IPMOPTS); } -/* - * Discard the IP multicast options (and source filters). To minimize - * the amount of work done while holding locks such as the INP's - * pcbinfo lock (which is used in the receive path), the free - * operation is deferred to the epoch callback task. - */ -void -inp_freemoptions(struct ip_moptions *imo) -{ - if (imo == NULL) - return; - inp_gcmoptions(imo); -} - /* * Atomically get source filters on a socket for an IPv4 multicast group. * Called with INP lock held; returns with lock released. From nobody Mon Oct 18 19:04:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6124D17F0CCF; Mon, 18 Oct 2021 19:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY5ry2Lcjz4W1Y; Mon, 18 Oct 2021 19:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 319F925876; Mon, 18 Oct 2021 19:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJ4IFd066454; Mon, 18 Oct 2021 19:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJ4Ile066453; Mon, 18 Oct 2021 19:04:18 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:04:18 GMT Message-Id: <202110181904.19IJ4Ile066453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: cf560d6b3620 - stable/13 - acpi(4): Correct outdated sysctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cf560d6b3620851c4041581dbfd6eabc10bfc332 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cf560d6b3620851c4041581dbfd6eabc10bfc332 commit cf560d6b3620851c4041581dbfd6eabc10bfc332 Author: Felix Johnson AuthorDate: 2021-10-13 00:42:14 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-18 19:03:39 +0000 acpi(4): Correct outdated sysctl This changes the location of cx_supported sysctl to dev.cpu.N. PR: 214370 (cherry picked from commit 6882064d0ced456c89d161da4bc43c5d97bab60b) --- share/man/man4/acpi.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index 8c221be870aa..0a865d9e7a38 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2015 +.Dd October 12, 2021 .Dt ACPI 4 .Os .Sh NAME @@ -86,7 +86,7 @@ should be set to .Li acpi if it is listed in .Va machdep.idle_available . -.It Va hw.acpi.cpu.cx_supported +.It Va dev.cpu.N.cx_supported List of supported CPU idle states and their transition latency in microseconds. Each state has a type (e.g., From nobody Mon Oct 18 19:16:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20A5717F75E1; Mon, 18 Oct 2021 19:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY67707w0z4bWl; Mon, 18 Oct 2021 19:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D869F260B2; Mon, 18 Oct 2021 19:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJGYI3079803; Mon, 18 Oct 2021 19:16:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJGYJP079802; Mon, 18 Oct 2021 19:16:34 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:16:34 GMT Message-Id: <202110181916.19IJGYJP079802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 351cad089f20 - stable/13 - bpf(4): Fix a misnamed constant List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 351cad089f204bb3a706dfefe1720736150778b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=351cad089f204bb3a706dfefe1720736150778b0 commit 351cad089f204bb3a706dfefe1720736150778b0 Author: Felix Johnson AuthorDate: 2021-10-13 23:00:41 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-18 19:16:01 +0000 bpf(4): Fix a misnamed constant rarpd.c was modified in r19859 to use REVARP_REQUEST instead of ARPOP_REVREQUEST. PR: 183333 Reported by: pluknet (cherry picked from commit a524aaf68341d9f83a0ef7dc21ad54728ddaaa1e) --- share/man/man4/bpf.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index 66f4ae72918b..f285d5276376 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 22, 2021 +.Dd October 13, 2021 .Dt BPF 4 .Os .Sh NAME @@ -1079,7 +1079,7 @@ struct bpf_insn insns[] = { BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_REVARP, 0, 3), BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 20), - BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, REVARP_REQUEST, 0, 1), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ARPOP_REVREQUEST, 0, 1), BPF_STMT(BPF_RET+BPF_K, sizeof(struct ether_arp) + sizeof(struct ether_header)), BPF_STMT(BPF_RET+BPF_K, 0), From nobody Mon Oct 18 19:19:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 66AD917F8399; Mon, 18 Oct 2021 19:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BC2WRrz4cRd; Mon, 18 Oct 2021 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35B88260B5; Mon, 18 Oct 2021 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJF1o080135; Mon, 18 Oct 2021 19:19:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJFAO080134; Mon, 18 Oct 2021 19:19:15 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:15 GMT Message-Id: <202110181919.19IJJFAO080134@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: 8e53cd709943 - main - ipq4018: add TCSR definitions from Linux. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 8e53cd70994369510b24248aad1352aed70727c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=8e53cd70994369510b24248aad1352aed70727c9 commit 8e53cd70994369510b24248aad1352aed70727c9 Author: Adrian Chadd AuthorDate: 2021-10-16 03:11:46 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:18:01 +0000 ipq4018: add TCSR definitions from Linux. These are hardware configuration options which are required in the linux/openwrt device trees for the IPQ4018/IPQ4019 devices. Since this isn't obtained from linux upstream but instead from openwrt, this can't go in contrib; instead it is going in sys/dts/include/ . Obtained from: OpenWRT Tested: * IPQ4019 ASUS RT-AC58U AP, initial bootstrapping --- sys/conf/Makefile.arm | 2 +- sys/dts/include/dt-bindings/soc/qcom,tcsr.h | 27 +++++++++++++++++++++++++++ sys/tools/fdt/make_dtb.sh | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index 754b43131d6d..9034ffb5e29a 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -30,7 +30,7 @@ S= ../../.. .endif .include "$S/conf/kern.pre.mk" -INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include +INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include -I$$/dts/include LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\" diff --git a/sys/dts/include/dt-bindings/soc/qcom,tcsr.h b/sys/dts/include/dt-bindings/soc/qcom,tcsr.h new file mode 100644 index 000000000000..47540b3b8a04 --- /dev/null +++ b/sys/dts/include/dt-bindings/soc/qcom,tcsr.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. */ +#ifndef __DT_BINDINGS_QCOM_TCSR_H__ +#define __DT_BINDINGS_QCOM_TCSR_H__ + +#define TCSR_USB_SELECT_USB3_P0 0x1 +#define TCSR_USB_SELECT_USB3_P1 0x2 +#define TCSR_USB_SELECT_USB3_DUAL 0x3 + +#define TCSR_USB_HSPHY_HOST_MODE 0x00E700E7 +#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E7 + +#define TCSR_ESS_PSGMII 0 +#define TCSR_ESS_PSGMII_RGMII5 1 +#define TCSR_ESS_PSGMII_RMII0 2 +#define TCSR_ESS_PSGMII_RMII1 4 +#define TCSR_ESS_PSGMII_RMII0_RMII1 6 +#define TCSR_ESS_PSGMII_RGMII4 9 + +#define TCSR_WIFI_GLB_CFG 0x41000000 + +#define TCSR_WIFI_NOC_MEMTYPE_M0_M2 0x02222222 + +#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0 +#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1 + +#endif diff --git a/sys/tools/fdt/make_dtb.sh b/sys/tools/fdt/make_dtb.sh index 09d0b3bd9f42..e1a2fa4b1d8a 100755 --- a/sys/tools/fdt/make_dtb.sh +++ b/sys/tools/fdt/make_dtb.sh @@ -23,6 +23,6 @@ fi for d in ${dts}; do dtb="${dtb_path}/$(basename "$d" .dts).dtb" ${ECHO} "converting $d -> $dtb" - ${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null | + ${CPP} -P -x assembler-with-cpp -I "$S/dts/include" -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null | ${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" -i "$S/contrib/device-tree/src/" done From nobody Mon Oct 18 19:19:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A816917F815F; Mon, 18 Oct 2021 19:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BD3990z4cRf; Mon, 18 Oct 2021 19:19:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A56826138; Mon, 18 Oct 2021 19:19:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJGAT080159; Mon, 18 Oct 2021 19:19:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJGwd080158; Mon, 18 Oct 2021 19:19:16 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:16 GMT Message-Id: <202110181919.19IJJGwd080158@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: 9264bd386cfc - main - ipq4018: add a device tree file for the ASUS rt-ac58u router List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 9264bd386cfcb3c081f9b7e2a695f25c367c0891 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=9264bd386cfcb3c081f9b7e2a695f25c367c0891 commit 9264bd386cfcb3c081f9b7e2a695f25c367c0891 Author: Adrian Chadd AuthorDate: 2021-10-16 03:13:04 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:18:46 +0000 ipq4018: add a device tree file for the ASUS rt-ac58u router This is the initial device tree file describing the ASUS RT-AC58U 2GHz/5GHz 11ac router. Obtained from: OpenWRT --- sys/dts/arm/qcom-ipq4018-rt-ac58u.dts | 312 ++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) diff --git a/sys/dts/arm/qcom-ipq4018-rt-ac58u.dts b/sys/dts/arm/qcom-ipq4018-rt-ac58u.dts new file mode 100644 index 000000000000..8a280c79e942 --- /dev/null +++ b/sys/dts/arm/qcom-ipq4018-rt-ac58u.dts @@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "ASUS RT-AC58U"; + compatible = "asus,rt-ac58u"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x8000000>; + }; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + serial0 = &blsp1_uart1; + }; + + chosen { + bootargs-append = " ubi.mtd=UBI_DEV"; +// stdout-path = "serial0:115200n8"; + stdout-path = "serial0"; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb3@8af8800 { + status = "okay"; + + dwc3@8a00000 { + #address-cells = <1>; + #size-cells = <0>; + + usb3_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + usb3_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + }; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: status { + label = "blue:status"; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "blue:wan"; + gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; + }; + + wlan2G { + label = "blue:wlan2G"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5G { + label = "blue:wlan5G"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + + usb { + label = "blue:usb"; + gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; + trigger-sources = <&usb3_port1>, <&usb3_port2>; + linux,default-trigger = "usbport"; + }; + + lan { + label = "blue:lan"; + gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&cryptobam { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + mux { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + + mux_cs { + function = "gpio"; + pins = "gpio54", "gpio59"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&blsp1_spi1 { /* BLSP1 QUP1 */ + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, + <&tlmm 59 GPIO_ACTIVE_HIGH>; + + flash@0 { + /* + * U-boot looks for "n25q128a11" node, + * if we don't have it, it will spit out the following warning: + * "ipq: fdt fixup unable to find compatible node". + */ + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l1606e", "n25q128a11"; + spi-max-frequency = <30000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + partition@40000 { + label = "MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + partition@60000 { + label = "QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + partition@c0000 { + label = "CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + partition@d0000 { + label = "DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + partition@e0000 { + label = "APPSBLENV"; /* uboot env*/ + reg = <0x000e0000 0x00010000>; + read-only; + }; + partition@f0000 { + label = "APPSBL"; /* uboot */ + reg = <0x000f0000 0x00080000>; + read-only; + }; + partition@170000 { + label = "ART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + /* 0x00180000 - 0x00200000 unused */ + }; + }; + + spi-nand@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <30000000>; + + /* + * U-boot looks for "spinand,mt29f" node, + * if we don't have it, it will spit out the following warning: + * "ipq: fdt fixup unable to find compatible node". + */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + /* + * TODO: change to label = "ubi" once we drop 4.14. + * also drop the bootargs-append and all the + * userspace CI_UBIPART="UBI_DEV" remains. + */ + label = "UBI_DEV"; + reg = <0x00000000 0x08000000>; + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "RT-AC58U"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "RT-AC58U"; +}; From nobody Mon Oct 18 19:19:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06CF317F82D4; Mon, 18 Oct 2021 19:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BF4hNgz4cBn; Mon, 18 Oct 2021 19:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75D79260B6; Mon, 18 Oct 2021 19:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJHhQ080183; Mon, 18 Oct 2021 19:19:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJHws080182; Mon, 18 Oct 2021 19:19:17 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:17 GMT Message-Id: <202110181919.19IJJHws080182@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: 8398d52d6541 - main - arm: print out the undefined instruction upon an undefined instruction panic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 8398d52d6541d316fcd88c856b5a72bb9cce0534 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=8398d52d6541d316fcd88c856b5a72bb9cce0534 commit 8398d52d6541d316fcd88c856b5a72bb9cce0534 Author: Adrian Chadd AuthorDate: 2021-10-16 03:15:15 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:18:52 +0000 arm: print out the undefined instruction upon an undefined instruction panic It's SUPER useful to be able to see the actual undefined instruction when we hit said undefined instruction. --- sys/arm/arm/undefined.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c index ef9e72c89163..4e9a5295d338 100644 --- a/sys/arm/arm/undefined.c +++ b/sys/arm/arm/undefined.c @@ -341,7 +341,8 @@ undefinedinstruction(struct trapframe *frame) return; } else - panic("Undefined instruction in kernel.\n"); + panic("Undefined instruction in kernel (0x%08x).\n", + fault_instruction); } userret(td, frame); From nobody Mon Oct 18 19:19:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ECB7517F81DE; Mon, 18 Oct 2021 19:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BJ2SySz4cQ3; Mon, 18 Oct 2021 19:19:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8C0525E45; Mon, 18 Oct 2021 19:19:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJJmt080231; Mon, 18 Oct 2021 19:19:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJJYk080230; Mon, 18 Oct 2021 19:19:19 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:19 GMT Message-Id: <202110181919.19IJJJYk080230@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: 02438ce5fd18 - main - ipq4018: add initial IPQ4018/IPQ4019 support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 02438ce5fd1892e3f59e4f1e83a0ac810396853f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=02438ce5fd1892e3f59e4f1e83a0ac810396853f commit 02438ce5fd1892e3f59e4f1e83a0ac810396853f Author: Adrian Chadd AuthorDate: 2021-10-16 18:47:44 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:19:00 +0000 ipq4018: add initial IPQ4018/IPQ4019 support This is for the Qualcomm Atheros quad-core ARMv7 SoC with built-in 2x2 2GHz and 5GHz ath10k devices. It's enough (with an upcoming set of config files) to netboot on an ASUS router I have here and get to a single core mountroot prompt. --- sys/arm/qualcomm/ipq4018_machdep.c | 194 +++++++++++++++++++++++++++++++++++++ sys/arm/qualcomm/ipq4018_machdep.h | 38 ++++++++ sys/arm/qualcomm/ipq4018_mp.c | 61 ++++++++++++ sys/arm/qualcomm/ipq4018_reg.h | 42 ++++++++ sys/arm/qualcomm/std.ipq4018 | 2 + 5 files changed, 337 insertions(+) diff --git a/sys/arm/qualcomm/ipq4018_machdep.c b/sys/arm/qualcomm/ipq4018_machdep.c new file mode 100644 index 000000000000..b3f841575ebb --- /dev/null +++ b/sys/arm/qualcomm/ipq4018_machdep.c @@ -0,0 +1,194 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "platform_if.h" + +static int +ipq4018_attach(platform_t plat) +{ + return (0); +} + +static void +ipq4018_late_init(platform_t plat) +{ + /* + * XXX FIXME This is needed because we're not parsing + * the fdt reserved memory regions in a consistent way + * between arm/arm64. Once the reserved region parsing + * is fixed up this will become unneccessary. + * + * These cover the SRAM/TZ regions that are not fully + * accessible from the OS. They're in the ipq4018.dtsi + * tree. + * + * Without these, the system fails to boot because we + * aren't parsing the regions correctly. + * + * These will be unnecessary once the parser and setup + * code is fixed. + */ + physmem_exclude_region(IPQ4018_MEM_SMEM_START, + IPQ4018_MEM_SMEM_SIZE, + EXFLAG_NODUMP | EXFLAG_NOALLOC); + physmem_exclude_region(IPQ4018_MEM_TZ_START, + IPQ4018_MEM_TZ_SIZE, + EXFLAG_NODUMP | EXFLAG_NOALLOC); +} + +static int +ipq4018_devmap_init(platform_t plat) +{ + /* + * This covers the boot UART. Without it we can't boot successfully: + * there's a mutex uninit panic in subr_vmem.c that occurs when doing + * a call to pmap_mapdev() when the bus space code is doing its thing. + */ + devmap_add_entry(IPQ4018_MEM_UART1_START, IPQ4018_MEM_UART1_SIZE); + return (0); +} + +static void +ipq4018_cpu_reset(platform_t plat) +{ +} + +/* + * Early putc routine for EARLY_PRINTF support. To use, add to kernel config: + * option SOCDEV_PA=0x07800000 + * option SOCDEV_VA=0x07800000 + * option EARLY_PRINTF + * Resist the temptation to change the #if 0 to #ifdef EARLY_PRINTF here. It + * makes sense now, but if multiple SOCs do that it will make early_putc another + * duplicate symbol to be eliminated on the path to a generic kernel. + */ +#if 0 +void +qca_msm_early_putc(int c) +{ + static int is_init = 0; + + int limit; +/* + * This must match what's put into SOCDEV_VA. You have to change them + * both together. + * + * XXX TODO I should really go and just make UART_BASE here depend upon + * SOCDEV_VA so they move together. + */ +#define UART_BASE IPQ4018_MEM_UART1_START + volatile uint32_t * UART_DM_TF0 = (uint32_t *)(UART_BASE + 0x70); + volatile uint32_t * UART_DM_SR = (uint32_t *)(UART_BASE + 0x08); +#define UART_DM_SR_TXEMT (1 << 3) +#define UART_DM_SR_TXRDY (1 << 2) + volatile uint32_t * UART_DM_ISR = (uint32_t *)(UART_BASE + 0x14); + volatile uint32_t * UART_DM_CR = (uint32_t *)(UART_BASE + 0x10); +#define UART_DM_TX_READY (1 << 7) +#define UART_DM_CLEAR_TX_READY 0x300 + volatile uint32_t * UART_DM_NO_CHARS_FOR_TX = (uint32_t *)(UART_BASE + 0x40); + volatile uint32_t * UART_DM_TFWR = (uint32_t *)(UART_BASE + 0x1c); +#define UART_DM_TFW_VALUE 0 + volatile uint32_t * UART_DM_IPR = (uint32_t *)(UART_BASE + 0x18); +#define UART_DM_STALE_TIMEOUT_LSB 0xf + + if (is_init == 0) { + is_init = 1; + *UART_DM_TFWR = UART_DM_TFW_VALUE; + wmb(); + *UART_DM_IPR = UART_DM_STALE_TIMEOUT_LSB; + wmb(); + } + + /* Wait until TXFIFO is empty via ISR */ + limit = 100000; + if ((*UART_DM_SR & UART_DM_SR_TXEMT) == 0) { + while (((*UART_DM_ISR & UART_DM_TX_READY) == 0) && --limit) { + /* Note - can't use DELAY here yet, too early */ + rmb(); + } + *UART_DM_CR = UART_DM_CLEAR_TX_READY; + wmb(); + } + + /* FIFO is ready. Say we're going to write one byte */ + *UART_DM_NO_CHARS_FOR_TX = 1; + wmb(); + + limit = 100000; + while (((*UART_DM_SR & UART_DM_SR_TXRDY) == 0) && --limit) { + /* Note - can't use DELAY here yet, too early */ + rmb(); + } + + /* Put character in first fifo slot */ + *UART_DM_TF0 = c; + wmb(); +} +early_putc_t *early_putc = qca_msm_early_putc; +#endif + +static platform_method_t ipq4018_methods[] = { + PLATFORMMETHOD(platform_attach, ipq4018_attach), + PLATFORMMETHOD(platform_devmap_init, ipq4018_devmap_init), + PLATFORMMETHOD(platform_late_init, ipq4018_late_init), + PLATFORMMETHOD(platform_cpu_reset, ipq4018_cpu_reset), + +#ifdef SMP + PLATFORMMETHOD(platform_mp_start_ap, ipq4018_mp_start_ap), + PLATFORMMETHOD(platform_mp_setmaxid, ipq4018_mp_setmaxid), +#endif + + PLATFORMMETHOD_END, +}; + +FDT_PLATFORM_DEF2(ipq4018, ipq4018_ac58u, "ASUS RT-AC58U", 0, + "asus,rt-ac58u", 80); diff --git a/sys/arm/qualcomm/ipq4018_machdep.h b/sys/arm/qualcomm/ipq4018_machdep.h new file mode 100644 index 000000000000..8fbd26de14a8 --- /dev/null +++ b/sys/arm/qualcomm/ipq4018_machdep.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef IPQ4018_MACHDEP_H +#define IPQ4018_MACHDEP_H + +#include + +void ipq4018_mp_setmaxid(platform_t plat); +void ipq4018_mp_start_ap(platform_t plat); + +#endif diff --git a/sys/arm/qualcomm/ipq4018_mp.c b/sys/arm/qualcomm/ipq4018_mp.c new file mode 100644 index 000000000000..37b7cc3e097d --- /dev/null +++ b/sys/arm/qualcomm/ipq4018_mp.c @@ -0,0 +1,61 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include "platform_if.h" + +void +ipq4018_mp_setmaxid(platform_t plat) +{ +} + +void +ipq4018_mp_start_ap(platform_t plat) +{ +} diff --git a/sys/arm/qualcomm/ipq4018_reg.h b/sys/arm/qualcomm/ipq4018_reg.h new file mode 100644 index 000000000000..945d650dcfd6 --- /dev/null +++ b/sys/arm/qualcomm/ipq4018_reg.h @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef IPQ4018_REG_H +#define IPQ4018_REG_H + +#define IPQ4018_MEM_SMEM_START 0x87e00000 +#define IPQ4018_MEM_SMEM_SIZE 0x00080000 + +#define IPQ4018_MEM_TZ_START 0x87e80000 +#define IPQ4018_MEM_TZ_SIZE 0x00180000 + +#define IPQ4018_MEM_UART1_START 0x078af000 +#define IPQ4018_MEM_UART1_SIZE 0x00001000 + +#endif diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 new file mode 100644 index 000000000000..9a9801fa6415 --- /dev/null +++ b/sys/arm/qualcomm/std.ipq4018 @@ -0,0 +1,2 @@ +arm/qualcomm/ipq4018_machdep.c standard +arm/qualcomm/ipq4018_mp.c optional smp From nobody Mon Oct 18 19:19:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C6F8617F8351; Mon, 18 Oct 2021 19:19:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BG5Xy7z4cH3; Mon, 18 Oct 2021 19:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9830026027; Mon, 18 Oct 2021 19:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJIUv080207; Mon, 18 Oct 2021 19:19:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJILE080206; Mon, 18 Oct 2021 19:19:18 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:18 GMT Message-Id: <202110181919.19IJJILE080206@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: c29c0e68765f - main - arm: allow the debug stuff in CP14 to be disabled at compile time List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: c29c0e68765f4b98c8507d0dabb976e589b74d4b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=c29c0e68765f4b98c8507d0dabb976e589b74d4b commit c29c0e68765f4b98c8507d0dabb976e589b74d4b Author: Adrian Chadd AuthorDate: 2021-10-16 18:32:08 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:18:56 +0000 arm: allow the debug stuff in CP14 to be disabled at compile time The upcoming QCA ipq401x support detects the CP14 debug features, but any attempt to use it causes an undefined instruction error. It apparently needs a specific TZ image loaded by the early bootloader (SBL) in order to enable these kinds of features. So add a new kernel option that explicitly disables this in the arm code - the debugger works fine without it. --- sys/arm/arm/debug_monitor.c | 5 +++++ sys/conf/options.arm | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/arm/arm/debug_monitor.c b/sys/arm/arm/debug_monitor.c index b73249bedcf1..b9678a5040af 100644 --- a/sys/arm/arm/debug_monitor.c +++ b/sys/arm/arm/debug_monitor.c @@ -960,6 +960,10 @@ vectr_clr: void dbg_monitor_init(void) { +#ifdef ARM_FORCE_DBG_MONITOR_DISABLE + db_printf("ARM Debug Architecture disabled in kernel compilation.\n"); + return; +#else int err; /* Fetch ARM Debug Architecture model */ @@ -1001,6 +1005,7 @@ dbg_monitor_init(void) db_printf("HW Breakpoints/Watchpoints not enabled on CPU%d\n", PCPU_GET(cpuid)); +#endif /* ARM_FORCE_DBG_MONITOR_DISABLE */ } CTASSERT(sizeof(struct dbreg) == sizeof(((struct pcpu *)NULL)->pc_dbreg)); diff --git a/sys/conf/options.arm b/sys/conf/options.arm index 62f1a79fe314..0e5726e9713e 100644 --- a/sys/conf/options.arm +++ b/sys/conf/options.arm @@ -1,6 +1,7 @@ #$FreeBSD$ ARMV6 opt_global.h ARMV7 opt_global.h +ARM_FORCE_DBG_MONITOR_DISABLE opt_ddb.h CPSW_ETHERSWITCH opt_cpsw.h CPU_ARM1176 opt_global.h CPU_CORTEXA opt_global.h From nobody Mon Oct 18 19:19:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C64FE17F836C; Mon, 18 Oct 2021 19:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BK13npz4cN3; Mon, 18 Oct 2021 19:19:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DECDD26028; Mon, 18 Oct 2021 19:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJKWo080262; Mon, 18 Oct 2021 19:19:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJK9F080261; Mon, 18 Oct 2021 19:19:20 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:20 GMT Message-Id: <202110181919.19IJJK9F080261@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: fb7a00772898 - main - arm: add a std.qca for 32 bit armv7 platforms List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: fb7a00772898a6dce16f790e013cbdc7e8591363 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fb7a00772898a6dce16f790e013cbdc7e8591363 commit fb7a00772898a6dce16f790e013cbdc7e8591363 Author: Adrian Chadd AuthorDate: 2021-10-16 18:48:02 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:19:03 +0000 arm: add a std.qca for 32 bit armv7 platforms This is the minimal config required to boot on the IPQ4018 SoC and likely future ones as well in this family. --- sys/arm/conf/std.qca | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sys/arm/conf/std.qca b/sys/arm/conf/std.qca new file mode 100644 index 000000000000..cabd5f309121 --- /dev/null +++ b/sys/arm/conf/std.qca @@ -0,0 +1,28 @@ +# +# QCA SoC support (32 bit) +# + +machine arm armv7 +cpu CPU_CORTEXA +makeoptions CONF_CFLAGS="-march=armv7a" + +files "../qualcomm/std.ipq4018" + +# Serial (COM) ports +device uart +device uart_msm # Qualcomm MSM UART driver + +device gic + +# MMC/SD/SDIO Card slot support +device mmc +device sdhci + +# Timers +device generic_timer +device mpcore_timer + +options FDT + +# Disable CP14 work in DDB as TZ won't let us by default +options ARM_FORCE_DBG_MONITOR_DISABLE From nobody Mon Oct 18 19:19:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2043D17F868C; Mon, 18 Oct 2021 19:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY6BL4fBCz4cVR; Mon, 18 Oct 2021 19:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BA5826029; Mon, 18 Oct 2021 19:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IJJLPQ080286; Mon, 18 Oct 2021 19:19:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IJJLAZ080285; Mon, 18 Oct 2021 19:19:21 GMT (envelope-from git) Date: Mon, 18 Oct 2021 19:19:21 GMT Message-Id: <202110181919.19IJJLAZ080285@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: 015ff812d6b7 - main - ipq4018: add initial IPQ4018/IPQ4019 support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 015ff812d6b7eda57f87789173bad675ca685bb2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=015ff812d6b7eda57f87789173bad675ca685bb2 commit 015ff812d6b7eda57f87789173bad675ca685bb2 Author: Adrian Chadd AuthorDate: 2021-10-16 18:48:37 +0000 Commit: Adrian Chadd CommitDate: 2021-10-18 19:19:06 +0000 ipq4018: add initial IPQ4018/IPQ4019 support Summary: This adds required IPQ4018/IPQ4019 SoC support to boot. It also includes support for disabling the ARMv7 hardware breakpoint / debug stuff at compile time as this is required for the IPQ SoCs, and printing out the undefined instruction itself. Test Plan: * compiled/booted on an IPQ4019 SoC AP Reviewers: #core_team! Subscribers: imp, andrew Differential Revision: https://reviews.freebsd.org/D32538 --- sys/arm/conf/ASUS_AC1300 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sys/arm/conf/ASUS_AC1300 b/sys/arm/conf/ASUS_AC1300 new file mode 100644 index 000000000000..73d3d9f37eb7 --- /dev/null +++ b/sys/arm/conf/ASUS_AC1300 @@ -0,0 +1,52 @@ +# +# ASUS_AC1300 -- Qualcomm kernel configuration file for FreeBSD/arm +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +include "std.armv7" +include "std.qca" + +cpu CPU_CORTEXA +ident ASUS_AC1300 +machine arm armv7 + +# Use a low VA here so we get the early printf stuff working all the +# way up to cninit(). +#options SOCDEV_PA=0x07800000 +#options SOCDEV_VA=0x07800000 +#options EARLY_PRINTF +options BOOTVERBOSE + +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=qcom-ipq4018-rt-ac58u.dts + +options LINUX_BOOT_ABI +options SCHED_ULE +# DEFINITELY not ready for SMP yet! +# options SMP +options PLATFORM + +device loop +device pty +device md +device gpio + +device ether +device mii +device bpf From nobody Mon Oct 18 20:14:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3AD917F7759 for ; Mon, 18 Oct 2021 20:14:31 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY7Pz6Rtxz3LkV for ; Mon, 18 Oct 2021 20:14:31 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f53.google.com with SMTP id t2so43578076wrb.8 for ; Mon, 18 Oct 2021 13:14:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yFHswOQIa+gczhwdN8rjXNDvURoC7ilhOQhfss62qjQ=; b=FQ6VfoXUO6IEClyOsSM9YgxJFA1ad/pN5y1BocBwBdFKA22hXZey63YgWAeWc3RsMo hp0VJKZy8UarkY/i5ZWqe72mz2ajza9RxJfIpApmgrBjPONa8E716C5HVdoVTH+qQZJv vwvxBkFf/Q+R9ae0k3HJrbDRMJfh4P4ZdgmELPhT8+4CQJ84mFWcP16/HEL41W+Wfxk/ STg+V/CYVqzl+p32xmmJlHd7WRxAgYtMR2WO1oRYGcAXyO0o0ViX583WQGaJCl8fxJrR Ky2B1980C1wkqVQjmPIU1XE6NO96C+ImaF9aPLg4Rl8vsqruBlDNdl0mTXUGby6oKMBu ozwQ== X-Gm-Message-State: AOAM533isxveGhdpwMzJBDCadIxlNQaqiM5FbGe5k+g0zEkoGHNj0x5r dVJ/UL/D9c0oS+4stRJzAXANjQ== X-Google-Smtp-Source: ABdhPJy2zzdTAgWUefwkH2k24benHogmGzlya9opOe8970OM+WaPiYptivEtm+8xO4UpwR7P1rR0zA== X-Received: by 2002:a5d:59a3:: with SMTP id p3mr38828102wrr.146.1634588065047; Mon, 18 Oct 2021 13:14:25 -0700 (PDT) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id w5sm13197045wra.87.2021.10.18.13.14.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Oct 2021 13:14:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 8398d52d6541 - main - arm: print out the undefined instruction upon an undefined instruction panic From: Jessica Clarke In-Reply-To: <202110181919.19IJJHws080182@gitrepo.freebsd.org> Date: Mon, 18 Oct 2021 21:14:24 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202110181919.19IJJHws080182@gitrepo.freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HY7Pz6Rtxz3LkV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 18 Oct 2021, at 20:19, Adrian Chadd wrote: >=20 > The branch main has been updated by adrian: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D8398d52d6541d316fcd88c856b5a72bb= 9cce0534 >=20 > commit 8398d52d6541d316fcd88c856b5a72bb9cce0534 > Author: Adrian Chadd > AuthorDate: 2021-10-16 03:15:15 +0000 > Commit: Adrian Chadd > CommitDate: 2021-10-18 19:18:52 +0000 >=20 > arm: print out the undefined instruction upon an undefined = instruction panic >=20 > It's SUPER useful to be able to see the actual undefined = instruction > when we hit said undefined instruction. > --- > sys/arm/arm/undefined.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c > index ef9e72c89163..4e9a5295d338 100644 > --- a/sys/arm/arm/undefined.c > +++ b/sys/arm/arm/undefined.c > @@ -341,7 +341,8 @@ undefinedinstruction(struct trapframe *frame) > return; > } > else > - panic("Undefined instruction in kernel.\n"); > + panic("Undefined instruction in kernel = (0x%08x).\n", > + fault_instruction); As I said in the review, printing this without the PSR_T bit in SPSR isn=E2=80=99t all that helpful, you can=E2=80=99t decode it without = knowing what SPSR is (though you may be able to guess by seeing whether one decoding is total junk and the other might plausibly trap). Jess From nobody Mon Oct 18 20:15:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 67B4417F8117; Mon, 18 Oct 2021 20:15:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY7RX2NKjz3M7x; Mon, 18 Oct 2021 20:15:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id A171A254DA; Mon, 18 Oct 2021 20:15:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 7881db834647 - main - Remove POWER_PM_TYPE_APM. It's now unused. To: Warner Losh Cc: Warner Losh , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202110181445.19IEj36g019473@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Mon, 18 Oct 2021 13:15:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/18/21 9:50 AM, Warner Losh wrote: > On Mon, Oct 18, 2021 at 10:37 AM John Baldwin wrote: > >> On 10/18/21 7:45 AM, Warner Losh wrote: >>> The branch main has been updated by imp: >>> >>> URL: >> https://cgit.FreeBSD.org/src/commit/?id=7881db83464759ba783454d2d2eb1b970e352cd3 >>> >>> commit 7881db83464759ba783454d2d2eb1b970e352cd3 >>> Author: Warner Losh >>> AuthorDate: 2021-10-18 14:41:17 +0000 >>> Commit: Warner Losh >>> CommitDate: 2021-10-18 14:41:17 +0000 >>> >>> Remove POWER_PM_TYPE_APM. It's now unused. >>> >>> Sponsored by: Netflix >>> Reviewed by: markj >>> Differential Revision: https://reviews.freebsd.org/D32549 >>> --- >>> sys/sys/power.h | 1 - >>> 1 file changed, 1 deletion(-) >>> >>> diff --git a/sys/sys/power.h b/sys/sys/power.h >>> index 524bc3fabb24..b0535312d1f7 100644 >>> --- a/sys/sys/power.h >>> +++ b/sys/sys/power.h >>> @@ -34,7 +34,6 @@ >>> #include >>> >>> /* Power management system type */ >>> -#define POWER_PM_TYPE_APM 0x00 >>> #define POWER_PM_TYPE_ACPI 0x01 >>> #define POWER_PM_TYPE_NONE 0xff >> >> Do we want to leave a comment that 0x00 was previously used? I don't know >> if we ever >> exposed this value to userland as part of any ABI? >> > > Good question, but I believe the answer is no. > > power_pm_type is static in sys/kern/subr_power.c. It's only exported from > that module > with power_pm_get_type(). This is only called from acpi.c to make decisions > about > whether or not to load, attach, or identify devices. There's also no sysctl > that publish > this, nor is this value used in userland in base. The whole sys/power.h > file has the look > of an internal kernel file because there's no #ifdef _KERNEL section around > all the > prototypes it defines. > > Have I missed something? No, that sounds about right. -- John Baldwin From nobody Mon Oct 18 21:22:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A30B517F645E; Mon, 18 Oct 2021 21:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY8wy4B7Sz4R1B; Mon, 18 Oct 2021 21:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F45427D2A; Mon, 18 Oct 2021 21:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19ILMwef055255; Mon, 18 Oct 2021 21:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19ILMw77055254; Mon, 18 Oct 2021 21:22:58 GMT (envelope-from git) Date: Mon, 18 Oct 2021 21:22:58 GMT Message-Id: <202110182122.19ILMw77055254@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: e1d6d6f9249d - main - lorder: process read-only data symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1d6d6f9249d37c10a0df68024c7dacebdc7bf98 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e1d6d6f9249d37c10a0df68024c7dacebdc7bf98 commit e1d6d6f9249d37c10a0df68024c7dacebdc7bf98 Author: Ed Maste AuthorDate: 2021-10-18 21:19:53 +0000 Commit: Ed Maste CommitDate: 2021-10-18 21:21:17 +0000 lorder: process read-only data symbols Previously they were skipped. lorder(1) serves no functional purpose today but we might as well address this longstanding bug while it is still in the tree. PR: 133860 MFC after: 1 week Submitted by: John Hein --- usr.bin/lorder/lorder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh index 390b0b7fe845..676f8995fc92 100644 --- a/usr.bin/lorder/lorder.sh +++ b/usr.bin/lorder/lorder.sh @@ -57,14 +57,14 @@ for i in $*; do echo $i $i done -# if the line has " [TDW] " it's a globally defined symbol, put it +# if the line has " [RTDW] " it's a globally defined symbol, put it # into the symbol file. # # if the line has " U " it's a globally undefined symbol, put it into # the reference file. ${NM} ${NMFLAGS} -go $* | sed " - / [TDW] / { - s/:.* [TDW] / / + / [RTDW] / { + s/:.* [RTDW] / / w $S d } From nobody Mon Oct 18 22:03:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9D67C1807674; Mon, 18 Oct 2021 22:03: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY9qs3mG0z4cgH; Mon, 18 Oct 2021 22:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 610FA1D2; Mon, 18 Oct 2021 22:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IM3b1Y008927; Mon, 18 Oct 2021 22:03:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IM3bCs008926; Mon, 18 Oct 2021 22:03:37 GMT (envelope-from git) Date: Mon, 18 Oct 2021 22:03:37 GMT Message-Id: <202110182203.19IM3bCs008926@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: 73dddffc3175 - main - crt_malloc: more accurate handling of mmap(2) failure List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73dddffc3175581ba99f6ced9a2e508a0e880e59 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=73dddffc3175581ba99f6ced9a2e508a0e880e59 commit 73dddffc3175581ba99f6ced9a2e508a0e880e59 Author: Konstantin Belousov AuthorDate: 2021-10-15 17:59:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-18 22:02:47 +0000 crt_malloc: more accurate handling of mmap(2) failure Reset both pagepool_start and pagepool_end after a mmap(2) failure, to avoid using invalid pagepool either for allocation or munmap(2). PR: 259076 Noted by: Denis Koreshkov Reviewed by: arichardson Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32514 --- libexec/rtld-elf/rtld_malloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index 64218b5bb786..63fa6f5e2ee7 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -271,21 +271,21 @@ morepages(int n) } } - if (pagepool_start == MAP_FAILED) - pagepool_start = 0; offset = (uintptr_t)pagepool_start - rounddown2( (uintptr_t)pagepool_start, pagesz); - pagepool_start = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, + addr = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); - if (pagepool_start == MAP_FAILED) { + if (addr == MAP_FAILED) { #ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: " "cannot mmap anonymous memory: %s\n", rtld_strerror(errno)); #endif + pagepool_start = pagepool_end = NULL; return (0); } + pagepool_start = addr; pagepool_end = pagepool_start + n * pagesz; pagepool_start += offset; From nobody Mon Oct 18 22:09:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 39772180AC81; Mon, 18 Oct 2021 22:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HY9z96z4Hz4fbl; Mon, 18 Oct 2021 22:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB7CD5B1; Mon, 18 Oct 2021 22:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19IM9vm7009649; Mon, 18 Oct 2021 22:09:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19IM9vUl009648; Mon, 18 Oct 2021 22:09:57 GMT (envelope-from git) Date: Mon, 18 Oct 2021 22:09:57 GMT Message-Id: <202110182209.19IM9vUl009648@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: 52dee2bc0355 - main - nfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52dee2bc035545f7ae2b838d8a0449f65043cd8a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=52dee2bc035545f7ae2b838d8a0449f65043cd8a commit 52dee2bc035545f7ae2b838d8a0449f65043cd8a Author: Rick Macklem AuthorDate: 2021-10-18 22:02:21 +0000 Commit: Rick Macklem CommitDate: 2021-10-18 22:05:34 +0000 nfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better Without this patch, if a NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation, the client loops retrying the Close while holding a shared lock on the clientID. This shared lock blocks returns of delegations, even though the server has issued a CB_RECALL to request the delegation return. This patch delays doing a retry of a Close that received a reply of NFSERR_DELAY until after the shared lock on the clientID is released, for NFSv4.1/4.2. To fix this for NFSv4.0 would be very difficult and since the only known NFSv4 server to reply NFSERR_DELAY to Close only does NFSv4.1/4.2, this fix is hoped to be sufficient. This problem was detected during a recent IETF working group NFSv4 testing event. MFC after: 2 week --- sys/fs/nfs/nfs_var.h | 3 ++- sys/fs/nfsclient/nfs_clrpcops.c | 11 +++++++---- sys/fs/nfsclient/nfs_clstate.c | 23 +++++++++++++++++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 3f0fbc535166..7f0ca990540d 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -604,7 +604,8 @@ void nfscl_dumpstate(struct nfsmount *, int, int, int, int); void nfscl_dupopen(vnode_t, int); int nfscl_getclose(vnode_t, struct nfsclclient **); int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); -void nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, 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 **); void nfscl_lockinit(struct nfsv4lock *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 6b6fdc03441f..fa0df1c37261 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -760,8 +760,9 @@ nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) /* * Close the open. */ -void -nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) +int +nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p, + bool loop_on_delayed, bool freeop) { struct nfsrv_descript nfsd, *nd = &nfsd; struct nfscllockowner *lp, *nlp; @@ -840,7 +841,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR); NFSUNLOCKCLSTATE(); do { - error = nfscl_tryclose(op, tcred, nmp, p, true); + error = nfscl_tryclose(op, tcred, nmp, p, loop_on_delayed); if (error == NFSERR_GRACE) (void) nfs_catnap(PZERO, error, "nfs_close"); } while (error == NFSERR_GRACE); @@ -849,9 +850,11 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) nfscl_freelockowner(lp, 0); - nfscl_freeopen(op, 0, true); + if (freeop && error != NFSERR_DELAY) + nfscl_freeopen(op, 0, true); NFSUNLOCKCLSTATE(); NFSFREECRED(tcred); + return (error); } /* diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 7ad0f1c1a364..36f8bbd6b51f 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3327,8 +3327,10 @@ int nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) { struct nfsclclient *clp; + struct nfsmount *nmp; struct nfsclowner *owp, *nowp; - struct nfsclopen *op; + struct nfsclopen *op, *nop; + struct nfsclopenhead delayed; struct nfscldeleg *dp; struct nfsfh *nfhp; struct nfsclrecalllayout *recallp; @@ -3339,6 +3341,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) return (error); *clpp = clp; + nmp = VFSTONFS(vp->v_mount); nfhp = VTONFS(vp)->n_fhp; recallp = malloc(sizeof(*recallp), M_NFSLAYRECALL, M_WAITOK); NFSLOCKCLSTATE(); @@ -3363,6 +3366,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp); /* Now process the opens against the server. */ + LIST_INIT(&delayed); lookformore: LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), nfso_hash) { @@ -3376,8 +3380,16 @@ lookformore: op->nfso_opencnt)); #endif NFSUNLOCKCLSTATE(); - nfsrpc_doclose(VFSTONFS(vp->v_mount), op, p); + if (NFSHASNFSV4N(nmp)) + error = nfsrpc_doclose(nmp, op, p, false, true); + else + error = nfsrpc_doclose(nmp, op, p, true, true); NFSLOCKCLSTATE(); + if (error == NFSERR_DELAY) { + nfscl_unlinkopen(op); + op->nfso_own = NULL; + LIST_INSERT_HEAD(&delayed, op, nfso_list); + } goto lookformore; } } @@ -3388,6 +3400,13 @@ lookformore: * used by the function, but calling free() with a NULL pointer is ok. */ free(recallp, M_NFSLAYRECALL); + + /* Now, loop retrying the delayed closes. */ + LIST_FOREACH_SAFE(op, &delayed, nfso_list, nop) { + nfsrpc_doclose(nmp, op, p, true, false); + LIST_REMOVE(op, nfso_list); + nfscl_freeopen(op, 0, false); + } return (0); } From nobody Mon Oct 18 23:35:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6015818070A8; Mon, 18 Oct 2021 23:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYCsc2Bhhz3Kbp; Mon, 18 Oct 2021 23:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C19D14F5; Mon, 18 Oct 2021 23:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19INZGkH028731; Mon, 18 Oct 2021 23:35:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19INZGYA028730; Mon, 18 Oct 2021 23:35:16 GMT (envelope-from git) Date: Mon, 18 Oct 2021 23:35:16 GMT Message-Id: <202110182335.19INZGYA028730@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: 1a724aa97265 - main - Makefile.inc1: remove lorder from build/cross tools List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a724aa97265c9023d2aa69b444b46c4f7c5d9f2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1a724aa97265c9023d2aa69b444b46c4f7c5d9f2 commit 1a724aa97265c9023d2aa69b444b46c4f7c5d9f2 Author: Ed Maste AuthorDate: 2021-10-18 20:27:34 +0000 Commit: Ed Maste CommitDate: 2021-10-18 23:29:22 +0000 Makefile.inc1: remove lorder from build/cross tools As lorder is not used by the base system build there is no need to include it in bootstrap-tools or NXBDIRS. Fixes: 0e1e341b486c ("Stop using lorder and ranlib when...") Sponsored by: The FreeBSD Foundation --- Makefile.inc1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 86d2fe58a0d8..423bc00b3f29 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2500,7 +2500,6 @@ bootstrap-tools: ${_bt}-links .PHONY ${_cat} \ ${_kbdcontrol} \ ${_elftoolchain_libs} \ - usr.bin/lorder \ lib/libopenbsd \ usr.bin/mandoc \ usr.bin/rpcgen \ @@ -2732,7 +2731,6 @@ NXBDIRS+= \ usr.bin/id \ usr.bin/lex \ usr.bin/limits \ - usr.bin/lorder \ usr.bin/mandoc \ usr.bin/mktemp \ usr.bin/mt \ From nobody Tue Oct 19 03:36:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 964AD1803274; Tue, 19 Oct 2021 03:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYKCy3c0Qz56lC; Tue, 19 Oct 2021 03:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B7CB4B63; Tue, 19 Oct 2021 03:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J3aUeq048274; Tue, 19 Oct 2021 03:36:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J3aUcW048273; Tue, 19 Oct 2021 03:36:30 GMT (envelope-from git) Date: Tue, 19 Oct 2021 03:36:30 GMT Message-Id: <202110190336.19J3aUcW048273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 16f3a89d08b2 - stable/12 - nfscl: Fix a deadlock related to the NFSv4 clientID lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 16f3a89d08b2deffccace6f605a9e9883cfbd4e2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=16f3a89d08b2deffccace6f605a9e9883cfbd4e2 commit 16f3a89d08b2deffccace6f605a9e9883cfbd4e2 Author: Rick Macklem AuthorDate: 2021-10-12 04:58:24 +0000 Commit: Rick Macklem CommitDate: 2021-10-19 03:31:47 +0000 nfscl: Fix a deadlock related to the NFSv4 clientID lock Without this patch, it is possible for a process doing an NFSv4 Open/create of a file to block to allow another process to acquire the exclusive lock on the clientID when holding a shared lock on the clientID. As such, both processes deadlock, with one wanting the exclusive lock, while the other holds the shared lock. This deadlock is unlikely to occur unless delegations are in use on the NFSv4 mount. This patch fixes the problem by not deferring to the process waiting for the exclusive lock when a shared lock (reference cnt) is already held by the process. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit 120b20bdf49630cf2a7dbc5f93b9e985e1f4f198) --- sys/fs/nfs/nfs_var.h | 4 ++-- sys/fs/nfsclient/nfs_clrpcops.c | 12 ++++++------ sys/fs/nfsclient/nfs_clstate.c | 29 ++++++++++++++++------------- sys/fs/nfsclient/nfs_clvfsops.c | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 0f656601e531..5177a1c2c065 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -540,13 +540,13 @@ void nfsrpc_bindconnsess(CLIENT *, void *, struct ucred *); /* nfs_clstate.c */ int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **, - int *, int *, int); + int *, int *, int, bool); int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, nfsv4stateid_t *, void **); void nfscl_ownerrelease(struct nfsmount *, struct nfsclowner *, int, int, int); void nfscl_openrelease(struct nfsmount *, struct nfsclopen *, int, int); int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, int, - struct nfsclclient **); + bool, struct nfsclclient **); struct nfsclclient *nfscl_findcl(struct nfsmount *); void nfscl_clientrelease(struct nfsclclient *); void nfscl_freelock(struct nfscllock *, int); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 3ff23a8b147b..3d26a1dfda88 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -365,7 +365,7 @@ else printf(" fhl=0\n"); do { dp = NULL; error = nfscl_open(vp, nfhp->nfh_fh, nfhp->nfh_len, mode, 1, - cred, p, NULL, &op, &newone, &ret, 1); + cred, p, NULL, &op, &newone, &ret, 1, true); if (error) { return (error); } @@ -1997,7 +1997,7 @@ nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, dp = NULL; error = nfscl_open(dvp, NULL, 0, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, cred, p, &owp, NULL, &newone, - NULL, 1); + NULL, 1, true); if (error) return (error); if (nmp->nm_clp != NULL) @@ -2283,7 +2283,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ error = nfscl_open(dvp, nfhp->nfh_fh, nfhp->nfh_len, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, - cred, p, NULL, &op, &newone, NULL, 0); + cred, p, NULL, &op, &newone, NULL, 0, false); if (error) goto nfsmout; op->nfso_stateid = stateid; @@ -3886,7 +3886,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, do { nd->nd_repstat = 0; if (op == F_GETLK) { - error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), cred, p, 1, true, &clp); if (error) return (error); error = nfscl_lockt(vp, clp, off, len, fl, p, id, flags); @@ -3903,7 +3903,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, * We must loop around for all lockowner cases. */ callcnt = 0; - error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), cred, p, 1, true, &clp); if (error) return (error); do { @@ -7537,7 +7537,7 @@ nfsrpc_createlayout(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ error = nfscl_open(dvp, nfhp->nfh_fh, nfhp->nfh_len, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, - cred, p, NULL, &op, &newone, NULL, 0); + cred, p, NULL, &op, &newone, NULL, 0, false); if (error != 0) goto nfsmout; op->nfso_stateid = stateid; diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 9965b7ca7e4f..92688fcfbe28 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -213,7 +213,7 @@ static short *nfscl_cberrmap[] = { int nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, struct ucred *cred, NFSPROC_T *p, struct nfsclowner **owpp, - struct nfsclopen **opp, int *newonep, int *retp, int lockit) + struct nfsclopen **opp, int *newonep, int *retp, int lockit, bool firstref) { struct nfsclclient *clp; struct nfsclowner *owp, *nowp; @@ -239,7 +239,7 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, if (nfhp != NULL) nop = malloc(sizeof (struct nfsclopen) + fhlen - 1, M_NFSCLOPEN, M_WAITOK); - ret = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); + ret = nfscl_getcl(vnode_mount(vp), cred, p, 1, firstref, &clp); if (ret != 0) { free(nowp, M_NFSCLOWNER); if (nop != NULL) @@ -778,7 +778,7 @@ nfscl_openrelease(struct nfsmount *nmp, struct nfsclopen *op, int error, */ int nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, - int start_renewthread, struct nfsclclient **clpp) + int start_renewthread, bool firstref, struct nfsclclient **clpp) { struct nfsclclient *clp; struct nfsclclient *newclp = NULL; @@ -850,14 +850,16 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, NFSCLSTATEMUTEXPTR, mp); if (igotlock == 0) { /* - * Call nfsv4_lock() with "iwantlock == 0" so that it will - * wait for a pending exclusive lock request. This gives the - * exclusive lock request priority over this shared lock - * request. + * Call nfsv4_lock() with "iwantlock == 0" on the firstref so + * that it will wait for a pending exclusive lock request. + * This gives the exclusive lock request priority over this + * shared lock request. * An exclusive lock on nfsc_lock is used mainly for server - * crash recoveries. + * crash recoveries and delegation recalls. */ - nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); + if (firstref) + nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, + mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); } if (igotlock == 0 && NFSCL_FORCEDISM(mp)) { @@ -1032,7 +1034,8 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, if (recovery) clp = rclp; else - error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), cred, p, 1, true, + &clp); } if (error) { free(nlp, M_NFSCLLOCKOWNER); @@ -1370,7 +1373,7 @@ nfscl_checkwritelocked(vnode_t vp, struct flock *fl, end = NFS64BITSSET; } - error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), cred, p, 1, true, &clp); if (error) return (1); nfscl_filllockowner(id, own, flags); @@ -3140,7 +3143,7 @@ nfscl_getclose(vnode_t vp, struct nfsclclient **clpp) struct nfsfh *nfhp; int error, notdecr; - error = nfscl_getcl(vnode_mount(vp), NULL, NULL, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), NULL, NULL, 1, true, &clp); if (error) return (error); *clpp = clp; @@ -3215,7 +3218,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) struct nfsclrecalllayout *recallp; int error; - error = nfscl_getcl(vnode_mount(vp), NULL, NULL, 1, &clp); + error = nfscl_getcl(vnode_mount(vp), NULL, NULL, 1, true, &clp); if (error) return (error); *clpp = clp; diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 1a1e1b122994..49a08e3787b4 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1524,7 +1524,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, /* For NFSv4.1, get the clientid now. */ if (nmp->nm_minorvers > 0) { NFSCL_DEBUG(3, "at getcl\n"); - error = nfscl_getcl(mp, cred, td, 0, &clp); + error = nfscl_getcl(mp, cred, td, 0, true, &clp); NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; From nobody Tue Oct 19 03:49:49 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 26AFE1808BBC; Tue, 19 Oct 2021 03:49: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYKWL0Ky6z59NZ; Tue, 19 Oct 2021 03:49:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E03E751A4; Tue, 19 Oct 2021 03:49:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J3nn51062150; Tue, 19 Oct 2021 03:49:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J3nnGH062149; Tue, 19 Oct 2021 03:49:49 GMT (envelope-from git) Date: Tue, 19 Oct 2021 03:49:49 GMT Message-Id: <202110190349.19J3nnGH062149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 75d71cf8df8c - stable/12 - nfscl: Fix another deadlock related to the NFSv4 clientID lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 75d71cf8df8c83b2b2bc3a16ef66a540a2ebac70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=75d71cf8df8c83b2b2bc3a16ef66a540a2ebac70 commit 75d71cf8df8c83b2b2bc3a16ef66a540a2ebac70 Author: Rick Macklem AuthorDate: 2021-10-13 00:21:01 +0000 Commit: Rick Macklem CommitDate: 2021-10-19 03:46:00 +0000 nfscl: Fix another deadlock related to the NFSv4 clientID lock Without this patch, it is possible to hang the NFSv4 client, when a rename/remove is being done on a file where the client holds a delegation, if pNFS is being used. For a delegation to be returned, dirty data blocks must be flushed to the NFSv4 server. When pNFS is in use, a shared lock on the clientID must be acquired while doing a write to the DS(s). However, if rename/remove is doing the delegation return an exclusive lock will be acquired on the clientID, preventing the write to the DS(s) from acquiring a shared lock on the clientID. This patch stops rename/remove from doing a delegation return if pNFS is enabled. Since doing delegation return in the same compound as rename/remove is only an optimization, not doing so should not cause problems. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit b82168e657d378ff86ea18c4f03b98aac9ee9bb3) --- sys/fs/nfsclient/nfs_clstate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 92688fcfbe28..5f35e4e708e9 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4480,6 +4480,8 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; nmp = VFSTONFS(vnode_mount(vp)); + if (NFSHASPNFS(nmp)) + return (retcnt); np = VTONFS(vp); NFSLOCKCLSTATE(); /* @@ -4579,6 +4581,8 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, nmp = VFSTONFS(vnode_mount(fvp)); *gotfdp = 0; *gottdp = 0; + if (NFSHASPNFS(nmp)) + return (retcnt); NFSLOCKCLSTATE(); /* * Loop around waiting for: From nobody Tue Oct 19 04:41:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0A86017F6034; Tue, 19 Oct 2021 04:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYLfX6s5Rz3Qfh; Tue, 19 Oct 2021 04:41:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB4805C33; Tue, 19 Oct 2021 04:41:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J4f8tf038012; Tue, 19 Oct 2021 04:41:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J4f8pi038011; Tue, 19 Oct 2021 04:41:08 GMT (envelope-from git) Date: Tue, 19 Oct 2021 04:41:08 GMT Message-Id: <202110190441.19J4f8pi038011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: bad324ace4f8 - main - devd(8): Note default config file search locations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bad324ace4f817206baf86ae7379c35c8199048e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bad324ace4f817206baf86ae7379c35c8199048e commit bad324ace4f817206baf86ae7379c35c8199048e Author: Felix Johnson AuthorDate: 2021-10-19 04:37:40 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-19 04:37:40 +0000 devd(8): Note default config file search locations PR: 197003 MFC after: 3 days Reported by: Harald Schmalzbauer --- sbin/devd/devd.8 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sbin/devd/devd.8 b/sbin/devd/devd.8 index fa05db734b88..77c8e4aac2fb 100644 --- a/sbin/devd/devd.8 +++ b/sbin/devd/devd.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 19, 2021 .Dt DEVD 8 .Os .Sh NAME @@ -115,10 +115,16 @@ option and uses that file to drive the rest of the process. While the format of this file is described in .Xr devd.conf 5 , some basics are covered here. +.Pp In the .Ic options section, one can define multiple directories to search for config files. +The default config file specifies +.Pa /etc/devd +and +.Pa /usr/local/etc/devd +as directories to search. All files in these directories whose names match the pattern .Pa *.conf are parsed. From nobody Tue Oct 19 05:27:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0E0551809787; Tue, 19 Oct 2021 05:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYMhD6z0kz3ssQ; Tue, 19 Oct 2021 05:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D12F866DD; Tue, 19 Oct 2021 05:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J5Reab095095; Tue, 19 Oct 2021 05:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J5Re4S095094; Tue, 19 Oct 2021 05:27:40 GMT (envelope-from git) Date: Tue, 19 Oct 2021 05:27:40 GMT Message-Id: <202110190527.19J5Re4S095094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 17ef4736e28d - stable/13 - Fix two typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 17ef4736e28d168f30105e7a27c821f7211f1f9a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=17ef4736e28d168f30105e7a27c821f7211f1f9a commit 17ef4736e28d168f30105e7a27c821f7211f1f9a Author: Gordon Bergling AuthorDate: 2021-10-16 06:09:31 +0000 Commit: Gordon Bergling CommitDate: 2021-10-19 05:27:21 +0000 Fix two typos in source code comments - s/alocated/allocated/ - s/realocated/reallocated/ (cherry picked from commit 899a3b38f5172d70360396caeebb5b694638282e) --- sys/dev/extres/clk/clk.c | 2 +- sys/dev/mlx4/mlx4_en/mlx4_en_rx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c index b26158922d74..b1522eb1d4c2 100644 --- a/sys/dev/extres/clk/clk.c +++ b/sys/dev/extres/clk/clk.c @@ -1517,7 +1517,7 @@ clk_get_by_ofw_name(device_t dev, phandle_t cnode, const char *name, clk_t *clk) /* * Get "clock-output-names" and (optional) "clock-indices" lists. - * Both lists are alocated using M_OFWPROP specifier. + * Both lists are allocated using M_OFWPROP specifier. * * Returns number of items or 0. */ diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c index 9e6f4df107bd..8e7c410d1c55 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c @@ -857,7 +857,7 @@ out: mlx4_cq_set_ci(mcq); wmb(); /* ensure HW sees CQ consumer before we post new buffers */ ring->cons = mcq->cons_index; - ring->prod += polled; /* Polled descriptors were realocated in place */ + ring->prod += polled; /* Polled descriptors were reallocated in place */ mlx4_en_update_rx_prod_db(ring); return polled; From nobody Tue Oct 19 05:35:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F1A04180E389; Tue, 19 Oct 2021 05:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYMrv4P7Sz3wJV; Tue, 19 Oct 2021 05:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B70267E8; Tue, 19 Oct 2021 05:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J5ZB33008673; Tue, 19 Oct 2021 05:35:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J5ZBtA008672; Tue, 19 Oct 2021 05:35:11 GMT (envelope-from git) Date: Tue, 19 Oct 2021 05:35:11 GMT Message-Id: <202110190535.19J5ZBtA008672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 2a69f6e99655 - stable/12 - Fix two typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2a69f6e99655e0ce995baf0574ebf7005be0241d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2a69f6e99655e0ce995baf0574ebf7005be0241d commit 2a69f6e99655e0ce995baf0574ebf7005be0241d Author: Gordon Bergling AuthorDate: 2021-10-16 06:09:31 +0000 Commit: Gordon Bergling CommitDate: 2021-10-19 05:28:08 +0000 Fix two typos in source code comments - s/alocated/allocated/ - s/realocated/reallocated/ (cherry picked from commit 899a3b38f5172d70360396caeebb5b694638282e) --- sys/dev/extres/clk/clk.c | 2 +- sys/dev/mlx4/mlx4_en/mlx4_en_rx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c index 172661587d00..1dec2050ddb0 100644 --- a/sys/dev/extres/clk/clk.c +++ b/sys/dev/extres/clk/clk.c @@ -1517,7 +1517,7 @@ clk_get_by_ofw_name(device_t dev, phandle_t cnode, const char *name, clk_t *clk) /* * Get "clock-output-names" and (optional) "clock-indices" lists. - * Both lists are alocated using M_OFWPROP specifier. + * Both lists are allocated using M_OFWPROP specifier. * * Returns number of items or 0. */ diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c index c9222e1df55c..40df00c05882 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c @@ -857,7 +857,7 @@ out: mlx4_cq_set_ci(mcq); wmb(); /* ensure HW sees CQ consumer before we post new buffers */ ring->cons = mcq->cons_index; - ring->prod += polled; /* Polled descriptors were realocated in place */ + ring->prod += polled; /* Polled descriptors were reallocated in place */ mlx4_en_update_rx_prod_db(ring); return polled; From nobody Tue Oct 19 07:38:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4D4B317F08BD; Tue, 19 Oct 2021 07:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYQZw1SpGz3DDY; Tue, 19 Oct 2021 07:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1191310428; Tue, 19 Oct 2021 07:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19J7cFIH067995; Tue, 19 Oct 2021 07:38:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19J7cFtw067994; Tue, 19 Oct 2021 07:38:15 GMT (envelope-from git) Date: Tue, 19 Oct 2021 07:38:15 GMT Message-Id: <202110190738.19J7cFtw067994@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: 225639e7db68 - main - vt: Disable bell by default List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 225639e7db685a4047e384abdbc296c0e02bd147 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 commit 225639e7db685a4047e384abdbc296c0e02bd147 Author: Emmanuel Vadot AuthorDate: 2021-10-18 08:16:41 +0000 Commit: Emmanuel Vadot CommitDate: 2021-10-19 07:37:28 +0000 vt: Disable bell by default Bell is either useless if you're working on remote servers or really annoying when you're working with a local machine that have a loud buzzer. Switch the default to have it disable. Reviewed by: imp, pstef, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D32543 --- sys/dev/vt/vt_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index fac1ad898db9..075b23597f68 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -127,7 +127,7 @@ const struct terminal_class vt_termclass = { static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "vt(9) parameters"); static VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as Alt)"); -static VT_SYSCTL_INT(enable_bell, 1, "Enable bell"); +static VT_SYSCTL_INT(enable_bell, 0, "Enable bell"); static VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); static VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); static VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); From nobody Tue Oct 19 11:21:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3707918140BC; Tue, 19 Oct 2021 11:21:43 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYWXk6snwz3Ltv; Tue, 19 Oct 2021 11:21:42 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mcnBV-000K7D-1z; Tue, 19 Oct 2021 14:21:33 +0300 Date: Tue, 19 Oct 2021 14:21:33 +0300 From: Slawa Olhovchenkov To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211019112132.GC80160@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HYWXk6snwz3Ltv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > Author: Emmanuel Vadot > AuthorDate: 2021-10-18 08:16:41 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-10-19 07:37:28 +0000 > > vt: Disable bell by default > > Bell is either useless if you're working on remote servers or really annoying > when you're working with a local machine that have a loud buzzer. > Switch the default to have it disable. For you, not for me, for example. Also, this is violate POLA. From nobody Tue Oct 19 11:37:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0811617F130E; Tue, 19 Oct 2021 11:37:04 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYWtR3bxkz3PvD; Tue, 19 Oct 2021 11:37:03 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634643421; 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=hbUTVnIqweqxR9wR98qFMFOIYq4upR/vXIaNSZzQ2CI=; b=q+N1Wi3Av/BeRLdJN4dVkSGetUwnFRpwCd8xLhc+myR+sAP+ex+82tmk/V4tX/tcODZHUT 7iJfTTtVkCOOlsd/d+hWEo/AbGry1J7mFMT6icRt1LsabwDqrYeehcdcKsIiJjT2Q3kK4e xIDgIJMA7cSunhruwDviYr5I118z260= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id dc38d4a5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 19 Oct 2021 11:37:01 +0000 (UTC) Date: Tue, 19 Oct 2021 13:37:00 +0200 From: Emmanuel Vadot To: Slawa Olhovchenkov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> In-Reply-To: <20211019112132.GC80160@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HYWtR3bxkz3PvD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, 19 Oct 2021 14:21:33 +0300 Slawa Olhovchenkov wrote: > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > Author: Emmanuel Vadot > > AuthorDate: 2021-10-18 08:16:41 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-10-19 07:37:28 +0000 > > > > vt: Disable bell by default > > > > Bell is either useless if you're working on remote servers or really annoying > > when you're working with a local machine that have a loud buzzer. > > Switch the default to have it disable. > > For you, not for me, for example. Also, this is violate POLA. Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be happy again. I'll do some UPDATING note. And POLA doesn't means that we can't change a thing. -- Emmanuel Vadot From nobody Tue Oct 19 11:53:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6E03B17F9D86; Tue, 19 Oct 2021 11:53:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::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) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYXFh275Wz3kxZ; Tue, 19 Oct 2021 11:53:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from [10.36.2.165] (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id CBD58260258; Tue, 19 Oct 2021 13:53:41 +0200 (CEST) Message-ID: <4bc59b6c-e35e-3bca-a004-aa2f862f652e@selasky.org> Date: Tue, 19 Oct 2021 13:53:27 +0200 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Content-Language: en-US To: Emmanuel Vadot , Slawa Olhovchenkov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> From: Hans Petter Selasky In-Reply-To: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HYXFh275Wz3kxZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On 10/19/21 13:37, Emmanuel Vadot wrote: > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > happy again. I'll do some UPDATING note. > And POLA doesn't means that we can't change a thing. Is this option also RDTUN ? Can it be set in /boot/loader.conf too? --HPS From nobody Tue Oct 19 11:54:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 41EF617FA4B9 for ; Tue, 19 Oct 2021 11:54:50 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYXGy19nFz3ldm for ; Tue, 19 Oct 2021 11:54:50 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f52.google.com with SMTP id o24so4224151wms.0 for ; Tue, 19 Oct 2021 04:54:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZoFvz5aff9MBY286iB2wbm1p4roBgPxylSwEUfFqVJQ=; b=0QtvPG7CoDSAEV6BAsd7svBYxthDOw2LAN8SVH1mPXlQQwtoPRfweK4ZBY/0PU/ZRl srvEERqb3lVHG9ZB2W80ETXrgKgLqJV0azQRzgAEMJ3IN+Y5zzSIoHSpZUKZjQvn8Xkz 3jUkhjDZ3Y+BZQpNXEFf2f5HHC7HBQybImQW2NXcT+d9fox46Jzg5SAUdP2FYSE7W97w E01KUPk07W/jXjTW2rkN5qd2zxSwedy+3uZsLsLjrZObDcUqKx2mGVcDwqAg0TPOPXLM +bkQNMB98Gxa2WLB0SiTK8V0/SawHBvKPE8KrYRIU+3wVLlGYRngzFfoxotJ+Blu75wb tdSw== X-Gm-Message-State: AOAM532ALKuNpFieOnm+vzPEZvR0CQUJjhokmkOAbuxfcA2ePpSaIKI+ FOBVYbuwz9nTsi/Vs89dlgyfIg== X-Google-Smtp-Source: ABdhPJz7mi1Wd7fd2I4qkmJNbaig+2fgTS2+vrWSVOdCeCKlLV3BscejF8ReKhr2Qn9JJMaBY69XDw== X-Received: by 2002:a1c:7f56:: with SMTP id a83mr5787131wmd.20.1634644483414; Tue, 19 Oct 2021 04:54:43 -0700 (PDT) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id q12sm11444722wrp.13.2021.10.19.04.54.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Oct 2021 04:54:43 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default From: Jessica Clarke In-Reply-To: <4bc59b6c-e35e-3bca-a004-aa2f862f652e@selasky.org> Date: Tue, 19 Oct 2021 12:54:42 +0100 Cc: Emmanuel Vadot , Slawa Olhovchenkov , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <51B79717-E927-472A-86FC-A6293E28048D@freebsd.org> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <4bc59b6c-e35e-3bca-a004-aa2f862f652e@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HYXGy19nFz3ldm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 19 Oct 2021, at 12:53, Hans Petter Selasky wrote: >=20 > On 10/19/21 13:37, Emmanuel Vadot wrote: >> Just set kern.vt.enable_bell=3D1 in /etc/sysctl.conf and you will be >> happy again. I'll do some UPDATING note. >> And POLA doesn't means that we can't change a thing. >=20 > Is this option also RDTUN ? Can it be set in /boot/loader.conf too? It=E2=80=99s RWTUN. Jess From nobody Tue Oct 19 12:04:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9DBED17FD572; Tue, 19 Oct 2021 12:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYXV33gJ8z3nYc; Tue, 19 Oct 2021 12:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D99213F8E; Tue, 19 Oct 2021 12:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JC4Rcv029674; Tue, 19 Oct 2021 12:04:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JC4Ru4029673; Tue, 19 Oct 2021 12:04:27 GMT (envelope-from git) Date: Tue, 19 Oct 2021 12:04:27 GMT Message-Id: <202110191204.19JC4Ru4029673@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: bcd4c17ccaac - main - pf: fix some cc --analyze warnings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcd4c17ccaacf995224882dc1d05e2a51867bdf2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=bcd4c17ccaacf995224882dc1d05e2a51867bdf2 commit bcd4c17ccaacf995224882dc1d05e2a51867bdf2 Author: Mateusz Guzik AuthorDate: 2021-10-19 11:57:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-19 11:59:11 +0000 pf: fix some cc --analyze warnings Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/if_pfsync.c | 2 +- sys/netpfil/pf/pf_ioctl.c | 2 +- sys/netpfil/pf/pf_norm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 7208444d65d7..e959fdbc8553 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -2474,7 +2474,7 @@ VNET_SYSINIT(vnet_pfsync_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, static void vnet_pfsync_uninit(const void *unused __unused) { - int ret; + int ret __diagused; pfsync_pointers_uninit(); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 89ab2b08c64a..ee265de65b45 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5612,7 +5612,7 @@ hook_pf(void) { struct pfil_hook_args pha; struct pfil_link_args pla; - int ret; + int ret __diagused; if (V_pf_pfil_hooked) return; diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 796d445607e7..8e14fa35bf59 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -1002,7 +1002,7 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag) DPFPRINTF(("refragment error %d\n", error)); action = PF_DROP; } - for (t = m; m; m = t) { + for (; m; m = t) { t = m->m_nextpkt; m->m_nextpkt = NULL; m->m_flags |= M_SKIP_FIREWALL; From nobody Tue Oct 19 13:19:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9C72A17FFD47; Tue, 19 Oct 2021 13:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYZ8M41Dbz4fd3; Tue, 19 Oct 2021 13:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AACE14C96; Tue, 19 Oct 2021 13:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JDJF4O023166; Tue, 19 Oct 2021 13:19:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JDJFtk023165; Tue, 19 Oct 2021 13:19:15 GMT (envelope-from git) Date: Tue, 19 Oct 2021 13:19:15 GMT Message-Id: <202110191319.19JDJFtk023165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 3ee882bf21af - stable/13 - Change lowest address on subnet (host 0) not to broadcast by default. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3ee882bf21afec1adca131783468e9091826521a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=3ee882bf21afec1adca131783468e9091826521a commit 3ee882bf21afec1adca131783468e9091826521a Author: Mike Karels AuthorDate: 2021-09-05 18:14:04 +0000 Commit: Mike Karels CommitDate: 2021-10-19 13:16:32 +0000 Change lowest address on subnet (host 0) not to broadcast by default. The address with a host part of all zeros was used as a broadcast long ago, but the default has been all ones since 4.3BSD and RFC1122. Until now, we would broadcast the host zero address as well as the configured address. Change to not broadcasting that address by default, but add a sysctl (net.inet.ip.broadcast_lowest) to re-enable it. Note that the correct way to use the zero address for broadcast would be to configure it as the broadcast address for the network. See https:/datatracker.ietf.org/doc/draft-schoen-intarea-lowest-address/ and the discussion in https://reviews.freebsd.org/D19316. Note, Linux now implements this. Reviewed by: rgrimes, tuexen; melifaro (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D31861 (cherry picked from commit fd0765933c3ccb059ad7456e657b2e8ed22f58b0) --- sys/netinet/in.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index f9b46b414007..80ddeb5079a0 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -87,6 +87,12 @@ SYSCTL_INT(_net_inet_ip, OID_AUTO, no_same_prefix, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nosameprefix), 0, "Refuse to create same prefixes on different interfaces"); +VNET_DEFINE_STATIC(bool, broadcast_lowest); +#define V_broadcast_lowest VNET(broadcast_lowest) +SYSCTL_BOOL(_net_inet_ip, OID_AUTO, broadcast_lowest, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(broadcast_lowest), 0, + "Treat lowest address on a subnet (host 0) as broadcast"); + VNET_DECLARE(struct inpcbinfo, ripcbinfo); #define V_ripcbinfo VNET(ripcbinfo) @@ -1135,10 +1141,10 @@ in_ifaddr_broadcast(struct in_addr in, struct in_ifaddr *ia) return ((in.s_addr == ia->ia_broadaddr.sin_addr.s_addr || /* - * Check for old-style (host 0) broadcast, but + * Optionally check for old-style (host 0) broadcast, but * taking into account that RFC 3021 obsoletes it. */ - (ia->ia_subnetmask != IN_RFC3021_MASK && + (V_broadcast_lowest && ia->ia_subnetmask != IN_RFC3021_MASK && ntohl(in.s_addr) == ia->ia_subnet)) && /* * Check for an all one subnetmask. These From nobody Tue Oct 19 15:05:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4A5A018051F7; Tue, 19 Oct 2021 15:05: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcVh1Zfrz3h8n; Tue, 19 Oct 2021 15:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06946163C1; Tue, 19 Oct 2021 15:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JF5F84069554; Tue, 19 Oct 2021 15:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JF5FlA069553; Tue, 19 Oct 2021 15:05:15 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:05:15 GMT Message-Id: <202110191505.19JF5FlA069553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 7d7168478380 - stable/13 - cam(4): Improve XPT_DEV_MATCH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d7168478380f08b3a7fd58ca7cf83182fae6850 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7d7168478380f08b3a7fd58ca7cf83182fae6850 commit 7d7168478380f08b3a7fd58ca7cf83182fae6850 Author: Alexander Motin AuthorDate: 2021-10-05 18:54:03 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 14:10:57 +0000 cam(4): Improve XPT_DEV_MATCH Remove *_MATCH_NONE enums, making no sense and so never used. Make *_MATCH_ANY enums 0 (no any match flags set), previously used by *_MATCH_NONE. Bump CAM_VERSION to 0x1a reflecting those changes and add compat shims. When traversing through buses and devices do not descend if we can already see that requested pattern does not match the bus or device. It allows to save significant amount of time on system with thousands of disks when doing limited searches. Reviewed by: imp MFC after: 2 weeks Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D32304 (cherry picked from commit 8f9be1eed11c27c66386c3d72cd6c6aef597fa0d) --- sys/cam/cam_ccb.h | 11 +++----- sys/cam/cam_compat.c | 50 ++++++++++++++++++++++++++++++++-- sys/cam/cam_compat.h | 7 +++++ sys/cam/cam_xpt.c | 76 +++++++++++++--------------------------------------- 4 files changed, 78 insertions(+), 66 deletions(-) diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index b853e3165ba3..a0066eae3361 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -410,13 +410,12 @@ struct ccb_getdevlist { }; typedef enum { - PERIPH_MATCH_NONE = 0x000, + PERIPH_MATCH_ANY = 0x000, PERIPH_MATCH_PATH = 0x001, PERIPH_MATCH_TARGET = 0x002, PERIPH_MATCH_LUN = 0x004, PERIPH_MATCH_NAME = 0x008, PERIPH_MATCH_UNIT = 0x010, - PERIPH_MATCH_ANY = 0x01f } periph_pattern_flags; struct periph_match_pattern { @@ -429,13 +428,12 @@ struct periph_match_pattern { }; typedef enum { - DEV_MATCH_NONE = 0x000, + DEV_MATCH_ANY = 0x000, DEV_MATCH_PATH = 0x001, DEV_MATCH_TARGET = 0x002, DEV_MATCH_LUN = 0x004, DEV_MATCH_INQUIRY = 0x008, DEV_MATCH_DEVID = 0x010, - DEV_MATCH_ANY = 0x00f } dev_pattern_flags; struct device_id_match_pattern { @@ -455,12 +453,11 @@ struct device_match_pattern { }; typedef enum { - BUS_MATCH_NONE = 0x000, + BUS_MATCH_ANY = 0x000, BUS_MATCH_PATH = 0x001, BUS_MATCH_NAME = 0x002, BUS_MATCH_UNIT = 0x004, BUS_MATCH_BUS_ID = 0x008, - BUS_MATCH_ANY = 0x00f } bus_pattern_flags; struct bus_match_pattern { @@ -582,7 +579,7 @@ struct ccb_dev_match { /* * Definitions for the path inquiry CCB fields. */ -#define CAM_VERSION 0x19 /* Hex value for current version */ +#define CAM_VERSION 0x1a /* Hex value for current version */ typedef enum { PI_MDP_ABLE = 0x80, /* Supports MDP message */ diff --git a/sys/cam/cam_compat.c b/sys/cam/cam_compat.c index 4c89072fa389..6893402a3d9c 100644 --- a/sys/cam/cam_compat.c +++ b/sys/cam/cam_compat.c @@ -58,6 +58,8 @@ static int cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td, d_ioctl_t *cbfnp); static int cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td, d_ioctl_t *cbfnp); +static int cam_compat_handle_0x19(struct cdev *dev, u_long cmd, caddr_t addr, + int flag, struct thread *td, d_ioctl_t *cbfnp); static int cam_compat_translate_dev_match_0x18(union ccb *ccb); int @@ -108,6 +110,22 @@ cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, cmd = CAMGETPASSTHRU; error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); break; + case CAMIOCOMMAND_0x19: + cmd = CAMIOCOMMAND; + error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); + break; + case CAMGETPASSTHRU_0x19: + cmd = CAMGETPASSTHRU; + error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); + break; + case CAMIOQUEUE_0x19: + cmd = CAMIOQUEUE; + error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); + break; + case CAMIOGET_0x19: + cmd = CAMIOGET; + error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); + break; default: error = ENOTTY; } @@ -170,7 +188,7 @@ cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, int flag, bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); } - error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); + error = cam_compat_handle_0x19(dev, cmd, (caddr_t)ccb, flag, td, cbfnp); hdr17->pinfo = hdr->pinfo; hdr17->xpt_links = hdr->xpt_links; @@ -310,7 +328,7 @@ cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, int flag, bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); } - error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); + error = cam_compat_handle_0x19(dev, cmd, (caddr_t)ccb, flag, td, cbfnp); hdr18->pinfo = hdr->pinfo; hdr18->xpt_links = hdr->xpt_links; @@ -420,3 +438,31 @@ cam_compat_translate_dev_match_0x18(union ccb *ccb) return (0); } + +static int +cam_compat_handle_0x19(struct cdev *dev, u_long cmd, caddr_t addr, int flag, + struct thread *td, d_ioctl_t *cbfnp) +{ + union ccb *ccb = (union ccb *)addr; + struct cam_periph_map_info mapinfo; + + if (cmd == CAMIOCOMMAND && ccb->ccb_h.func_code == XPT_DEV_MATCH) { + bzero(&mapinfo, sizeof(mapinfo)); + cam_periph_mapmem(ccb, &mapinfo, maxphys); + for (int i = 0; i < ccb->cdm.num_patterns; i++) { + struct dev_match_pattern *p = &ccb->cdm.patterns[i]; + + if (p->type == DEV_MATCH_BUS && + p->pattern.bus_pattern.flags == 0x00f) + p->pattern.bus_pattern.flags = BUS_MATCH_ANY; + if (p->type == DEV_MATCH_DEVICE && + p->pattern.device_pattern.flags == 0x00f) + p->pattern.device_pattern.flags = DEV_MATCH_ANY; + if (p->type == DEV_MATCH_PERIPH && + p->pattern.periph_pattern.flags == 0x01f) + p->pattern.periph_pattern.flags = PERIPH_MATCH_ANY; + } + cam_periph_unmapmem(ccb, &mapinfo); + } + return ((cbfnp)(dev, cmd, addr, flag, td)); +} diff --git a/sys/cam/cam_compat.h b/sys/cam/cam_compat.h index dd728d86839e..9a1996d230ce 100644 --- a/sys/cam/cam_compat.h +++ b/sys/cam/cam_compat.h @@ -220,5 +220,12 @@ struct dev_match_result_0x18 { #define CAMIOCOMMAND_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 2, CAM_0X18_LEN) #define CAMGETPASSTHRU_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 3, CAM_0X18_LEN) +/* Version 0x19 compatibility */ +#define CAM_VERSION_0x19 0x19 +#define CAMIOCOMMAND_0x19 _IOWR(CAM_VERSION_0x19, 2, union ccb) +#define CAMGETPASSTHRU_0x19 _IOWR(CAM_VERSION_0x19, 3, union ccb) +#define CAMIOQUEUE_0x19 _IO(CAM_VERSION_0x19, 4) +#define CAMIOGET_0x19 _IO(CAM_VERSION_0x19, 5) + #endif #endif diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 0e38166b6ba0..678d8e0b4f3d 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -1374,6 +1374,8 @@ xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, for (i = 0; i < num_patterns; i++) { struct bus_match_pattern *cur_pattern; + struct device_match_pattern *dp = &patterns[i].pattern.device_pattern; + struct periph_match_pattern *pp = &patterns[i].pattern.periph_pattern; /* * If the pattern in question isn't for a bus node, we @@ -1382,6 +1384,14 @@ xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, * tree, since the user wants to match against lower-level * EDT elements. */ + if (patterns[i].type == DEV_MATCH_DEVICE && + (dp->flags & DEV_MATCH_PATH) != 0 && + dp->path_id != bus->path_id) + continue; + if (patterns[i].type == DEV_MATCH_PERIPH && + (pp->flags & PERIPH_MATCH_PATH) != 0 && + pp->path_id != bus->path_id) + continue; if (patterns[i].type != DEV_MATCH_BUS) { if ((retval & DM_RET_ACTION_MASK) == DM_RET_NONE) retval |= DM_RET_DESCEND; @@ -1390,28 +1400,6 @@ xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, cur_pattern = &patterns[i].pattern.bus_pattern; - /* - * If they want to match any bus node, we give them any - * device node. - */ - if (cur_pattern->flags == BUS_MATCH_ANY) { - /* set the copy flag */ - retval |= DM_RET_COPY; - - /* - * If we've already decided on an action, go ahead - * and return. - */ - if ((retval & DM_RET_ACTION_MASK) != DM_RET_NONE) - return(retval); - } - - /* - * Not sure why someone would do this... - */ - if (cur_pattern->flags == BUS_MATCH_NONE) - continue; - if (((cur_pattern->flags & BUS_MATCH_PATH) != 0) && (cur_pattern->path_id != bus->path_id)) continue; @@ -1487,11 +1475,20 @@ xptdevicematch(struct dev_match_pattern *patterns, u_int num_patterns, for (i = 0; i < num_patterns; i++) { struct device_match_pattern *cur_pattern; struct scsi_vpd_device_id *device_id_page; + struct periph_match_pattern *pp = &patterns[i].pattern.periph_pattern; /* * If the pattern in question isn't for a device node, we * aren't interested. */ + if (patterns[i].type == DEV_MATCH_PERIPH && + (pp->flags & PERIPH_MATCH_TARGET) != 0 && + pp->target_id != device->target->target_id) + continue; + if (patterns[i].type == DEV_MATCH_PERIPH && + (pp->flags & PERIPH_MATCH_LUN) != 0 && + pp->target_lun != device->lun_id) + continue; if (patterns[i].type != DEV_MATCH_DEVICE) { if ((patterns[i].type == DEV_MATCH_PERIPH) && ((retval & DM_RET_ACTION_MASK) == DM_RET_NONE)) @@ -1506,19 +1503,6 @@ xptdevicematch(struct dev_match_pattern *patterns, u_int num_patterns, == (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) return(DM_RET_ERROR); - /* - * If they want to match any device node, we give them any - * device node. - */ - if (cur_pattern->flags == DEV_MATCH_ANY) - goto copy_dev_node; - - /* - * Not sure why someone would do this... - */ - if (cur_pattern->flags == DEV_MATCH_NONE) - continue; - if (((cur_pattern->flags & DEV_MATCH_PATH) != 0) && (cur_pattern->path_id != device->target->bus->path_id)) continue; @@ -1548,7 +1532,6 @@ xptdevicematch(struct dev_match_pattern *patterns, u_int num_patterns, cur_pattern->data.devid_pat.id_len) != 0)) continue; -copy_dev_node: /* * If we get to this point, the user definitely wants * information on this device. So tell the caller to copy @@ -1623,27 +1606,6 @@ xptperiphmatch(struct dev_match_pattern *patterns, u_int num_patterns, cur_pattern = &patterns[i].pattern.periph_pattern; - /* - * If they want to match on anything, then we will do so. - */ - if (cur_pattern->flags == PERIPH_MATCH_ANY) { - /* set the copy flag */ - retval |= DM_RET_COPY; - - /* - * We've already set the return action to stop, - * since there are no nodes below peripherals in - * the tree. - */ - return(retval); - } - - /* - * Not sure why someone would do this... - */ - if (cur_pattern->flags == PERIPH_MATCH_NONE) - continue; - if (((cur_pattern->flags & PERIPH_MATCH_PATH) != 0) && (cur_pattern->path_id != periph->path->bus->path_id)) continue; From nobody Tue Oct 19 15:06:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 88DAE1805850; Tue, 19 Oct 2021 15:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcXZ3Pbrz3hLP; Tue, 19 Oct 2021 15:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F38E1655B; Tue, 19 Oct 2021 15:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JF6si8069783; Tue, 19 Oct 2021 15:06:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JF6s6b069782; Tue, 19 Oct 2021 15:06:54 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:06:54 GMT Message-Id: <202110191506.19JF6s6b069782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 7e321b97917d - stable/13 - cam(4): Limit search for disks in SES enclosure by single bus List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e321b97917dce5274972a6bc5eee94c6ad4cfc4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7e321b97917dce5274972a6bc5eee94c6ad4cfc4 commit 7e321b97917dce5274972a6bc5eee94c6ad4cfc4 Author: Alexander Motin AuthorDate: 2021-10-05 19:01:16 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:06:52 +0000 cam(4): Limit search for disks in SES enclosure by single bus At least for SAS that we only support now disks are typically connected to the same bus as the enclosure. Limiting the search scope makes it much faster on systems with multiple buses and thousands of disks. Reviewed by: imp MFC after: 2 weeks Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D32305 (cherry picked from commit 730ea72c706ef8e025616772cfd86fd89ed3d42e) --- sys/cam/scsi/scsi_enc_ses.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index 014fe9fcd525..d20f3dec4e52 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -374,6 +374,10 @@ typedef struct ses_softc { ses_control_reqlist_t ses_pending_requests; } ses_softc_t; +static int ses_search_globally = 0; +SYSCTL_INT(_kern_cam_enc, OID_AUTO, search_globally, CTLFLAG_RWTUN, + &ses_search_globally, 0, "Search for disks on other buses"); + /** * \brief Reset a SES iterator to just before the first element * in the configuration. @@ -890,6 +894,10 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_element_t *elem, + devid->length; memcpy(device_pattern->data.devid_pat.id, devid, device_pattern->data.devid_pat.id_len); + if (!ses_search_globally) { + device_pattern->flags |= DEV_MATCH_PATH; + device_pattern->path_id = xpt_path_path_id(enc->periph->path); + } memset(&cdm, 0, sizeof(cdm)); if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, From nobody Tue Oct 19 15:12:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 504C718085F9; Tue, 19 Oct 2021 15:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcgM1smHz3kTk; Tue, 19 Oct 2021 15:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2008D165B7; Tue, 19 Oct 2021 15:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JFClwS082706; Tue, 19 Oct 2021 15:12:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JFClGs082705; Tue, 19 Oct 2021 15:12:47 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:12:47 GMT Message-Id: <202110191512.19JFClGs082705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 5c691a9593a2 - stable/13 - ciss(4): Properly handle data underrun. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5c691a9593a275085734dea18d4e479ab0430c09 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5c691a9593a275085734dea18d4e479ab0430c09 commit 5c691a9593a275085734dea18d4e479ab0430c09 Author: Alexander Motin AuthorDate: 2021-09-19 17:45:51 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:12:32 +0000 ciss(4): Properly handle data underrun. For SCSI data underrun is a part of normal life. It should not be reported as error. This fixes MODE SENSE used by modern CAM. MFC after: 1 month (cherry picked from commit e8144a13e075ff13c1f162690c7f14dd3f0a4862) --- sys/dev/ciss/ciss.c | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 74baf164b860..36d1225fbe4a 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -2331,13 +2331,15 @@ _ciss_report_request(struct ciss_request *cr, int *command_status, int *scsi_sta if (command_status != NULL) *command_status = ce->command_status; if (scsi_status != NULL) { - if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { + if (ce->command_status == CISS_CMD_STATUS_DATA_UNDERRUN) { + *scsi_status = SCSI_STATUS_OK; + } else if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { *scsi_status = ce->scsi_status; } else { *scsi_status = -1; } } - if (bootverbose) + if (bootverbose && ce->command_status != CISS_CMD_STATUS_DATA_UNDERRUN) ciss_printf(cr->cr_sc, "command status 0x%x (%s) scsi status 0x%x\n", ce->command_status, ciss_name_command_status(ce->command_status), ce->scsi_status); @@ -3311,28 +3313,17 @@ ciss_cam_complete(struct ciss_request *cr) * Extract status values from request. */ ciss_report_request(cr, &command_status, &scsi_status); - csio->scsi_status = scsi_status; - - /* - * Handle specific SCSI status values. - */ - switch(scsi_status) { - /* no status due to adapter error */ - case -1: - debug(0, "adapter error"); - csio->ccb_h.status |= CAM_REQ_CMP_ERR; - break; - - /* no status due to command completed OK */ - case SCSI_STATUS_OK: /* CISS_SCSI_STATUS_GOOD */ + switch(command_status) { + case CISS_CMD_STATUS_DATA_UNDERRUN: + csio->resid = ce->residual_count; + /* FALLTHROUGH */ + case CISS_CMD_STATUS_SUCCESS: + csio->scsi_status = scsi_status; debug(2, "SCSI_STATUS_OK"); csio->ccb_h.status |= CAM_REQ_CMP; break; - - /* check condition, sense data included */ - case SCSI_STATUS_CHECK_COND: /* CISS_SCSI_STATUS_CHECK_CONDITION */ - debug(0, "SCSI_STATUS_CHECK_COND sense size %d resid %d\n", - ce->sense_length, ce->residual_count); + case CISS_CMD_STATUS_TARGET_STATUS: + csio->scsi_status = scsi_status; bzero(&csio->sense_data, SSD_FULL_SIZE); bcopy(&ce->sense_info[0], &csio->sense_data, ce->sense_length); if (csio->sense_len > ce->sense_length) @@ -3341,22 +3332,11 @@ ciss_cam_complete(struct ciss_request *cr) csio->sense_resid = 0; csio->resid = ce->residual_count; csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; -#ifdef CISS_DEBUG - { - struct scsi_sense_data *sns = (struct scsi_sense_data *)&ce->sense_info[0]; - debug(0, "sense key %x", scsi_get_sense_key(sns, csio->sense_len - - csio->sense_resid, /*show_errors*/ 1)); - } -#endif break; - - case SCSI_STATUS_BUSY: /* CISS_SCSI_STATUS_BUSY */ - debug(0, "SCSI_STATUS_BUSY"); - csio->ccb_h.status |= CAM_SCSI_BUSY; + case CISS_CMD_STATUS_DATA_OVERRUN: + csio->ccb_h.status |= CAM_DATA_RUN_ERR; break; - default: - debug(0, "unknown status 0x%x", csio->scsi_status); csio->ccb_h.status |= CAM_REQ_CMP_ERR; break; } From nobody Tue Oct 19 15:12:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0346418088D6; Tue, 19 Oct 2021 15:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcgN42VMz3kZ8; Tue, 19 Oct 2021 15:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A04516258; Tue, 19 Oct 2021 15:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JFCmZj082735; Tue, 19 Oct 2021 15:12:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JFCmoV082734; Tue, 19 Oct 2021 15:12:48 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:12:48 GMT Message-Id: <202110191512.19JFCmoV082734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: e61892af6fa4 - stable/13 - ciss(4): Fix typo. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e61892af6fa41b01941234ec1c45cbb91402d9eb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e61892af6fa41b01941234ec1c45cbb91402d9eb commit e61892af6fa41b01941234ec1c45cbb91402d9eb Author: Alexander Motin AuthorDate: 2021-09-19 18:01:40 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:12:33 +0000 ciss(4): Fix typo. (cherry picked from commit 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6) --- sys/dev/ciss/ciss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 36d1225fbe4a..d87f32610b20 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -1283,7 +1283,7 @@ ciss_identify_adapter(struct ciss_softc *sc) "\20\1ultra2\2ultra3\10fibre1\11fibre2\n"); ciss_printf(sc, " server name '%.16s'\n", sc->ciss_cfg->server_name); ciss_printf(sc, " heartbeat 0x%x\n", sc->ciss_cfg->heartbeat); - ciss_printf(sc, " max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); + ciss_printf(sc, " max logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); ciss_printf(sc, " max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported); ciss_printf(sc, " max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); ciss_printf(sc, " JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ? From nobody Tue Oct 19 15:16:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5229180C138; Tue, 19 Oct 2021 15:16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcl54mKxz3mgc; Tue, 19 Oct 2021 15:16:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83C0B1678B; Tue, 19 Oct 2021 15:16:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JFG1XW083076; Tue, 19 Oct 2021 15:16:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JFG1xZ083075; Tue, 19 Oct 2021 15:16:01 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:16:01 GMT Message-Id: <202110191516.19JFG1xZ083075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 9abf1f741d54 - stable/12 - ciss(4): Properly handle data underrun. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9abf1f741d541a4a1ab684cc417cc6660b0cba1a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9abf1f741d541a4a1ab684cc417cc6660b0cba1a commit 9abf1f741d541a4a1ab684cc417cc6660b0cba1a Author: Alexander Motin AuthorDate: 2021-09-19 17:45:51 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:13:31 +0000 ciss(4): Properly handle data underrun. For SCSI data underrun is a part of normal life. It should not be reported as error. This fixes MODE SENSE used by modern CAM. MFC after: 1 month (cherry picked from commit e8144a13e075ff13c1f162690c7f14dd3f0a4862) --- sys/dev/ciss/ciss.c | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 3cfeb90e9f06..34d3aeb6dae8 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -2336,13 +2336,15 @@ _ciss_report_request(struct ciss_request *cr, int *command_status, int *scsi_sta if (command_status != NULL) *command_status = ce->command_status; if (scsi_status != NULL) { - if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { + if (ce->command_status == CISS_CMD_STATUS_DATA_UNDERRUN) { + *scsi_status = SCSI_STATUS_OK; + } else if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { *scsi_status = ce->scsi_status; } else { *scsi_status = -1; } } - if (bootverbose) + if (bootverbose && ce->command_status != CISS_CMD_STATUS_DATA_UNDERRUN) ciss_printf(cr->cr_sc, "command status 0x%x (%s) scsi status 0x%x\n", ce->command_status, ciss_name_command_status(ce->command_status), ce->scsi_status); @@ -3318,28 +3320,17 @@ ciss_cam_complete(struct ciss_request *cr) * Extract status values from request. */ ciss_report_request(cr, &command_status, &scsi_status); - csio->scsi_status = scsi_status; - - /* - * Handle specific SCSI status values. - */ - switch(scsi_status) { - /* no status due to adapter error */ - case -1: - debug(0, "adapter error"); - csio->ccb_h.status |= CAM_REQ_CMP_ERR; - break; - - /* no status due to command completed OK */ - case SCSI_STATUS_OK: /* CISS_SCSI_STATUS_GOOD */ + switch(command_status) { + case CISS_CMD_STATUS_DATA_UNDERRUN: + csio->resid = ce->residual_count; + /* FALLTHROUGH */ + case CISS_CMD_STATUS_SUCCESS: + csio->scsi_status = scsi_status; debug(2, "SCSI_STATUS_OK"); csio->ccb_h.status |= CAM_REQ_CMP; break; - - /* check condition, sense data included */ - case SCSI_STATUS_CHECK_COND: /* CISS_SCSI_STATUS_CHECK_CONDITION */ - debug(0, "SCSI_STATUS_CHECK_COND sense size %d resid %d\n", - ce->sense_length, ce->residual_count); + case CISS_CMD_STATUS_TARGET_STATUS: + csio->scsi_status = scsi_status; bzero(&csio->sense_data, SSD_FULL_SIZE); bcopy(&ce->sense_info[0], &csio->sense_data, ce->sense_length); if (csio->sense_len > ce->sense_length) @@ -3348,22 +3339,11 @@ ciss_cam_complete(struct ciss_request *cr) csio->sense_resid = 0; csio->resid = ce->residual_count; csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; -#ifdef CISS_DEBUG - { - struct scsi_sense_data *sns = (struct scsi_sense_data *)&ce->sense_info[0]; - debug(0, "sense key %x", scsi_get_sense_key(sns, csio->sense_len - - csio->sense_resid, /*show_errors*/ 1)); - } -#endif break; - - case SCSI_STATUS_BUSY: /* CISS_SCSI_STATUS_BUSY */ - debug(0, "SCSI_STATUS_BUSY"); - csio->ccb_h.status |= CAM_SCSI_BUSY; + case CISS_CMD_STATUS_DATA_OVERRUN: + csio->ccb_h.status |= CAM_DATA_RUN_ERR; break; - default: - debug(0, "unknown status 0x%x", csio->scsi_status); csio->ccb_h.status |= CAM_REQ_CMP_ERR; break; } From nobody Tue Oct 19 15:16:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F0CF8180C1B9; Tue, 19 Oct 2021 15:16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcl66CMHz3mN9; Tue, 19 Oct 2021 15:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B24DE1678C; Tue, 19 Oct 2021 15:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JFG2CM083100; Tue, 19 Oct 2021 15:16:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JFG211083099; Tue, 19 Oct 2021 15:16:02 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:16:02 GMT Message-Id: <202110191516.19JFG211083099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 1a34fe4c87b0 - stable/12 - ciss(4): Fix typo. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a34fe4c87b0707600a3c2232f767c02b2fad56a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1a34fe4c87b0707600a3c2232f767c02b2fad56a commit 1a34fe4c87b0707600a3c2232f767c02b2fad56a Author: Alexander Motin AuthorDate: 2021-09-19 18:01:40 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:13:31 +0000 ciss(4): Fix typo. (cherry picked from commit 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6) --- sys/dev/ciss/ciss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 34d3aeb6dae8..d20599ed7ecd 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -1284,7 +1284,7 @@ ciss_identify_adapter(struct ciss_softc *sc) "\20\1ultra2\2ultra3\10fibre1\11fibre2\n"); ciss_printf(sc, " server name '%.16s'\n", sc->ciss_cfg->server_name); ciss_printf(sc, " heartbeat 0x%x\n", sc->ciss_cfg->heartbeat); - ciss_printf(sc, " max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); + ciss_printf(sc, " max logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); ciss_printf(sc, " max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported); ciss_printf(sc, " max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); ciss_printf(sc, " JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ? From nobody Tue Oct 19 15:21:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAC87180E155; Tue, 19 Oct 2021 15:21: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYcs85QCTz3nx6; Tue, 19 Oct 2021 15:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B6E816770; Tue, 19 Oct 2021 15:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JFLG7n091753; Tue, 19 Oct 2021 15:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JFLGeM091752; Tue, 19 Oct 2021 15:21:16 GMT (envelope-from git) Date: Tue, 19 Oct 2021 15:21:16 GMT Message-Id: <202110191521.19JFLGeM091752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: d5c6c2eaacba - stable/12 - sbuf(9): Microoptimize sbuf_put_byte() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d5c6c2eaacba9e4272dcc334e2f6bbfc779c5de7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d5c6c2eaacba9e4272dcc334e2f6bbfc779c5de7 commit d5c6c2eaacba9e4272dcc334e2f6bbfc779c5de7 Author: Alexander Motin AuthorDate: 2021-10-05 18:42:47 +0000 Commit: Alexander Motin CommitDate: 2021-10-19 15:20:20 +0000 sbuf(9): Microoptimize sbuf_put_byte() This function is actively used by sbuf_vprintf(), so this simple inlining in half reduces time of kern.geom.confxml generation. MFC after: 2 weeks Sponsored by: iXsystem, Inc. (cherry picked from commit 7835b2cb4a1ae57f403739a2f1076ec7188f18c9) --- sys/kern/subr_sbuf.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 4a046cc41787..039d96c9b739 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -464,7 +464,26 @@ static void sbuf_put_byte(struct sbuf *s, char c) { - sbuf_put_bytes(s, &c, 1); + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + if (__predict_false(s->s_error != 0)) + return; + if (__predict_false(SBUF_FREESPACE(s) <= 0)) { + /* + * If there is a drain, use it, otherwise extend the + * buffer. + */ + if (s->s_drain_func != NULL) + (void)sbuf_drain(s); + else if (sbuf_extend(s, 1) < 0) + s->s_error = ENOMEM; + if (s->s_error != 0) + return; + } + s->s_buf[s->s_len++] = c; + if (SBUF_ISSECTION(s)) + s->s_sect_len++; } /* @@ -607,7 +626,7 @@ static void sbuf_putc_func(int c, void *arg) { - if (c != '\0') + if (__predict_true(c != '\0')) sbuf_put_byte(arg, c); } From nobody Tue Oct 19 16:48:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 88B4C180A252; Tue, 19 Oct 2021 16:48: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYfnm3L7lz4h3L; Tue, 19 Oct 2021 16:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5269417B1A; Tue, 19 Oct 2021 16:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JGmSHL002764; Tue, 19 Oct 2021 16:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JGmSOL002763; Tue, 19 Oct 2021 16:48:28 GMT (envelope-from git) Date: Tue, 19 Oct 2021 16:48:28 GMT Message-Id: <202110191648.19JGmSOL002763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 98e805b4a18d - main - loader: net_open() should not replace f->f_devdata List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98e805b4a18d6ef4d3c9924166e1217e0430290d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=98e805b4a18d6ef4d3c9924166e1217e0430290d commit 98e805b4a18d6ef4d3c9924166e1217e0430290d Author: Toomas Soome AuthorDate: 2021-09-24 15:04:31 +0000 Commit: Toomas Soome CommitDate: 2021-10-19 16:43:56 +0000 loader: net_open() should not replace f->f_devdata net_open() does replace f_devdata with pointer to netdev_sock, this will cause memory leak when device is closed, but also does alter the devopen() logic. We should store &netdev_sock to dev->d_opendata instead, this would preserve and follow the devopen() logic. Fixes network boot on aarch64 (tested by bz). Reviewed-by: imp MFC After: 2 weeks Differential Revision: https://reviews.freebsd.org/D32227 --- stand/common/dev_net.c | 8 +++++--- stand/libsa/nfs.c | 4 +++- stand/libsa/tftp.c | 7 +++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index db13e618e822..70b571047d56 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -114,7 +114,7 @@ net_init(void) /* * Called by devopen after it sets f->f_dev to our devsw entry. - * This opens the low-level device and sets f->f_devdata. + * This opens the low-level device and sets dev->d_opendata. * This is declared with variable arguments... */ static int @@ -193,20 +193,22 @@ net_open(struct open_file *f, ...) } netdev_opens++; - f->f_devdata = &netdev_sock; + dev->d_opendata = &netdev_sock; return (error); } static int net_close(struct open_file *f) { + struct devdesc *dev; #ifdef NETIF_DEBUG if (debug) printf("%s: opens=%d\n", __func__, netdev_opens); #endif - f->f_devdata = NULL; + dev = f->f_devdata; + dev->d_opendata = NULL; return (0); } diff --git a/stand/libsa/nfs.c b/stand/libsa/nfs.c index 084c7261f054..5757395caba2 100644 --- a/stand/libsa/nfs.c +++ b/stand/libsa/nfs.c @@ -464,6 +464,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len) int nfs_open(const char *upath, struct open_file *f) { + struct devdesc *dev; struct iodesc *desc; struct nfs_iodesc *currfd = NULL; char buf[2 * NFS_V3MAXFHSIZE + 3]; @@ -484,6 +485,7 @@ nfs_open(const char *upath, struct open_file *f) if (netproto != NET_NFS) return (EINVAL); + dev = f->f_devdata; #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, @@ -497,7 +499,7 @@ nfs_open(const char *upath, struct open_file *f) if (f->f_dev->dv_type != DEVT_NET) return (EINVAL); - if (!(desc = socktodesc(*(int *)(f->f_devdata)))) + if (!(desc = socktodesc(*(int *)(dev->d_opendata)))) return (EINVAL); /* Bind to a reserved port. */ diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 22e03ab58da1..01f5753a2163 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -37,7 +37,8 @@ __FBSDID("$FreeBSD$"); /* * Simple TFTP implementation for libsa. * Assumes: - * - socket descriptor (int) at open_file->f_devdata + * - socket descriptor (int) at dev->d_opendata, dev stored at + * open_file->f_devdata * - server host IP in global rootip * Restrictions: * - read only @@ -432,6 +433,7 @@ tftp_getnextblock(struct tftp_handle *h) static int tftp_open(const char *path, struct open_file *f) { + struct devdesc *dev; struct tftp_handle *tftpfile; struct iodesc *io; int res; @@ -452,7 +454,8 @@ tftp_open(const char *path, struct open_file *f) return (ENOMEM); tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE; - tftpfile->iodesc = io = socktodesc(*(int *)(f->f_devdata)); + dev = f->f_devdata; + tftpfile->iodesc = io = socktodesc(*(int *)(dev->d_opendata)); if (io == NULL) { free(tftpfile); return (EINVAL); From nobody Tue Oct 19 16:51:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A0D49180ABF2; Tue, 19 Oct 2021 16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYfsj4Cxmz4hnm; Tue, 19 Oct 2021 16:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 724A017E00; Tue, 19 Oct 2021 16:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JGpr3A013723; Tue, 19 Oct 2021 16:51:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JGprM4013722; Tue, 19 Oct 2021 16:51:53 GMT (envelope-from git) Date: Tue, 19 Oct 2021 16:51:53 GMT Message-Id: <202110191651.19JGprM4013722@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: 32723a3ba961 - main - sockstat: make err(3) on jail errors more verbose. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 32723a3ba9611d7947ccf639fcdef5fa0b330571 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=32723a3ba9611d7947ccf639fcdef5fa0b330571 commit 32723a3ba9611d7947ccf639fcdef5fa0b330571 Author: Gleb Smirnoff AuthorDate: 2021-10-19 16:46:41 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-19 16:49:35 +0000 sockstat: make err(3) on jail errors more verbose. --- usr.bin/sockstat/sockstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 5318a43f8585..d30f1cad0498 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -1352,7 +1352,7 @@ main(int argc, char *argv[]) case 'j': opt_j = jail_getid(optarg); if (opt_j < 0) - errx(1, "%s", jail_errmsg); + errx(1, "jail_getid: %s", jail_errmsg); break; case 'L': opt_L = 1; @@ -1403,7 +1403,7 @@ main(int argc, char *argv[]) if (opt_j > 0) { switch (jail_getvnet(opt_j)) { case -1: - errx(2, "%s", jail_errmsg); + errx(2, "jail_getvnet: %s", jail_errmsg); case JAIL_SYS_NEW: if (jail_attach(opt_j) < 0) err(3, "jail_attach()"); From nobody Tue Oct 19 16:51:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57F4A180ACE9; Tue, 19 Oct 2021 16:51: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYfsl0PMWz4hZG; Tue, 19 Oct 2021 16:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0CEA17936; Tue, 19 Oct 2021 16:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JGpsir013747; Tue, 19 Oct 2021 16:51:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JGpskq013746; Tue, 19 Oct 2021 16:51:54 GMT (envelope-from git) Date: Tue, 19 Oct 2021 16:51:54 GMT Message-Id: <202110191651.19JGpskq013746@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: 1fec1fa8146d - main - sockstat: don't query jail vnet if system is running without VIMAGE. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 1fec1fa8146dc3b3244955afe337c4e9892ccb4b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1fec1fa8146dc3b3244955afe337c4e9892ccb4b commit 1fec1fa8146dc3b3244955afe337c4e9892ccb4b Author: Gleb Smirnoff AuthorDate: 2021-10-19 16:47:54 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-19 16:49:35 +0000 sockstat: don't query jail vnet if system is running without VIMAGE. Fixes: f1cd4902bf17 --- usr.bin/sockstat/sockstat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index d30f1cad0498..d7fdb87b7490 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -1292,6 +1292,10 @@ jail_getvnet(int jid) { struct iovec jiov[6]; int vnet; + size_t len = sizeof(vnet); + + if (sysctlbyname("kern.features.vimage", &vnet, &len, NULL, 0) != 0) + return (0); vnet = -1; jiov[0].iov_base = __DECONST(char *, "jid"); From nobody Tue Oct 19 20:04:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 78E6817F5038; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8D30pTz4bBD; Tue, 19 Oct 2021 20:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 486F51A4C6; Tue, 19 Oct 2021 20:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4iik069821; Tue, 19 Oct 2021 20:04:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4iPw069820; Tue, 19 Oct 2021 20:04:44 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:44 GMT Message-Id: <202110192004.19JK4iPw069820@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: 31faa565edea - main - sys_procctl(2): remove sysproto and argused List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31faa565edea908a8caf71cc6783066c02fd6844 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=31faa565edea908a8caf71cc6783066c02fd6844 commit 31faa565edea908a8caf71cc6783066c02fd6844 Author: Konstantin Belousov AuthorDate: 2021-10-15 18:55:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:33 +0000 sys_procctl(2): remove sysproto and argused Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 53626caa0fd9..eb36f0822938 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,15 +656,6 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct procctl_args { - idtype_t idtype; - id_t id; - int com; - void *data; -}; -#endif -/* ARGSUSED */ int sys_procctl(struct thread *td, struct procctl_args *uap) { From nobody Tue Oct 19 20:04:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1BBB517F5283; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8F4J5gz4bSR; Tue, 19 Oct 2021 20:04:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6361D1A447; Tue, 19 Oct 2021 20:04:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4jIO069845; Tue, 19 Oct 2021 20:04:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4jN3069844; Tue, 19 Oct 2021 20:04:45 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:45 GMT Message-Id: <202110192004.19JK4jN3069844@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: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ae879b14a2086df521c59c4a379d3a072e08bc6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d3a072e08bc6 commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 Author: Konstantin Belousov AuthorDate: 2021-10-15 18:57:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 kern_procctl(): convert the function to be table-driven Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index eb36f0822938..90c5e63c7219 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,6 +656,57 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } +struct procctl_cmd_info { + int lock_tree; + bool one_proc : 1; +}; +static const struct procctl_cmd_info procctl_cmds_info[] = { + [PROC_SPROTECT] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_REAP_ACQUIRE] = + { .lock_tree = SA_XLOCKED, .one_proc = true, }, + [PROC_REAP_RELEASE] = + { .lock_tree = SA_XLOCKED, .one_proc = true, }, + [PROC_REAP_STATUS] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_REAP_GETPIDS] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_REAP_KILL] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_TRACE_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_TRACE_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_TRAPCAP_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_TRAPCAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PDEATHSIG_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PDEATHSIG_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_ASLR_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_ASLR_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PROTMAX_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PROTMAX_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_STACKGAP_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_STACKGAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_NO_NEW_PRIVS_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_NO_NEW_PRIVS_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_WXMAP_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_WXMAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, +}; + int sys_procctl(struct thread *td, struct procctl_args *uap) { @@ -812,33 +863,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) { struct pgrp *pg; struct proc *p; + const struct procctl_cmd_info *cmd_info; int error, first_error, ok; int signum; - bool tree_locked; - switch (com) { - case PROC_ASLR_CTL: - case PROC_ASLR_STATUS: - case PROC_PROTMAX_CTL: - case PROC_PROTMAX_STATUS: - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: - case PROC_REAP_STATUS: - case PROC_REAP_GETPIDS: - case PROC_REAP_KILL: - case PROC_STACKGAP_CTL: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_PDEATHSIG_CTL: - case PROC_PDEATHSIG_STATUS: - case PROC_NO_NEW_PRIVS_CTL: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_CTL: - case PROC_WXMAP_STATUS: - if (idtype != P_PID) - return (EINVAL); - } + MPASS(com > 0 && com < nitems(procctl_cmds_info)); + cmd_info = &procctl_cmds_info[com]; + if (idtype != P_PID && cmd_info->one_proc) + return (EINVAL); switch (com) { case PROC_PDEATHSIG_CTL: @@ -861,37 +893,13 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) return (0); } - switch (com) { - case PROC_SPROTECT: - case PROC_REAP_STATUS: - case PROC_REAP_GETPIDS: - case PROC_REAP_KILL: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_NO_NEW_PRIVS_CTL: - sx_slock(&proctree_lock); - tree_locked = true; - break; - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: + switch (cmd_info->lock_tree) { + case SA_XLOCKED: sx_xlock(&proctree_lock); - tree_locked = true; break; - case PROC_ASLR_CTL: - case PROC_ASLR_STATUS: - case PROC_PROTMAX_CTL: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_CTL: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_CTL: - case PROC_WXMAP_STATUS: - tree_locked = false; + case SA_SLOCKED: + sx_slock(&proctree_lock); break; - default: - return (EINVAL); } switch (idtype) { @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) error = EINVAL; break; } - if (tree_locked) - sx_unlock(&proctree_lock); + + switch (cmd_info->lock_tree) { + case SA_XLOCKED: + sx_xunlock(&proctree_lock); + break; + case SA_SLOCKED: + sx_sunlock(&proctree_lock); + break; + } return (error); } From nobody Tue Oct 19 20:04:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B03BE17F5063; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8H09p6z4bNC; Tue, 19 Oct 2021 20:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89F851A2D8; Tue, 19 Oct 2021 20:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4kV4069869; Tue, 19 Oct 2021 20:04:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4kxU069868; Tue, 19 Oct 2021 20:04:46 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:46 GMT Message-Id: <202110192004.19JK4kxU069868@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: f833ab9dd187 - main - procctl(2): add consistent shortcut P_ID:0 as curproc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f833ab9dd187328306fa1601330fbc8332392abe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f833ab9dd187328306fa1601330fbc8332392abe commit f833ab9dd187328306fa1601330fbc8332392abe Author: Konstantin Belousov AuthorDate: 2021-10-15 19:01:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 procctl(2): add consistent shortcut P_ID:0 as curproc Reported by: bdrewery, emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- lib/libc/sys/procctl.2 | 2 ++ sys/kern/kern_procctl.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 30933875ccbc..7412c2ee9d56 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -62,6 +62,8 @@ The following identifier types are supported: .It Dv P_PID Control the process with the process ID .Fa id . +.Fa id +zero is a shortcut for the calling process ID. .It Dv P_PGID Control processes belonging to the process group with the ID .Fa id . diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 90c5e63c7219..613fabc4ca34 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -904,12 +904,18 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) switch (idtype) { case P_PID: - p = pfind(id); - if (p == NULL) { - error = ESRCH; - break; + if (id == 0) { + p = td->td_proc; + error = 0; + PROC_LOCK(p); + } else { + p = pfind(id); + if (p == NULL) { + error = ESRCH; + break; + } + error = p_cansee(td, p); } - error = p_cansee(td, p); if (error == 0) error = kern_procctl_single(td, p, com, data); PROC_UNLOCK(p); From nobody Tue Oct 19 20:04:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0FB7917F51EC; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8H6hjkz4bF9; Tue, 19 Oct 2021 20:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A628D1A2D9; Tue, 19 Oct 2021 20:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4lEe069893; Tue, 19 Oct 2021 20:04:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4lJB069892; Tue, 19 Oct 2021 20:04:47 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:47 GMT Message-Id: <202110192004.19JK4lJB069892@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: 34f39a8c0e2a - main - procctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34f39a8c0e2a4100837eb406ae24a7d6a357d696 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=34f39a8c0e2a4100837eb406ae24a7d6a357d696 commit 34f39a8c0e2a4100837eb406ae24a7d6a357d696 Author: Konstantin Belousov AuthorDate: 2021-10-15 19:06:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 procctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 114 +++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 613fabc4ca34..1e29429aacf2 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,55 +656,96 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } +static int +pdeathsig_ctl(struct thread *td, struct proc *p, int data) +{ + if (p != td->td_proc || (data != 0 && !_SIG_VALID(data))) + return (EINVAL); + p->p_pdeathsig = data; + return (0); +} + +static int +pdeathsig_status(struct thread *td, struct proc *p, int *data) +{ + if (p != td->td_proc) + return (EINVAL); + *(int *)data = p->p_pdeathsig; + return (0); +} + struct procctl_cmd_info { int lock_tree; bool one_proc : 1; + bool esrch_is_einval : 1; }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_REAP_ACQUIRE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, }, + { .lock_tree = SA_XLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_RELEASE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, }, + { .lock_tree = SA_XLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_STATUS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_GETPIDS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_KILL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_TRACE_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_TRACE_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_TRAPCAP_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_TRAPCAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PDEATHSIG_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = true, }, [PROC_PDEATHSIG_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = true, }, [PROC_ASLR_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_ASLR_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PROTMAX_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PROTMAX_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_STACKGAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_STACKGAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_NO_NEW_PRIVS_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_NO_NEW_PRIVS_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_WXMAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_WXMAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, }; int @@ -845,6 +886,10 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) return (trapcap_ctl(td, p, *(int *)data)); case PROC_TRAPCAP_STATUS: return (trapcap_status(td, p, data)); + case PROC_PDEATHSIG_CTL: + return (pdeathsig_ctl(td, p, *(int *)data)); + case PROC_PDEATHSIG_STATUS: + return (pdeathsig_status(td, p, data)); case PROC_NO_NEW_PRIVS_CTL: return (no_new_privs_ctl(td, p, *(int *)data)); case PROC_NO_NEW_PRIVS_STATUS: @@ -865,34 +910,12 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) struct proc *p; const struct procctl_cmd_info *cmd_info; int error, first_error, ok; - int signum; MPASS(com > 0 && com < nitems(procctl_cmds_info)); cmd_info = &procctl_cmds_info[com]; if (idtype != P_PID && cmd_info->one_proc) return (EINVAL); - switch (com) { - case PROC_PDEATHSIG_CTL: - signum = *(int *)data; - p = td->td_proc; - if ((id != 0 && id != p->p_pid) || - (signum != 0 && !_SIG_VALID(signum))) - return (EINVAL); - PROC_LOCK(p); - p->p_pdeathsig = signum; - PROC_UNLOCK(p); - return (0); - case PROC_PDEATHSIG_STATUS: - p = td->td_proc; - if (id != 0 && id != p->p_pid) - return (EINVAL); - PROC_LOCK(p); - *(int *)data = p->p_pdeathsig; - PROC_UNLOCK(p); - return (0); - } - switch (cmd_info->lock_tree) { case SA_XLOCKED: sx_xlock(&proctree_lock); @@ -911,7 +934,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) } else { p = pfind(id); if (p == NULL) { - error = ESRCH; + error = cmd_info->esrch_is_einval ? + EINVAL : ESRCH; break; } error = p_cansee(td, p); From nobody Tue Oct 19 20:04:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 28F1417F51F3; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8K2bLxz4bFG; Tue, 19 Oct 2021 20:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B21971A34C; Tue, 19 Oct 2021 20:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4meR069921; Tue, 19 Oct 2021 20:04:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4mQU069920; Tue, 19 Oct 2021 20:04:48 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:48 GMT Message-Id: <202110192004.19JK4mQU069920@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: 68dc5b381a29 - main - kern_procctl_single(): convert to use table data List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68dc5b381a29aaa418064324519105a8c2a4a080 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=68dc5b381a29aaa418064324519105a8c2a4a080 commit 68dc5b381a29aaa418064324519105a8c2a4a080 Author: Konstantin Belousov AuthorDate: 2021-10-15 19:22:18 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 kern_procctl_single(): convert to use table data Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 220 +++++++++++++++++++++++++----------------------- 1 file changed, 114 insertions(+), 106 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 1e29429aacf2..06efcf0e8c74 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -102,10 +102,11 @@ protect_setchildren(struct thread *td, struct proc *top, int flags) } static int -protect_set(struct thread *td, struct proc *p, int flags) +protect_set(struct thread *td, struct proc *p, void *data) { - int error, ret; + int error, flags, ret; + flags = *(int *)data; switch (PPROT_OP(flags)) { case PPROT_SET: case PPROT_CLEAR: @@ -131,7 +132,7 @@ protect_set(struct thread *td, struct proc *p, int flags) } static int -reap_acquire(struct thread *td, struct proc *p) +reap_acquire(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); @@ -148,7 +149,7 @@ reap_acquire(struct thread *td, struct proc *p) } static int -reap_release(struct thread *td, struct proc *p) +reap_release(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); @@ -163,11 +164,12 @@ reap_release(struct thread *td, struct proc *p) } static int -reap_status(struct thread *td, struct proc *p, - struct procctl_reaper_status *rs) +reap_status(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2, *first_p; + struct procctl_reaper_status *rs; + rs = data; sx_assert(&proctree_lock, SX_LOCKED); bzero(rs, sizeof(*rs)); if ((p->p_treeflag & P_TREE_REAPER) == 0) { @@ -198,13 +200,15 @@ reap_status(struct thread *td, struct proc *p, } static int -reap_getpids(struct thread *td, struct proc *p, struct procctl_reaper_pids *rp) +reap_getpids(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2; struct procctl_reaper_pidinfo *pi, *pip; + struct procctl_reaper_pids *rp; u_int i, n; int error; + rp = data; sx_assert(&proctree_lock, SX_LOCKED); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; @@ -276,14 +280,16 @@ reap_kill_sched(struct reap_kill_tracker_head *tracker, struct proc *p2) } static int -reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) +reap_kill(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2; ksiginfo_t ksi; struct reap_kill_tracker_head tracker; struct reap_kill_tracker *t; + struct procctl_reaper_kill *rk; int error; + rk = data; sx_assert(&proctree_lock, SX_LOCKED); if (IN_CAPABILITY_MODE(td)) return (ECAPMODE); @@ -336,10 +342,12 @@ reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) } static int -trace_ctl(struct thread *td, struct proc *p, int state) +trace_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; /* * Ktrace changes p_traceflag from or to zero under the @@ -376,26 +384,30 @@ trace_ctl(struct thread *td, struct proc *p, int state) } static int -trace_status(struct thread *td, struct proc *p, int *data) +trace_status(struct thread *td, struct proc *p, void *data) { + int *status; + status = data; if ((p->p_flag2 & P2_NOTRACE) != 0) { KASSERT((p->p_flag & P_TRACED) == 0, ("%d traced but tracing disabled", p->p_pid)); - *data = -1; + *status = -1; } else if ((p->p_flag & P_TRACED) != 0) { - *data = p->p_pptr->p_pid; + *status = p->p_pptr->p_pid; } else { - *data = 0; + *status = 0; } return (0); } static int -trapcap_ctl(struct thread *td, struct proc *p, int state) +trapcap_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_TRAPCAP_CTL_ENABLE: @@ -411,19 +423,23 @@ trapcap_ctl(struct thread *td, struct proc *p, int state) } static int -trapcap_status(struct thread *td, struct proc *p, int *data) +trapcap_status(struct thread *td, struct proc *p, void *data) { + int *status; - *data = (p->p_flag2 & P2_TRAPCAP) != 0 ? PROC_TRAPCAP_CTL_ENABLE : + status = data; + *status = (p->p_flag2 & P2_TRAPCAP) != 0 ? PROC_TRAPCAP_CTL_ENABLE : PROC_TRAPCAP_CTL_DISABLE; return (0); } static int -no_new_privs_ctl(struct thread *td, struct proc *p, int state) +no_new_privs_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; if (state != PROC_NO_NEW_PRIVS_ENABLE) return (EINVAL); @@ -432,18 +448,21 @@ no_new_privs_ctl(struct thread *td, struct proc *p, int state) } static int -no_new_privs_status(struct thread *td, struct proc *p, int *data) +no_new_privs_status(struct thread *td, struct proc *p, void *data) { - *data = (p->p_flag2 & P2_NO_NEW_PRIVS) != 0 ? + *(int *)data = (p->p_flag2 & P2_NO_NEW_PRIVS) != 0 ? PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE; return (0); } static int -protmax_ctl(struct thread *td, struct proc *p, int state) +protmax_ctl(struct thread *td, struct proc *p, void *data) { + int state; + PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_PROTMAX_FORCE_ENABLE: @@ -464,7 +483,7 @@ protmax_ctl(struct thread *td, struct proc *p, int state) } static int -protmax_status(struct thread *td, struct proc *p, int *data) +protmax_status(struct thread *td, struct proc *p, void *data) { int d; @@ -481,15 +500,17 @@ protmax_status(struct thread *td, struct proc *p, int *data) } if (kern_mmap_maxprot(p, PROT_READ) == PROT_READ) d |= PROC_PROTMAX_ACTIVE; - *data = d; + *(int *)data = d; return (0); } static int -aslr_ctl(struct thread *td, struct proc *p, int state) +aslr_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_ASLR_FORCE_ENABLE: @@ -510,7 +531,7 @@ aslr_ctl(struct thread *td, struct proc *p, int state) } static int -aslr_status(struct thread *td, struct proc *p, int *data) +aslr_status(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; int d; @@ -538,14 +559,17 @@ aslr_status(struct thread *td, struct proc *p, int *data) PROC_LOCK(p); _PRELE(p); } - *data = d; + *(int *)data = d; return (0); } static int -stackgap_ctl(struct thread *td, struct proc *p, int state) +stackgap_ctl(struct thread *td, struct proc *p, void *data) { + int state; + PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; if ((state & ~(PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE | PROC_STACKGAP_ENABLE_EXEC | PROC_STACKGAP_DISABLE_EXEC)) != 0) @@ -580,26 +604,31 @@ stackgap_ctl(struct thread *td, struct proc *p, int state) } static int -stackgap_status(struct thread *td, struct proc *p, int *data) +stackgap_status(struct thread *td, struct proc *p, void *data) { + int d; + PROC_LOCK_ASSERT(p, MA_OWNED); - *data = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : + d = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : PROC_STACKGAP_ENABLE; - *data |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? + d |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? PROC_STACKGAP_DISABLE_EXEC : PROC_STACKGAP_ENABLE_EXEC; + *(int *)data = d; return (0); } static int -wxmap_ctl(struct thread *td, struct proc *p, int state) +wxmap_ctl(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; vm_map_t map; + int state; PROC_LOCK_ASSERT(p, MA_OWNED); if ((p->p_flag & P_WEXIT) != 0) return (ESRCH); + state = *(int *)data; switch (state) { case PROC_WX_MAPPINGS_PERMIT: @@ -628,7 +657,7 @@ wxmap_ctl(struct thread *td, struct proc *p, int state) } static int -wxmap_status(struct thread *td, struct proc *p, int *data) +wxmap_status(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; int d; @@ -652,21 +681,24 @@ wxmap_status(struct thread *td, struct proc *p, int *data) } PROC_LOCK(p); _PRELE(p); - *data = d; + *(int *)data = d; return (0); } static int -pdeathsig_ctl(struct thread *td, struct proc *p, int data) +pdeathsig_ctl(struct thread *td, struct proc *p, void *data) { - if (p != td->td_proc || (data != 0 && !_SIG_VALID(data))) + int signum; + + signum = *(int *)data; + if (p != td->td_proc || (signum != 0 && !_SIG_VALID(signum))) return (EINVAL); - p->p_pdeathsig = data; + p->p_pdeathsig = signum; return (0); } static int -pdeathsig_status(struct thread *td, struct proc *p, int *data) +pdeathsig_status(struct thread *td, struct proc *p, void *data) { if (p != td->td_proc) return (EINVAL); @@ -678,74 +710,97 @@ struct procctl_cmd_info { int lock_tree; bool one_proc : 1; bool esrch_is_einval : 1; + int (*exec)(struct thread *, struct proc *, void *); }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protect_set, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_acquire, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_release, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_status, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_getpids, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_kill, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trace_ctl, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trace_status, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trapcap_ctl, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trapcap_status, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, }, + .esrch_is_einval = true, + .exec = pdeathsig_ctl, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, }, + .esrch_is_einval = true, + .exec = pdeathsig_status, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = aslr_ctl, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = aslr_status, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protmax_ctl, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protmax_status, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = stackgap_ctl, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = stackgap_status, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = no_new_privs_ctl, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = no_new_privs_status, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = wxmap_ctl, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = wxmap_status, }, }; int @@ -853,54 +908,7 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) { PROC_LOCK_ASSERT(p, MA_OWNED); - switch (com) { - case PROC_ASLR_CTL: - return (aslr_ctl(td, p, *(int *)data)); - case PROC_ASLR_STATUS: - return (aslr_status(td, p, data)); - case PROC_SPROTECT: - return (protect_set(td, p, *(int *)data)); - case PROC_PROTMAX_CTL: - return (protmax_ctl(td, p, *(int *)data)); - case PROC_PROTMAX_STATUS: - return (protmax_status(td, p, data)); - case PROC_STACKGAP_CTL: - return (stackgap_ctl(td, p, *(int *)data)); - case PROC_STACKGAP_STATUS: - return (stackgap_status(td, p, data)); - case PROC_REAP_ACQUIRE: - return (reap_acquire(td, p)); - case PROC_REAP_RELEASE: - return (reap_release(td, p)); - case PROC_REAP_STATUS: - return (reap_status(td, p, data)); - case PROC_REAP_GETPIDS: - return (reap_getpids(td, p, data)); - case PROC_REAP_KILL: - return (reap_kill(td, p, data)); - case PROC_TRACE_CTL: - return (trace_ctl(td, p, *(int *)data)); - case PROC_TRACE_STATUS: - return (trace_status(td, p, data)); - case PROC_TRAPCAP_CTL: - return (trapcap_ctl(td, p, *(int *)data)); - case PROC_TRAPCAP_STATUS: - return (trapcap_status(td, p, data)); - case PROC_PDEATHSIG_CTL: - return (pdeathsig_ctl(td, p, *(int *)data)); - case PROC_PDEATHSIG_STATUS: - return (pdeathsig_status(td, p, data)); - case PROC_NO_NEW_PRIVS_CTL: - return (no_new_privs_ctl(td, p, *(int *)data)); - case PROC_NO_NEW_PRIVS_STATUS: - return (no_new_privs_status(td, p, data)); - case PROC_WXMAP_CTL: - return (wxmap_ctl(td, p, *(int *)data)); - case PROC_WXMAP_STATUS: - return (wxmap_status(td, p, data)); - default: - return (EINVAL); - } + return (procctl_cmds_info[com].exec(td, p, data)); } int From nobody Tue Oct 19 20:04:49 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C241A17F550F; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8L5lRBz4bHs; Tue, 19 Oct 2021 20:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB32F1A4C7; Tue, 19 Oct 2021 20:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4nEP069948; Tue, 19 Oct 2021 20:04:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4nBJ069947; Tue, 19 Oct 2021 20:04:49 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:49 GMT Message-Id: <202110192004.19JK4nBJ069947@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: 56d5323b4d7d - main - sys_procctl(): use table data to do copyin/copyout List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 56d5323b4d7d9ccbe1ca3e620400afd165519a12 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56d5323b4d7d9ccbe1ca3e620400afd165519a12 commit 56d5323b4d7d9ccbe1ca3e620400afd165519a12 Author: Konstantin Belousov AuthorDate: 2021-10-15 19:56:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 sys_procctl(): use table data to do copyin/copyout Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 210 ++++++++++++++++++++---------------------------- 1 file changed, 88 insertions(+), 122 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 06efcf0e8c74..7a88ef24d987 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -710,195 +710,161 @@ struct procctl_cmd_info { int lock_tree; bool one_proc : 1; bool esrch_is_einval : 1; + bool copyout_on_error : 1; + bool no_nonnull_data : 1; + int copyin_sz; + int copyout_sz; int (*exec)(struct thread *, struct proc *, void *); }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = protect_set, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_acquire, }, + .esrch_is_einval = false, .no_nonnull_data = true, + .copyin_sz = 0, .copyout_sz = 0, + .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_release, }, + .esrch_is_einval = false, .no_nonnull_data = true, + .copyin_sz = 0, .copyout_sz = 0, + .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, + .copyout_sz = sizeof(struct procctl_reaper_status), + .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_getpids, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(struct procctl_reaper_pids), + .copyout_sz = 0, + .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_kill, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(struct procctl_reaper_kill), + .copyout_sz = sizeof(struct procctl_reaper_kill), + .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = trace_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = trace_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = trapcap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = trapcap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, - .exec = pdeathsig_ctl, }, + .esrch_is_einval = true, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, - .exec = pdeathsig_status, }, + .esrch_is_einval = true, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = aslr_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = aslr_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = protmax_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = protmax_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = stackgap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = stackgap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = no_new_privs_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = no_new_privs_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = wxmap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = wxmap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = wxmap_status, .copyout_on_error = false, }, }; int sys_procctl(struct thread *td, struct procctl_args *uap) { - void *data; union { struct procctl_reaper_status rs; struct procctl_reaper_pids rp; struct procctl_reaper_kill rk; + int flags; } x; - int error, error1, flags, signum; + const struct procctl_cmd_info *cmd_info; + int error, error1; if (uap->com >= PROC_PROCCTL_MD_MIN) return (cpu_procctl(td, uap->idtype, uap->id, uap->com, uap->data)); - - switch (uap->com) { - case PROC_ASLR_CTL: - case PROC_PROTMAX_CTL: - case PROC_SPROTECT: - case PROC_STACKGAP_CTL: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_NO_NEW_PRIVS_CTL: - case PROC_WXMAP_CTL: - error = copyin(uap->data, &flags, sizeof(flags)); - if (error != 0) - return (error); - data = &flags; - break; - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: - if (uap->data != NULL) - return (EINVAL); - data = NULL; - break; - case PROC_REAP_STATUS: - data = &x.rs; - break; - case PROC_REAP_GETPIDS: - error = copyin(uap->data, &x.rp, sizeof(x.rp)); - if (error != 0) - return (error); - data = &x.rp; - break; - case PROC_REAP_KILL: - error = copyin(uap->data, &x.rk, sizeof(x.rk)); - if (error != 0) - return (error); - data = &x.rk; - break; - case PROC_ASLR_STATUS: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_STATUS: - data = &flags; - break; - case PROC_PDEATHSIG_CTL: - error = copyin(uap->data, &signum, sizeof(signum)); + if (uap->com == 0 || uap->com >= nitems(procctl_cmds_info)) + return (EINVAL); + cmd_info = &procctl_cmds_info[uap->com]; + if (cmd_info->copyin_sz > 0) { + error = copyin(uap->data, &x, cmd_info->copyin_sz); if (error != 0) return (error); - data = &signum; - break; - case PROC_PDEATHSIG_STATUS: - data = &signum; - break; - default: + } else if (cmd_info->no_nonnull_data && uap->data != NULL) { return (EINVAL); } - error = kern_procctl(td, uap->idtype, uap->id, uap->com, data); - switch (uap->com) { - case PROC_REAP_STATUS: - if (error == 0) - error = copyout(&x.rs, uap->data, sizeof(x.rs)); - break; - case PROC_REAP_KILL: - error1 = copyout(&x.rk, uap->data, sizeof(x.rk)); + + error = kern_procctl(td, uap->idtype, uap->id, uap->com, &x); + + if (cmd_info->copyout_sz > 0 && (error == 0 || + cmd_info->copyout_on_error)) { + error1 = copyout(&x, uap->data, cmd_info->copyout_sz); if (error == 0) error = error1; - break; - case PROC_ASLR_STATUS: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_STATUS: - if (error == 0) - error = copyout(&flags, uap->data, sizeof(flags)); - break; - case PROC_PDEATHSIG_STATUS: - if (error == 0) - error = copyout(&signum, uap->data, sizeof(signum)); - break; } return (error); } From nobody Tue Oct 19 20:04:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E47B117F53DF; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8N29Fgz4bTB; Tue, 19 Oct 2021 20:04:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 081FD1A4C8; Tue, 19 Oct 2021 20:04:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4oWn069974; Tue, 19 Oct 2021 20:04:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4oOt069973; Tue, 19 Oct 2021 20:04:50 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:50 GMT Message-Id: <202110192004.19JK4oOt069973@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: 32026f5983ed - main - sys_procctl(): zero the data buffer once, on syscall entry List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32026f5983ed00e64829f8c20b09748077809729 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=32026f5983ed00e64829f8c20b09748077809729 commit 32026f5983ed00e64829f8c20b09748077809729 Author: Konstantin Belousov AuthorDate: 2021-10-16 18:28:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 sys_procctl(): zero the data buffer once, on syscall entry and remove zeroing of it from specific functions. This way it is guaranteed that we do not leak kernel data. Suggested by: markj Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 7a88ef24d987..387706a0cb1e 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -171,7 +171,6 @@ reap_status(struct thread *td, struct proc *p, void *data) rs = data; sx_assert(&proctree_lock, SX_LOCKED); - bzero(rs, sizeof(*rs)); if ((p->p_treeflag & P_TREE_REAPER) == 0) { reap = p->p_reaper; } else { @@ -850,6 +849,8 @@ sys_procctl(struct thread *td, struct procctl_args *uap) if (uap->com == 0 || uap->com >= nitems(procctl_cmds_info)) return (EINVAL); cmd_info = &procctl_cmds_info[uap->com]; + bzero(&x, sizeof(x)); + if (cmd_info->copyin_sz > 0) { error = copyin(uap->data, &x, cmd_info->copyin_sz); if (error != 0) From nobody Tue Oct 19 20:04:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB64617F54CC; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8P3vqPz4bNY; Tue, 19 Oct 2021 20:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2538F1A0C1; Tue, 19 Oct 2021 20:04:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4quQ070007; Tue, 19 Oct 2021 20:04:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4qEa070006; Tue, 19 Oct 2021 20:04:52 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:52 GMT Message-Id: <202110192004.19JK4qEa070006@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: 1c4dbee5dd22 - main - procctl: make it possible to specify that some operations require debug privilege over the target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c4dbee5dd224c08241c0922ff577bb226171e81 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1c4dbee5dd224c08241c0922ff577bb226171e81 commit 1c4dbee5dd224c08241c0922ff577bb226171e81 Author: Konstantin Belousov AuthorDate: 2021-10-15 20:02:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 procctl: make it possible to specify that some operations require debug privilege over the target Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 387706a0cb1e..6229d2140228 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -711,6 +711,7 @@ struct procctl_cmd_info { bool esrch_is_einval : 1; bool copyout_on_error : 1; bool no_nonnull_data : 1; + bool need_candebug : 1; int copyin_sz; int copyout_sz; int (*exec)(struct thread *, struct proc *, void *); @@ -719,114 +720,136 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(struct procctl_reaper_status), .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_pids), .copyout_sz = 0, .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_kill), .copyout_sz = sizeof(struct procctl_reaper_kill), .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = wxmap_status, .copyout_on_error = false, }, }; @@ -913,7 +936,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) EINVAL : ESRCH; break; } - error = p_cansee(td, p); + error = cmd_info->need_candebug ? p_candebug(td, p) : + p_cansee(td, p); } if (error == 0) error = kern_procctl_single(td, p, com, data); @@ -936,7 +960,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) first_error = 0; LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p->p_state == PRS_NEW || p_cansee(td, p) != 0) { + if (p->p_state == PRS_NEW || (cmd_info->need_candebug ? + p_candebug(td, p) : p_cansee(td, p)) != 0) { PROC_UNLOCK(p); continue; } From nobody Tue Oct 19 20:04:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 26F4017F5535; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8Q4MHvz4bNb; Tue, 19 Oct 2021 20:04:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D8731A2DA; Tue, 19 Oct 2021 20:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4rRl070031; Tue, 19 Oct 2021 20:04:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4roM070030; Tue, 19 Oct 2021 20:04:53 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:53 GMT Message-Id: <202110192004.19JK4roM070030@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: f5bb6e5a6d48 - main - procctl: actually require debug privileges over target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5bb6e5a6d488740e451ad4acd82a70b95e786cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f5bb6e5a6d488740e451ad4acd82a70b95e786cd commit f5bb6e5a6d488740e451ad4acd82a70b95e786cd Author: Konstantin Belousov AuthorDate: 2021-10-15 20:09:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 procctl: actually require debug privileges over target for state control over TRACE, TRAPCAP, ASLR, PROTMAX, STACKGAP, NO_NEWPRIVS, and WXMAP. Reported by: emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- lib/libc/sys/procctl.2 | 8 ++++++++ sys/kern/kern_procctl.c | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 7412c2ee9d56..97509d0fbf06 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -72,6 +72,14 @@ Control processes belonging to the process group with the ID The control request to perform is specified by the .Fa cmd argument. +.Pp +All status changing requests +.Dv *_CTL +require the caller to have the right to debug the target. +All status query requests +.DV *_STATUS +require the caller to have the right to observe the target. +.Pp The following commands are supported: .Bl -tag -width PROC_TRAPCAP_STATUS .It Dv PROC_ASLR_CTL diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 6229d2140228..c3f078f96e80 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -759,7 +759,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = @@ -771,7 +771,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = @@ -795,7 +795,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = @@ -807,7 +807,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = @@ -819,7 +819,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = @@ -831,7 +831,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = @@ -843,7 +843,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = From nobody Tue Oct 19 20:04:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AC5A617F564C; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8S28Fsz4bFv; Tue, 19 Oct 2021 20:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68A601A619; Tue, 19 Oct 2021 20:04:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4shi070055; Tue, 19 Oct 2021 20:04:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4sgC070054; Tue, 19 Oct 2021 20:04:54 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:54 GMT Message-Id: <202110192004.19JK4sgC070054@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: 3692877a6cf8 - main - kern_procctl.c: use td->td_proc instead of curproc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3692877a6cf8fc374349f3d9b2cbb190fec484a0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3692877a6cf8fc374349f3d9b2cbb190fec484a0 commit 3692877a6cf8fc374349f3d9b2cbb190fec484a0 Author: Konstantin Belousov AuthorDate: 2021-10-18 21:07:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 kern_procctl.c: use td->td_proc instead of curproc Suggested by: markj Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index c3f078f96e80..890a2e05bb27 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -136,7 +136,7 @@ reap_acquire(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); - if (p != curproc) + if (p != td->td_proc) return (EPERM); if ((p->p_treeflag & P_TREE_REAPER) != 0) return (EBUSY); @@ -153,7 +153,7 @@ reap_release(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); - if (p != curproc) + if (p != td->td_proc) return (EPERM); if (p == initproc) return (EINVAL); From nobody Tue Oct 19 20:04:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8925017F56D4; Tue, 19 Oct 2021 20:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYl8T5DRKz4bRC; Tue, 19 Oct 2021 20:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D5C91A4C9; Tue, 19 Oct 2021 20:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JK4taU070085; Tue, 19 Oct 2021 20:04:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JK4thx070084; Tue, 19 Oct 2021 20:04:55 GMT (envelope-from git) Date: Tue, 19 Oct 2021 20:04:55 GMT Message-Id: <202110192004.19JK4thx070084@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: 49db81aa053b - main - kern_procctl: skip zombies for process group operations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49db81aa053beb131ba9dbf5519a5f0eacf28265 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=49db81aa053beb131ba9dbf5519a5f0eacf28265 commit 49db81aa053beb131ba9dbf5519a5f0eacf28265 Author: Konstantin Belousov AuthorDate: 2021-10-18 21:29:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 20:04:34 +0000 kern_procctl: skip zombies for process group operations When iterating over the process group members, skip zombies same as it is done by pfind() for single-process operation. Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513 --- sys/kern/kern_procctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 890a2e05bb27..00c68359f375 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -960,8 +960,10 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) first_error = 0; LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p->p_state == PRS_NEW || (cmd_info->need_candebug ? - p_candebug(td, p) : p_cansee(td, p)) != 0) { + if (p->p_state == PRS_NEW || + p->p_state == PRS_ZOMBIE || + (cmd_info->need_candebug ? p_candebug(td, p) : + p_cansee(td, p)) != 0) { PROC_UNLOCK(p); continue; } From nobody Tue Oct 19 20:35:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BBF9018066E9; Tue, 19 Oct 2021 20:35:22 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYlqZ4Jjxz4qgJ; Tue, 19 Oct 2021 20:35:22 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id cmw0m9mfqczbLcvpMmsRma; Tue, 19 Oct 2021 20:35:16 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id cvpKmIiiDa8XRcvpLmrMdE; Tue, 19 Oct 2021 20:35:16 +0000 X-Authority-Analysis: v=2.4 cv=Ov8sdwzt c=1 sm=1 tr=0 ts=616f2c04 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=8gfv0ekSlNoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=hKvH7l_OExtEQXvJCF4A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 90EB2590; Tue, 19 Oct 2021 13:35:13 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19JKZDqM026085; Tue, 19 Oct 2021 13:35:13 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110192035.19JKZDqM026085@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Konstantin Belousov cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven In-reply-to: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> Comments: In-reply-to Konstantin Belousov message dated "Tue, 19 Oct 2021 20:04:45 +0000." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 19 Oct 2021 13:35:13 -0700 X-CMAE-Envelope: MS4xfAy3Wl8Knz7fpbJbwbPhs97kltqAw7sLhEHxv+Igmu1XiqOph3mdIFT/4u6WbX06/hIWu0Vy+TTnQVF0FSiYlVGr0+t3LmdHgCAHe70XrvRFU8GH8OqV 7xfbuvBK2nKIf8u0JkcWKpDnUF5k3V98PijcmkMQpGicvdfssgXa50kVKmjrKgULiAY4kdUH4ZF39L6dpxkJiDHirXVfNfEtAo2zpEOhAZpPq4P7ZV641UxZ KY0vJj1YTzz0FXjLfj0odTY/fQGrd1mTJJSRku4HUfoziEepwoGvSyDtoRrABbYT151a41lJitDbsssIjwObJ0wF7UMA13/bQLYTcXFma3Y= X-Rspamd-Queue-Id: 4HYlqZ4Jjxz4qgJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin Belous ov writes: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d3a0 > 72e08bc6 > > commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 > Author: Konstantin Belousov > AuthorDate: 2021-10-15 18:57:17 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-10-19 20:04:34 +0000 > > kern_procctl(): convert the function to be table-driven > > Reviewed by: emaste, markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D32513 > --- > sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++------------------- > -- > 1 file changed, 69 insertions(+), 54 deletions(-) > > diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c > index eb36f0822938..90c5e63c7219 100644 > --- a/sys/kern/kern_procctl.c > +++ b/sys/kern/kern_procctl.c > @@ -656,6 +656,57 @@ wxmap_status(struct thread *td, struct proc *p, int *dat > a) > return (0); > } > > +struct procctl_cmd_info { > + int lock_tree; > + bool one_proc : 1; > +}; > +static const struct procctl_cmd_info procctl_cmds_info[] = { > + [PROC_SPROTECT] = > + { .lock_tree = SA_SLOCKED, .one_proc = false, }, > + [PROC_REAP_ACQUIRE] = > + { .lock_tree = SA_XLOCKED, .one_proc = true, }, > + [PROC_REAP_RELEASE] = > + { .lock_tree = SA_XLOCKED, .one_proc = true, }, > + [PROC_REAP_STATUS] = > + { .lock_tree = SA_SLOCKED, .one_proc = true, }, > + [PROC_REAP_GETPIDS] = > + { .lock_tree = SA_SLOCKED, .one_proc = true, }, > + [PROC_REAP_KILL] = > + { .lock_tree = SA_SLOCKED, .one_proc = true, }, > + [PROC_TRACE_CTL] = > + { .lock_tree = SA_SLOCKED, .one_proc = false, }, > + [PROC_TRACE_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_TRAPCAP_CTL] = > + { .lock_tree = SA_SLOCKED, .one_proc = false, }, > + [PROC_TRAPCAP_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_PDEATHSIG_CTL] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_PDEATHSIG_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_ASLR_CTL] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_ASLR_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_PROTMAX_CTL] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_PROTMAX_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_STACKGAP_CTL] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_STACKGAP_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_NO_NEW_PRIVS_CTL] = > + { .lock_tree = SA_SLOCKED, .one_proc = true, }, > + [PROC_NO_NEW_PRIVS_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_WXMAP_CTL] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > + [PROC_WXMAP_STATUS] = > + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, > +}; > + > int > sys_procctl(struct thread *td, struct procctl_args *uap) > { > @@ -812,33 +863,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t i > d, int com, void *data) > { > struct pgrp *pg; > struct proc *p; > + const struct procctl_cmd_info *cmd_info; > int error, first_error, ok; > int signum; > - bool tree_locked; > > - switch (com) { > - case PROC_ASLR_CTL: > - case PROC_ASLR_STATUS: > - case PROC_PROTMAX_CTL: > - case PROC_PROTMAX_STATUS: > - case PROC_REAP_ACQUIRE: > - case PROC_REAP_RELEASE: > - case PROC_REAP_STATUS: > - case PROC_REAP_GETPIDS: > - case PROC_REAP_KILL: > - case PROC_STACKGAP_CTL: > - case PROC_STACKGAP_STATUS: > - case PROC_TRACE_STATUS: > - case PROC_TRAPCAP_STATUS: > - case PROC_PDEATHSIG_CTL: > - case PROC_PDEATHSIG_STATUS: > - case PROC_NO_NEW_PRIVS_CTL: > - case PROC_NO_NEW_PRIVS_STATUS: > - case PROC_WXMAP_CTL: > - case PROC_WXMAP_STATUS: > - if (idtype != P_PID) > - return (EINVAL); > - } > + MPASS(com > 0 && com < nitems(procctl_cmds_info)); > + cmd_info = &procctl_cmds_info[com]; > + if (idtype != P_PID && cmd_info->one_proc) > + return (EINVAL); > > switch (com) { > case PROC_PDEATHSIG_CTL: > @@ -861,37 +893,13 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t i > d, int com, void *data) > return (0); > } > > - switch (com) { > - case PROC_SPROTECT: > - case PROC_REAP_STATUS: > - case PROC_REAP_GETPIDS: > - case PROC_REAP_KILL: > - case PROC_TRACE_CTL: > - case PROC_TRAPCAP_CTL: > - case PROC_NO_NEW_PRIVS_CTL: > - sx_slock(&proctree_lock); > - tree_locked = true; > - break; > - case PROC_REAP_ACQUIRE: > - case PROC_REAP_RELEASE: > + switch (cmd_info->lock_tree) { > + case SA_XLOCKED: > sx_xlock(&proctree_lock); > - tree_locked = true; > break; > - case PROC_ASLR_CTL: > - case PROC_ASLR_STATUS: > - case PROC_PROTMAX_CTL: > - case PROC_PROTMAX_STATUS: > - case PROC_STACKGAP_CTL: > - case PROC_STACKGAP_STATUS: > - case PROC_TRACE_STATUS: > - case PROC_TRAPCAP_STATUS: > - case PROC_NO_NEW_PRIVS_STATUS: > - case PROC_WXMAP_CTL: > - case PROC_WXMAP_STATUS: > - tree_locked = false; > + case SA_SLOCKED: > + sx_slock(&proctree_lock); > break; > - default: > - return (EINVAL); > } > > switch (idtype) { > @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id > , int com, void *data) > error = EINVAL; > break; > } > - if (tree_locked) > - sx_unlock(&proctree_lock); > + > + switch (cmd_info->lock_tree) { > + case SA_XLOCKED: > + sx_xunlock(&proctree_lock); > + break; > + case SA_SLOCKED: > + sx_sunlock(&proctree_lock); > + break; > + } > return (error); > } > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas LA_* in sys/lock.h has no such requirement. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Oct 19 20:40:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5F16218099EA; Tue, 19 Oct 2021 20:40:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYlxS2GJPz4s82; Tue, 19 Oct 2021 20:40:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id A152F1706; Tue, 19 Oct 2021 20:40:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven To: Cy Schubert , Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> From: John Baldwin Message-ID: <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> Date: Tue, 19 Oct 2021 13:40:26 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110192035.19JKZDqM026085@slippy.cwsent.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/19/21 1:35 PM, Cy Schubert wrote: > In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin > Belous > ov writes: >> The branch main has been updated by kib: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d3a0 >> 72e08bc6 >> >> commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 >> Author: Konstantin Belousov >> AuthorDate: 2021-10-15 18:57:17 +0000 >> Commit: Konstantin Belousov >> CommitDate: 2021-10-19 20:04:34 +0000 >> >> kern_procctl(): convert the function to be table-driven >> >> Reviewed by: emaste, markj >> Sponsored by: The FreeBSD Foundation >> MFC after: 1 week >> Differential revision: https://reviews.freebsd.org/D32513 >> --- >> sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++------------------- >> -- >> 1 file changed, 69 insertions(+), 54 deletions(-) >> >> diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c >> index eb36f0822938..90c5e63c7219 100644 >> --- a/sys/kern/kern_procctl.c >> +++ b/sys/kern/kern_procctl.c >> @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id >> , int com, void *data) >> error = EINVAL; >> break; >> } >> - if (tree_locked) >> - sx_unlock(&proctree_lock); >> + >> + switch (cmd_info->lock_tree) { >> + case SA_XLOCKED: >> + sx_xunlock(&proctree_lock); >> + break; >> + case SA_SLOCKED: >> + sx_sunlock(&proctree_lock); >> + break; >> + } >> return (error); >> } >> > > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas > LA_* in sys/lock.h has no such requirement. Both are for "assertions". The LA_* constants aren't really public but are the values used for witness_assert() that various foo_assert() routines in locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the type-specific macros are the ones you use, e.g. SA_* with sx_assert(). Given that, SA_* is the closest match here. -- John Baldwin From nobody Tue Oct 19 20:51:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 83485180CA1D; Tue, 19 Oct 2021 20:51:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYmBL2Ybzz4v5W; Tue, 19 Oct 2021 20:51:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id clgLmlwDpps7Pcw5BmMq4Z; Tue, 19 Oct 2021 20:51:37 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id cw59m5oJeXoZRcw5BmaK1Y; Tue, 19 Oct 2021 20:51:37 +0000 X-Authority-Analysis: v=2.4 cv=R8NgpfdX c=1 sm=1 tr=0 ts=616f2fd9 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=8gfv0ekSlNoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=uYMzMxvLi9Vu3-3Hz7EA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 7AC98554; Tue, 19 Oct 2021 13:51:34 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19JKpV66059807; Tue, 19 Oct 2021 13:51:32 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110192051.19JKpV66059807@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: John Baldwin cc: Cy Schubert , Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven In-reply-to: <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> Comments: In-reply-to John Baldwin message dated "Tue, 19 Oct 2021 13:40:26 -0700." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 19 Oct 2021 13:51:31 -0700 X-CMAE-Envelope: MS4xfD0v5VugFG5qoKsPUtWx7tgCnj25LKn6HpsVyJb3mr+GIzTM0F4zbWln5yFv7soVDEFJRz0dE9j6if2UtEiHWOw0gGVbCxpdY1df7ShGde97tAvg8Apz Xx0Z8xF3GCNJO6iCziJpkm90i0qutlDtHVvD0NYb7hBy8QpA0+jqAQwX4VPGPUDeI1Nmw5Wp2MSs5B3K5RCR0tTCpS7plDCub4jVavoCoshzRvhozmlvRSGK 5Ik9Y1VTUwjwf2rOMsK+zBOCnHRGZcd3t0V08ye72HckePIsHVMI/i92RkrY0GtOXxwzzlavhQ34wPw4te/yNYa3uom3AQKVAhxqQ5kSF62ZOdZh2e0grRxV veU12rrZ X-Rspamd-Queue-Id: 4HYmBL2Ybzz4v5W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org>, John Baldwin wri tes: > On 10/19/21 1:35 PM, Cy Schubert wrote: > > In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin > > Belous > > ov writes: > >> The branch main has been updated by kib: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d > 3a0 > >> 72e08bc6 > >> > >> commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 > >> Author: Konstantin Belousov > >> AuthorDate: 2021-10-15 18:57:17 +0000 > >> Commit: Konstantin Belousov > >> CommitDate: 2021-10-19 20:04:34 +0000 > >> > >> kern_procctl(): convert the function to be table-driven > >> > >> Reviewed by: emaste, markj > >> Sponsored by: The FreeBSD Foundation > >> MFC after: 1 week > >> Differential revision: https://reviews.freebsd.org/D32513 > >> --- > >> sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------- > ---- > >> -- > >> 1 file changed, 69 insertions(+), 54 deletions(-) > >> > >> diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c > >> index eb36f0822938..90c5e63c7219 100644 > >> --- a/sys/kern/kern_procctl.c > >> +++ b/sys/kern/kern_procctl.c > >> @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t > id > >> , int com, void *data) > >> error = EINVAL; > >> break; > >> } > >> - if (tree_locked) > >> - sx_unlock(&proctree_lock); > >> + > >> + switch (cmd_info->lock_tree) { > >> + case SA_XLOCKED: > >> + sx_xunlock(&proctree_lock); > >> + break; > >> + case SA_SLOCKED: > >> + sx_sunlock(&proctree_lock); > >> + break; > >> + } > >> return (error); > >> } > >> > > > > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas > > LA_* in sys/lock.h has no such requirement. > > Both are for "assertions". The LA_* constants aren't really public but are > the values used for witness_assert() that various foo_assert() routines in > locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the > type-specific macros are the ones you use, e.g. SA_* with sx_assert(). > > Given that, SA_* is the closest match here. We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands buildkernel is broken. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Oct 19 21:04:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4DAEB1812198; Tue, 19 Oct 2021 21:04:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYmSx1XDWz3F70; Tue, 19 Oct 2021 21:04:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 847F71C84; Tue, 19 Oct 2021 21:04:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven To: Cy Schubert Cc: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> <202110192051.19JKpV66059807@slippy.cwsent.com> From: John Baldwin Message-ID: Date: Tue, 19 Oct 2021 14:04:15 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110192051.19JKpV66059807@slippy.cwsent.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/19/21 1:51 PM, Cy Schubert wrote: > In message <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org>, John Baldwin > wri > tes: >> On 10/19/21 1:35 PM, Cy Schubert wrote: >>> In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin >>> Belous >>> ov writes: >>>> The branch main has been updated by kib: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d >> 3a0 >>>> 72e08bc6 >>>> >>>> commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 >>>> Author: Konstantin Belousov >>>> AuthorDate: 2021-10-15 18:57:17 +0000 >>>> Commit: Konstantin Belousov >>>> CommitDate: 2021-10-19 20:04:34 +0000 >>>> >>>> kern_procctl(): convert the function to be table-driven >>>> >>>> Reviewed by: emaste, markj >>>> Sponsored by: The FreeBSD Foundation >>>> MFC after: 1 week >>>> Differential revision: https://reviews.freebsd.org/D32513 >>>> --- >>>> sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------- >> ---- >>>> -- >>>> 1 file changed, 69 insertions(+), 54 deletions(-) >>>> >>>> diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c >>>> index eb36f0822938..90c5e63c7219 100644 >>>> --- a/sys/kern/kern_procctl.c >>>> +++ b/sys/kern/kern_procctl.c >>>> @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t >> id >>>> , int com, void *data) >>>> error = EINVAL; >>>> break; >>>> } >>>> - if (tree_locked) >>>> - sx_unlock(&proctree_lock); >>>> + >>>> + switch (cmd_info->lock_tree) { >>>> + case SA_XLOCKED: >>>> + sx_xunlock(&proctree_lock); >>>> + break; >>>> + case SA_SLOCKED: >>>> + sx_sunlock(&proctree_lock); >>>> + break; >>>> + } >>>> return (error); >>>> } >>>> >>> >>> Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas >>> LA_* in sys/lock.h has no such requirement. >> >> Both are for "assertions". The LA_* constants aren't really public but are >> the values used for witness_assert() that various foo_assert() routines in >> locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the >> type-specific macros are the ones you use, e.g. SA_* with sx_assert(). >> >> Given that, SA_* is the closest match here. > > We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands > buildkernel is broken. So it is helpeful if your e-mail starts with "the build is broken". :) That said, I think the issue is that SA_* (and LA_*) have to date only been used for assertions and are thus only relevant when INVARIANTS is defined. It's probably simplest to just expose SA_* always if that is what is needed. -- John Baldwin From nobody Tue Oct 19 21:26:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7911B17EDAD4; Tue, 19 Oct 2021 21:26: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYmyj1wWvz3MkT; Tue, 19 Oct 2021 21:26:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EEE51B801; Tue, 19 Oct 2021 21:26:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JLQaqf076666; Tue, 19 Oct 2021 21:26:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JLQaNT076665; Tue, 19 Oct 2021 21:26:36 GMT (envelope-from git) Date: Tue, 19 Oct 2021 21:26:36 GMT Message-Id: <202110192126.19JLQaNT076665@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: c7f38a2df1f0 - main - procctl: stop using SA_*LOCKED, define local enum List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7f38a2df1f0d15346f4405407d89365f6ae3fe1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c7f38a2df1f0d15346f4405407d89365f6ae3fe1 commit c7f38a2df1f0d15346f4405407d89365f6ae3fe1 Author: Konstantin Belousov AuthorDate: 2021-10-19 21:25:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-19 21:25:19 +0000 procctl: stop using SA_*LOCKED, define local enum Using SA_*LOCKED constants breaks !INVARIANT builds Reported by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_procctl.c | 62 ++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 00c68359f375..f90c0e146e2b 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -705,6 +705,12 @@ pdeathsig_status(struct thread *td, struct proc *p, void *data) return (0); } +enum { + PCTL_SLOCKED, + PCTL_XLOCKED, + PCTL_UNLOCKED, +}; + struct procctl_cmd_info { int lock_tree; bool one_proc : 1; @@ -718,136 +724,136 @@ struct procctl_cmd_info { }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, + { .lock_tree = PCTL_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, + { .lock_tree = PCTL_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(struct procctl_reaper_status), .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_pids), .copyout_sz = 0, .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_kill), .copyout_sz = sizeof(struct procctl_reaper_kill), .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), @@ -915,12 +921,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) return (EINVAL); switch (cmd_info->lock_tree) { - case SA_XLOCKED: + case PCTL_XLOCKED: sx_xlock(&proctree_lock); break; - case SA_SLOCKED: + case PCTL_SLOCKED: sx_slock(&proctree_lock); break; + default: + break; } switch (idtype) { @@ -991,12 +999,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) } switch (cmd_info->lock_tree) { - case SA_XLOCKED: + case PCTL_XLOCKED: sx_xunlock(&proctree_lock); break; - case SA_SLOCKED: + case PCTL_SLOCKED: sx_sunlock(&proctree_lock); break; + default: + break; } return (error); } From nobody Tue Oct 19 21:27:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B67B117EE25F; Tue, 19 Oct 2021 21:27:35 +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 4HYmzq301lz3N5q; Tue, 19 Oct 2021 21:27:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19JLRGfB041640 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 20 Oct 2021 00:27:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19JLRGfB041640 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19JLRGQC041639; Wed, 20 Oct 2021 00:27:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 20 Oct 2021 00:27:16 +0300 From: Konstantin Belousov To: John Baldwin Cc: Cy Schubert , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven Message-ID: References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> <202110192051.19JKpV66059807@slippy.cwsent.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HYmzq301lz3N5q X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 02:04:15PM -0700, John Baldwin wrote: > On 10/19/21 1:51 PM, Cy Schubert wrote: > > In message <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org>, John Baldwin > > wri > > tes: > > > On 10/19/21 1:35 PM, Cy Schubert wrote: > > > > In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin > > > > Belous > > > > ov writes: > > > > > The branch main has been updated by kib: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d > > > 3a0 > > > > > 72e08bc6 > > > > > > > > > > commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 > > > > > Author: Konstantin Belousov > > > > > AuthorDate: 2021-10-15 18:57:17 +0000 > > > > > Commit: Konstantin Belousov > > > > > CommitDate: 2021-10-19 20:04:34 +0000 > > > > > > > > > > kern_procctl(): convert the function to be table-driven > > > > > Reviewed by: emaste, markj > > > > > Sponsored by: The FreeBSD Foundation > > > > > MFC after: 1 week > > > > > Differential revision: https://reviews.freebsd.org/D32513 > > > > > --- > > > > > sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------- > > > ---- > > > > > -- > > > > > 1 file changed, 69 insertions(+), 54 deletions(-) > > > > > > > > > > diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c > > > > > index eb36f0822938..90c5e63c7219 100644 > > > > > --- a/sys/kern/kern_procctl.c > > > > > +++ b/sys/kern/kern_procctl.c > > > > > @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t > > > id > > > > > , int com, void *data) > > > > > error = EINVAL; > > > > > break; > > > > > } > > > > > - if (tree_locked) > > > > > - sx_unlock(&proctree_lock); > > > > > + > > > > > + switch (cmd_info->lock_tree) { > > > > > + case SA_XLOCKED: > > > > > + sx_xunlock(&proctree_lock); > > > > > + break; > > > > > + case SA_SLOCKED: > > > > > + sx_sunlock(&proctree_lock); > > > > > + break; > > > > > + } > > > > > return (error); > > > > > } > > > > > > > > > > > > > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas > > > > LA_* in sys/lock.h has no such requirement. > > > > > > Both are for "assertions". The LA_* constants aren't really public but are > > > the values used for witness_assert() that various foo_assert() routines in > > > locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the > > > type-specific macros are the ones you use, e.g. SA_* with sx_assert(). > > > > > > Given that, SA_* is the closest match here. > > > > We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands > > buildkernel is broken. > > So it is helpeful if your e-mail starts with "the build is broken". :) > > That said, I think the issue is that SA_* (and LA_*) have to date only been > used for assertions and are thus only relevant when INVARIANTS is defined. > It's probably simplest to just expose SA_* always if that is what is > needed. Should be fixed by c7f38a2df1f0. From nobody Tue Oct 19 21:28:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 17FE817EE902; Tue, 19 Oct 2021 21:28:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYn0X6Tbkz3NmR; Tue, 19 Oct 2021 21:28:12 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id cnXem9nbQczbLcweamsgTT; Tue, 19 Oct 2021 21:28:12 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id cweZm64S4XoZRcweamaRiB; Tue, 19 Oct 2021 21:28:12 +0000 X-Authority-Analysis: v=2.4 cv=R8NgpfdX c=1 sm=1 tr=0 ts=616f386c a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=8gfv0ekSlNoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=-Yqpzd8UySGSmqUZtDMA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 90C31573; Tue, 19 Oct 2021 14:28:10 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19JLSAfC019369; Tue, 19 Oct 2021 14:28:10 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110192128.19JLSAfC019369@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: John Baldwin cc: Cy Schubert , Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven In-reply-to: References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> <202110192051.19JKpV66059807@slippy.cwsent.com> Comments: In-reply-to John Baldwin message dated "Tue, 19 Oct 2021 14:04:15 -0700." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 19 Oct 2021 14:28:10 -0700 X-CMAE-Envelope: MS4xfKV1tNt4CAslWBPjlAMVrCsA+vWYTgDX6ezWBHMrYKTbxP8lkaUcLLt+v5r7LTfuBJQh5w9QppS+vmXhOc6mmORrNMVy46xSwr6KJZzflbPrvQU1x+qH GtVGhAVw9/NcsU4qgCWXP1bzWpCZnmhjApeuHOsp6n5hryoDgx9TBoCzjjmOmzI5uQ0DAN0WiCk5rkxlzdwQxAxG1X99NO4WDa0LKSmKfi4cGcu6d80Gv5rB B2d1LeL9reGbOZnNdrh2N/FAtSRwVWj8UyBLja5upa3batEMqK5b6EduifBC6kcBvED6CUxAGzUjQYW/KFlQ+TnEeMxXvTb4B46jXhbgcgUKNRO1rE4xuW6C +8QZKo3w X-Rspamd-Queue-Id: 4HYn0X6Tbkz3NmR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , John Baldwin wri tes: > On 10/19/21 1:51 PM, Cy Schubert wrote: > > In message <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org>, John Baldwin > > wri > > tes: > >> On 10/19/21 1:35 PM, Cy Schubert wrote: > >>> In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin > >>> Belous > >>> ov writes: > >>>> The branch main has been updated by kib: > >>>> > >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a37 > 9d > >> 3a0 > >>>> 72e08bc6 > >>>> > >>>> commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 > >>>> Author: Konstantin Belousov > >>>> AuthorDate: 2021-10-15 18:57:17 +0000 > >>>> Commit: Konstantin Belousov > >>>> CommitDate: 2021-10-19 20:04:34 +0000 > >>>> > >>>> kern_procctl(): convert the function to be table-driven > >>>> > >>>> Reviewed by: emaste, markj > >>>> Sponsored by: The FreeBSD Foundation > >>>> MFC after: 1 week > >>>> Differential revision: https://reviews.freebsd.org/D32513 > >>>> --- > >>>> sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++------------ > --- > >> ---- > >>>> -- > >>>> 1 file changed, 69 insertions(+), 54 deletions(-) > >>>> > >>>> diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c > >>>> index eb36f0822938..90c5e63c7219 100644 > >>>> --- a/sys/kern/kern_procctl.c > >>>> +++ b/sys/kern/kern_procctl.c > >>>> @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id > _t > >> id > >>>> , int com, void *data) > >>>> error = EINVAL; > >>>> break; > >>>> } > >>>> - if (tree_locked) > >>>> - sx_unlock(&proctree_lock); > >>>> + > >>>> + switch (cmd_info->lock_tree) { > >>>> + case SA_XLOCKED: > >>>> + sx_xunlock(&proctree_lock); > >>>> + break; > >>>> + case SA_SLOCKED: > >>>> + sx_sunlock(&proctree_lock); > >>>> + break; > >>>> + } > >>>> return (error); > >>>> } > >>>> > >>> > >>> Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas > >>> LA_* in sys/lock.h has no such requirement. > >> > >> Both are for "assertions". The LA_* constants aren't really public but ar > e > >> the values used for witness_assert() that various foo_assert() routines in > >> locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the > >> type-specific macros are the ones you use, e.g. SA_* with sx_assert(). > >> > >> Given that, SA_* is the closest match here. > > > > We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands > > buildkernel is broken. > > So it is helpeful if your e-mail starts with "the build is broken". :) Sorry about that. Next time I will. > > That said, I think the issue is that SA_* (and LA_*) have to date only been > used for assertions and are thus only relevant when INVARIANTS is defined. > It's probably simplest to just expose SA_* always if that is what is > needed. Thinking the same thing. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Oct 19 23:20:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8B5E917F761E; Tue, 19 Oct 2021 23:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYqV930bfz4bb9; Tue, 19 Oct 2021 23:20:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46ECC1CB4A; Tue, 19 Oct 2021 23:20:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JNKXLh031218; Tue, 19 Oct 2021 23:20:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JNKXd2031217; Tue, 19 Oct 2021 23:20:33 GMT (envelope-from git) Date: Tue, 19 Oct 2021 23:20:33 GMT Message-Id: <202110192320.19JNKXd2031217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 81184e92e0d7 - stable/13 - makesyscalls.lua: Add a new syscall type: RESERVED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 81184e92e0d73714096bd49857670e3629994ce2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=81184e92e0d73714096bd49857670e3629994ce2 commit 81184e92e0d73714096bd49857670e3629994ce2 Author: Brooks Davis AuthorDate: 2021-10-19 23:19:56 +0000 Commit: Brooks Davis CommitDate: 2021-10-19 23:19:56 +0000 makesyscalls.lua: Add a new syscall type: RESERVED RESERVED syscall number are reserved for local/vendor use. RESERVED is identical to UNIMPL except that comments are ignored. Reviewed by: kevans Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27988 (cherry picked from commit 119fa6ee8a8056aab5e4ab1719d3c563cdb4a95a) --- sys/kern/syscalls.master | 3 ++- sys/tools/makesyscalls.lua | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index d3ec771aac6f..81f016a0c073 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -11,7 +11,7 @@ ; there is no audit event for the call at this time. For the ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6, +; type one of STD, OBSOL, RESERVED, UNIMPL, COMPAT, COMPAT4, COMPAT6, ; COMPAT7, COMPAT11, COMPAT12, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) @@ -32,6 +32,7 @@ ; COMPAT11 included on COMPAT_FREEBSD11 #ifdef (FreeBSD 11 compat) ; COMPAT12 included on COMPAT_FREEBSD12 #ifdef (FreeBSD 12 compat) ; OBSOL obsolete, not included in system, only specifies name +; RESERVED reserved for local or vendor use ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically ; compiled in; sysent entry will be filled with lkmressys diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 85b76a44150c..49a9e283e646 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -148,12 +148,13 @@ local known_abi_flags = { local known_flags = { STD = 0x00000001, OBSOL = 0x00000002, - UNIMPL = 0x00000004, - NODEF = 0x00000008, - NOARGS = 0x00000010, - NOPROTO = 0x00000020, - NOSTD = 0x00000040, - NOTSTATIC = 0x00000080, + RESERVED = 0x00000004, + UNIMPL = 0x00000008, + NODEF = 0x00000010, + NOARGS = 0x00000020, + NOPROTO = 0x00000040, + NOSTD = 0x00000080, + NOTSTATIC = 0x00000100, -- Compat flags start from here. We have plenty of space. } @@ -906,6 +907,10 @@ local function handle_unimpl(sysnum, sysstart, sysend, comment) end end +local function handle_reserved(sysnum, sysstart, sysend, comment) + handle_unimpl(sysnum, sysstart, sysend, "reserved for local use") +end + process_syscall_def = function(line) local sysstart, sysend, flags, funcname, sysflags local thr_flag, syscallret @@ -950,8 +955,8 @@ process_syscall_def = function(line) flags = flags | known_flags[flag] end - if (flags & known_flags["UNIMPL"]) == 0 and sysnum == nil then - abort(1, "Range only allowed with UNIMPL: " .. line) + if (flags & get_mask({"RESERVED", "UNIMPL"})) == 0 and sysnum == nil then + abort(1, "Range only allowed with RESERVED and UNIMPL: " .. line) end if (flags & known_flags["NOTSTATIC"]) ~= 0 then @@ -1115,6 +1120,8 @@ process_syscall_def = function(line) argalias) elseif flags & known_flags["OBSOL"] ~= 0 then handle_obsol(sysnum, funcname, funcomment) + elseif flags & known_flags["RESERVED"] ~= 0 then + handle_reserved(sysnum, sysstart, sysend) elseif flags & known_flags["UNIMPL"] ~= 0 then handle_unimpl(sysnum, sysstart, sysend, funcomment) else From nobody Tue Oct 19 23:20:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AA35417F7683; Tue, 19 Oct 2021 23:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYqVB3ztTz4bsQ; Tue, 19 Oct 2021 23:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68EC21CBBF; Tue, 19 Oct 2021 23:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JNKYot031249; Tue, 19 Oct 2021 23:20:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JNKY8x031248; Tue, 19 Oct 2021 23:20:34 GMT (envelope-from git) Date: Tue, 19 Oct 2021 23:20:34 GMT Message-Id: <202110192320.19JNKY8x031248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: fe388671ac85 - stable/13 - makesyscalls.lua: add a CAPENABLED flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe388671ac851292f59926e96f2c86e6e46ea218 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=fe388671ac851292f59926e96f2c86e6e46ea218 commit fe388671ac851292f59926e96f2c86e6e46ea218 Author: Brooks Davis AuthorDate: 2021-10-19 23:19:56 +0000 Commit: Brooks Davis CommitDate: 2021-10-19 23:19:56 +0000 makesyscalls.lua: add a CAPENABLED flag The CAPENABLED flag indicates that the syscall can be used in capsicum capability mode. It is intended to replace capabilities.conf. Reviewed by: kevans, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D31349 (cherry picked from commit 6945df3fff57a9606f8c8a4e3865def3a0e915e7) --- sys/kern/syscalls.master | 2 ++ sys/tools/makesyscalls.lua | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 81f016a0c073..51ff07f8deed 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -15,6 +15,7 @@ ; COMPAT7, COMPAT11, COMPAT12, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) +; The CAPENABLED option may be ORed into a type. ; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different @@ -45,6 +46,7 @@ ; function prototype in sys/sysproto.h. Does add a ; definition to syscall.h besides adding a sysent. ; NOTSTATIC syscall is loadable +; CAPENABLED syscall is allowed in capability mode ; annotations: ; SAL 2.0 annotations are used to specify how system calls treat diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 49a9e283e646..dba9488b11a8 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -155,6 +155,7 @@ local known_flags = { NOPROTO = 0x00000040, NOSTD = 0x00000080, NOTSTATIC = 0x00000100, + CAPENABLED = 0x00000200, -- Compat flags start from here. We have plenty of space. } @@ -1060,7 +1061,8 @@ process_syscall_def = function(line) -- If applicable; strip the ABI prefix from the name local stripped_name = strip_abi_prefix(funcname) - if config["capenabled"][funcname] ~= nil or + if flags & known_flags['CAPENABLED'] ~= 0 or + config["capenabled"][funcname] ~= nil or config["capenabled"][stripped_name] ~= nil then sysflags = "SYF_CAPENABLED" end From nobody Tue Oct 19 23:20:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BB5F017F75A7; Tue, 19 Oct 2021 23:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYqVD0VDJz4blM; Tue, 19 Oct 2021 23:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 982611CF86; Tue, 19 Oct 2021 23:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JNKZwB031273; Tue, 19 Oct 2021 23:20:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JNKZIS031272; Tue, 19 Oct 2021 23:20:35 GMT (envelope-from git) Date: Tue, 19 Oct 2021 23:20:35 GMT Message-Id: <202110192320.19JNKZIS031272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 3b55b6137195 - stable/13 - selsocket: handle sopoll() errors correctly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3b55b6137195ee116680590c1d3c4416a88fee2e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=3b55b6137195ee116680590c1d3c4416a88fee2e commit 3b55b6137195ee116680590c1d3c4416a88fee2e Author: Brooks Davis AuthorDate: 2021-10-19 23:19:57 +0000 Commit: Brooks Davis CommitDate: 2021-10-19 23:19:57 +0000 selsocket: handle sopoll() errors correctly Without this change, unmounting smbfs filesystems with an INVARIANTS kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb. PR: 253079 Found by: markj Reviewed by: markj, jhb Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D32492 (cherry picked from commit 04c91ac48ad13ce0d1392cedbd69c2c0223d206f) --- sys/kern/sys_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 09c60611e755..0fcb93545e86 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1709,10 +1709,10 @@ selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td) */ for (;;) { selfdalloc(td, NULL); - error = sopoll(so, events, NULL, td); - /* error here is actually the ready events. */ - if (error) - return (0); + if (sopoll(so, events, NULL, td) != 0) { + error = 0; + break; + } error = seltdwait(td, asbt, precision); if (error) break; From nobody Tue Oct 19 23:22:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 384A217F908B; Tue, 19 Oct 2021 23:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYqXY0wCrz4dVr; Tue, 19 Oct 2021 23:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00C7A1CE3A; Tue, 19 Oct 2021 23:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19JNMaPw035625; Tue, 19 Oct 2021 23:22:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19JNMaFC035624; Tue, 19 Oct 2021 23:22:36 GMT (envelope-from git) Date: Tue, 19 Oct 2021 23:22:36 GMT Message-Id: <202110192322.19JNMaFC035624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 1f64f93a0921 - stable/13 - nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1f64f93a0921fad407dd4cfbbea06a831288cf78 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1f64f93a0921fad407dd4cfbbea06a831288cf78 commit 1f64f93a0921fad407dd4cfbbea06a831288cf78 Author: Rick Macklem AuthorDate: 2021-09-27 01:37:25 +0000 Commit: Rick Macklem CommitDate: 2021-10-19 23:19:40 +0000 nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg() Commit 5e5ca4c8fc53 added a flag to a NFSv4 mount point that is set when the first delegation is acquired from the NFSv4 server. For a common case where delegations are not being issued by the NFSv4 server, the nfscl_removedeleg() code acquires the mutex lock for open/lock state, finds the delegation list empty, then just unlocks the mutex and returns. This patch adds a check of the flag to avoid the need to acquire the mutex for this common case. This change appears to be performance neutral for a small number of opens, but should reduce lock contention for a large number of opens for the common case where server is not issuing delegations. This commit should not affect the high level semantics of delegation handling. (cherry picked from commit 62c5be4ab4c8b8127185286e148638cb8cdf45f4) --- sys/fs/nfsclient/nfs_clstate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index bb2c78a72ed9..8d1c4de0ba8e 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4606,6 +4606,12 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; nmp = VFSTONFS(vp->v_mount); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (retcnt); + } + NFSUNLOCKMNT(nmp); np = VTONFS(vp); NFSLOCKCLSTATE(); /* From nobody Wed Oct 20 00:11:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 44C3417C48D8; Wed, 20 Oct 2021 00:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrcj1Yl4z4qm7; Wed, 20 Oct 2021 00:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1624C1D7B8; Wed, 20 Oct 2021 00:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0BHkb000285; Wed, 20 Oct 2021 00:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0BHNB000284; Wed, 20 Oct 2021 00:11:17 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:11:17 GMT Message-Id: <202110200011.19K0BHNB000284@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: 1c99af1ebe61 - main - libssh: Rearrange Makefile SRCS to match upstream Makefile.in List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c99af1ebe61cbaf633792941640dcd254acf921 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1c99af1ebe61cbaf633792941640dcd254acf921 commit 1c99af1ebe61cbaf633792941640dcd254acf921 Author: Ed Maste AuthorDate: 2021-10-20 00:09:46 +0000 Commit: Ed Maste CommitDate: 2021-10-20 00:10:56 +0000 libssh: Rearrange Makefile SRCS to match upstream Makefile.in SRCS entries are kept in the same order and with the same line breaks as upstream, to make comparison easier. Reported by: des --- secure/lib/libssh/Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index e835ef3c1b2a..49b5319d2b54 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -5,7 +5,7 @@ LIB= ssh PRIVATELIB= true SHLIB_MAJOR= 5 -SRCS= ssh_api.c ssh-sk-client.c ssh-ecdsa-sk.c ssh-ed25519-sk.c ssherr.c \ +SRCS= ssh_api.c ssherr.c \ sshbuf.c sshkey.c sshbuf-getput-basic.c \ sshbuf-misc.c sshbuf-getput-crypto.c krl.c bitmap.c SRCS+= authfd.c authfile.c \ @@ -15,17 +15,20 @@ SRCS+= authfd.c authfile.c \ log.c match.c moduli.c nchan.c packet.c \ readpass.c ttymodes.c xmalloc.c addr.c addrmatch.c \ atomicio.c dispatch.c mac.c misc.c utf8.c \ - monitor_fdpass.c rijndael.c ssh-dss.c ssh-ecdsa.c ssh-rsa.c dh.c \ + monitor_fdpass.c rijndael.c ssh-dss.c ssh-ecdsa.c ssh-ecdsa-sk.c \ + ssh-ed25519-sk.c ssh-rsa.c dh.c \ msg.c progressmeter.c dns.c entropy.c umac.c umac128.c \ ssh-pkcs11.c smult_curve25519_ref.c \ poly1305.c chacha.c cipher-chachapoly.c cipher-chachapoly-libcrypto.c \ - ssh-ed25519.c digest-openssl.c digest-libc.c hmac.c \ - sc25519.c ge25519.c fe25519.c ed25519.c verify.c hash.c \ + ssh-ed25519.c digest-openssl.c digest-libc.c \ + hmac.c sc25519.c ge25519.c fe25519.c ed25519.c verify.c hash.c \ kex.c kexdh.c kexgex.c kexecdh.c kexc25519.c \ kexgexc.c kexgexs.c \ kexsntrup761x25519.c sntrup761.c kexgen.c \ sftp-realpath.c platform-pledge.c platform-tracing.c platform-misc.c \ sshbuf-io.c +SRCS+= ssh-sk-client.c + PACKAGE= ssh # gss-genr.c should be in $SRCS but causes linking problems, so it is From nobody Wed Oct 20 00:27:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A655F17F4501; Wed, 20 Oct 2021 00:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrzH3RMYz3C4n; Wed, 20 Oct 2021 00:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 523151D9D6; Wed, 20 Oct 2021 00:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0RNJ3015563; Wed, 20 Oct 2021 00:27:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0RNW9015562; Wed, 20 Oct 2021 00:27:23 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:27:23 GMT Message-Id: <202110200027.19K0RNW9015562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 023283c64214 - stable/13 - config: Fix typo in comment. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 023283c6421412b25e66eca4d51e353e639750aa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=023283c6421412b25e66eca4d51e353e639750aa commit 023283c6421412b25e66eca4d51e353e639750aa Author: John Baldwin AuthorDate: 2021-02-01 21:13:36 +0000 Commit: John Baldwin CommitDate: 2021-10-19 23:53:20 +0000 config: Fix typo in comment. (cherry picked from commit bcaa6aa15383cacf5f20179be919bb8dd45cc5f4) --- usr.sbin/config/mkheaders.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index 62f81553bb5c..5dfde12c1db8 100644 --- a/usr.sbin/config/mkheaders.c +++ b/usr.sbin/config/mkheaders.c @@ -38,7 +38,7 @@ static const char rcsid[] = #endif /* not lint */ /* - * This used to generate a bunch of hearders files related to devices when + * This used to generate a bunch of headers files related to devices when * device counters were supported. Support for that was removed in 2005. * Since then, all we've done is to report unknown devices in this file. * It's kept its historical name, despite no longer generating headers. From nobody Wed Oct 20 00:27:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F21B17F4434; Wed, 20 Oct 2021 00:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrzJ3xzyz3C2Y; Wed, 20 Oct 2021 00:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69A791D7E3; Wed, 20 Oct 2021 00:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0ROl8015587; Wed, 20 Oct 2021 00:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0RO9S015586; Wed, 20 Oct 2021 00:27:24 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:27:24 GMT Message-Id: <202110200027.19K0RO9S015586@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 16aa4787ca5c - stable/13 - Remove 'make update'. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 16aa4787ca5cd9de970090eebfa67502b261d6a6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=16aa4787ca5cd9de970090eebfa67502b261d6a6 commit 16aa4787ca5cd9de970090eebfa67502b261d6a6 Author: John Baldwin AuthorDate: 2021-06-11 21:56:28 +0000 Commit: John Baldwin CommitDate: 2021-10-19 23:53:24 +0000 Remove 'make update'. In the CVS days this used be a wrapper around either CVS or CVSup and used to support updating src, doc, and ports checkouts. With the move to subversion this only supported updating src and was itself a wrapper around 'svn update'. With Git, users are probably better off using appropriate Git commands directly to update without needing an explicit make target as a wrapper. Reviewed by: bcr, imp, emaste Differential Revision: https://reviews.freebsd.org/D30736 (cherry picked from commit e290182bcf3895ca659dff111bca6a077c4708b1) --- Makefile | 3 +-- Makefile.inc1 | 27 --------------------------- share/man/man5/make.conf.5 | 25 +------------------------ 3 files changed, 2 insertions(+), 53 deletions(-) diff --git a/Makefile b/Makefile index 5929b3c6df20..67f2195cd603 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ # kernel-toolchain - Builds the subset of world necessary to build a kernel # kernel-toolchains - Build kernel-toolchain for all universe targets. # doxygen - Build API documentation of the kernel, needs doxygen. -# update - Convenient way to update your source tree(s). # checkworld - Run test suite on installed world. # check-old - List obsolete directories/files/libraries. # check-old-dirs - List obsolete directories. @@ -155,7 +154,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ installkernel.debug packagekernel packageworld \ reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries maninstall \ - obj objlink showconfig tags toolchain update \ + obj objlink showconfig tags toolchain \ makeman sysent \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _build-metadata _cross-tools _includes _libraries \ diff --git a/Makefile.inc1 b/Makefile.inc1 index 376d48d4fffb..66a4c4bf316b 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -11,9 +11,7 @@ # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel -# -DNO_PORTSUPDATE do not update ports in ${MAKE} update # -DNO_ROOT install without using root privilege -# -DNO_DOCUPDATE do not update doc in ${MAKE} update # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list # LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list @@ -494,17 +492,6 @@ BUILDENV_SHELL?=/bin/sh .endif .if !defined(_MKSHOWCONFIG) -.if !defined(SVN_CMD) || empty(SVN_CMD) -. for _P in /usr/bin /usr/local/bin -. for _S in svn svnlite -. if exists(${_P}/${_S}) -SVN_CMD= ${_P}/${_S} -. endif -. endfor -. endfor -.export SVN_CMD -.endif -SVNFLAGS?= -r HEAD .if !defined(VCS_REVISION) || empty(VCS_REVISION) .if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) . for _D in ${PATH:S,:, ,g} @@ -2140,20 +2127,6 @@ doxygen: .PHONY fi ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all -# -# update -# -# Update the source tree(s), by running svn/svnup to update to the -# latest copy. -# -update: .PHONY -.if defined(SVN_UPDATE) - @echo "--------------------------------------------------------------" - @echo ">>> Updating ${.CURDIR} using Subversion" - @echo "--------------------------------------------------------------" - @(cd ${.CURDIR}; ${SVN_CMD} update ${SVNFLAGS}) -.endif - # # ------------------------------------------------------------------------ # diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index 3dffdf7b402c..b8bb71ddc165 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2020 +.Dd June 11, 2021 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -229,29 +229,6 @@ Setting this variable will prevent CPU specific compiler flags from being automatically added to .Va CFLAGS during compile time. -.It Va NO_DOCUPDATE -.Pq Vt bool -Set this to not update the doc tree during -.Dq Li "make update" . -.It Va NO_PORTSUPDATE -.Pq Vt bool -Set this to not update the ports tree during -.Dq Li "make update" . -.It Va SVN_UPDATE -.Pq Vt bool -Set this to use -.Xr svn 1 -or -.Xr svnlite 1 -to update your -.Pa src -tree with -.Dq Li "make update" . -Note that you can set -.Va SVN -to the full path of a -.Xr svn 1 -binary. .El .Ss "BUILDING THE KERNEL" The following list provides a name and short description for variables From nobody Wed Oct 20 00:27:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AECDF17F42D2; Wed, 20 Oct 2021 00:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrzL0f99z3C50; Wed, 20 Oct 2021 00:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6521DC30; Wed, 20 Oct 2021 00:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0RPg7015611; Wed, 20 Oct 2021 00:27:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0RP5s015610; Wed, 20 Oct 2021 00:27:25 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:27:25 GMT Message-Id: <202110200027.19K0RP5s015610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 59a5099ec12d - stable/13 - Document kern.log_wakeups_per_second. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 59a5099ec12d3e8032817587c28c972ed00abdae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=59a5099ec12d3e8032817587c28c972ed00abdae commit 59a5099ec12d3e8032817587c28c972ed00abdae Author: John Baldwin AuthorDate: 2021-08-04 18:50:34 +0000 Commit: John Baldwin CommitDate: 2021-10-19 23:53:26 +0000 Document kern.log_wakeups_per_second. PR: 148680 (cherry picked from commit c51e4962a3cf2959d1f1cb9ab74ceab448583169) --- sys/kern/subr_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 9336611d6005..e69fb49b008f 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -98,10 +98,10 @@ static struct cv log_wakeup; struct mtx msgbuf_lock; MTX_SYSINIT(msgbuf_lock, &msgbuf_lock, "msgbuf lock", MTX_DEF); -/* Times per second to check for a pending syslog wakeup. */ static int log_wakeups_per_second = 5; SYSCTL_INT(_kern, OID_AUTO, log_wakeups_per_second, CTLFLAG_RW, - &log_wakeups_per_second, 0, ""); + &log_wakeups_per_second, 0, + "How often (times per second) to check for /dev/log waiters."); /*ARGSUSED*/ static int From nobody Wed Oct 20 00:27:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BB4F717F444F; Wed, 20 Oct 2021 00:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrzM2Fk0z3C2k; Wed, 20 Oct 2021 00:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A766E1DC31; Wed, 20 Oct 2021 00:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0RQiX015638; Wed, 20 Oct 2021 00:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0RQU8015637; Wed, 20 Oct 2021 00:27:26 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:27:26 GMT Message-Id: <202110200027.19K0RQU8015637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 9ecce2faf3b3 - stable/13 - Add EPOCH_TRACE to NOTES to get LINT coverage. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ecce2faf3b377859c8dda05a183c98ac8f00a4b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9ecce2faf3b377859c8dda05a183c98ac8f00a4b commit 9ecce2faf3b377859c8dda05a183c98ac8f00a4b Author: John Baldwin AuthorDate: 2021-09-11 20:05:44 +0000 Commit: John Baldwin CommitDate: 2021-10-19 23:53:30 +0000 Add EPOCH_TRACE to NOTES to get LINT coverage. Sponsored by: The FreeBSD Foundation (cherry picked from commit b9485d76e3ad4924032a23c82b8a30a0dce31918) --- sys/conf/NOTES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index f73b5a466366..f172b9e93d9c 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -329,6 +329,8 @@ options SLEEPQUEUE_PROFILING options TURNSTILE_PROFILING options UMTX_PROFILING +# Debugging traces for epoch(9) misuse +options EPOCH_TRACE ##################################################################### # COMPATIBILITY OPTIONS From nobody Wed Oct 20 00:27:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4AFC617F427C; Wed, 20 Oct 2021 00:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYrzN0TBbz3CCw; Wed, 20 Oct 2021 00:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C76381DAFD; Wed, 20 Oct 2021 00:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0RRNd015666; Wed, 20 Oct 2021 00:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0RR9x015665; Wed, 20 Oct 2021 00:27:27 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:27:27 GMT Message-Id: <202110200027.19K0RR9x015665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: e9b5d2443f67 - stable/13 - sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: e9b5d2443f67616bc323ea0a11089fd1f44eedc5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e9b5d2443f67616bc323ea0a11089fd1f44eedc5 commit e9b5d2443f67616bc323ea0a11089fd1f44eedc5 Author: John Baldwin AuthorDate: 2021-10-05 21:55:18 +0000 Commit: John Baldwin CommitDate: 2021-10-19 23:53:35 +0000 sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP. Sponsored by: DARPA (cherry picked from commit 680d70b59e0379ded0cc94e3772bc47be2163c7f) --- lib/libsysdecode/sysdecode_enum.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsysdecode/sysdecode_enum.3 b/lib/libsysdecode/sysdecode_enum.3 index 1db625f40ff0..722d82f27f29 100644 --- a/lib/libsysdecode/sysdecode_enum.3 +++ b/lib/libsysdecode/sysdecode_enum.3 @@ -225,7 +225,7 @@ object associated with an instance of signal: .It Fn sysdecode_sigfpe_code Ta Dv SIGFPE .It Fn sysdecode_sigill_code Ta Dv SIGILL .It Fn sysdecode_sigsegv_code Ta Dv SIGSEGV -.It Fn sysdecode_sigtrap_code Ta Dv SIGBTRAP +.It Fn sysdecode_sigtrap_code Ta Dv SIGTRAP .El .Pp Other functions decode the values described below: From nobody Wed Oct 20 00:43:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A101B17FD0AC; Wed, 20 Oct 2021 00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYsKK4CPKz3Jgj; Wed, 20 Oct 2021 00:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 720711DF4D; Wed, 20 Oct 2021 00:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0h1oA041966; Wed, 20 Oct 2021 00:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0h1h6041965; Wed, 20 Oct 2021 00:43:01 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:43:01 GMT Message-Id: <202110200043.19K0h1h6041965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5aebce3790cc - stable/13 - rtld direct exec: add -d option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5aebce3790cc29a02d3041b5412dc9c83905959a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5aebce3790cc29a02d3041b5412dc9c83905959a commit 5aebce3790cc29a02d3041b5412dc9c83905959a Author: Konstantin Belousov AuthorDate: 2021-10-11 22:26:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-20 00:42:25 +0000 rtld direct exec: add -d option (cherry picked from commit ba7f9c1b61329630af25e75cdaca261b389318c7) --- libexec/rtld-elf/rtld.1 | 6 ++++++ libexec/rtld-elf/rtld.c | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 8bc4cfade070..187dc105667a 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -330,6 +330,7 @@ The syntax of the direct invocation is .Bd -ragged -offset indent .Pa /libexec/ld-elf.so.1 .Op Fl b Ar exe +.Op Fl d .Op Fl f Ar fd .Op Fl p .Op Fl u @@ -352,6 +353,8 @@ If this option is specified, is only used to provide the .Va argv[0] value to the program. +.It Fl d +Turn off the emulation of the binary execute permission. .It Fl f Ar fd File descriptor .Ar fd @@ -403,6 +406,9 @@ ignores and is naturally prone to race conditions. Environments which rely on such restrictions are weak and breakable on their own. +It can be turned off with the +.Fl d +option. .Sh VERSIONING Newer .Nm diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 1a89a7b2c1de..6c304f98253a 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -140,7 +140,7 @@ static void objlist_remove(Objlist *, Obj_Entry *); static int open_binary_fd(const char *argv0, bool search_in_path, const char **binpath_res); static int parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, - const char **argv0); + const char **argv0, bool *dir_ignore); static int parse_integer(const char *); static void *path_enumerate(const char *, path_enum_proc, const char *, void *); static void print_usage(const char *argv0); @@ -503,7 +503,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) #ifdef __powerpc__ int old_auxv_format = 1; #endif - bool dir_enable, direct_exec, explicit_fd, search_in_path; + bool dir_enable, dir_ignore, direct_exec, explicit_fd, search_in_path; /* * On entry, the dynamic linker itself has not been relocated yet. @@ -589,7 +589,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) dbg("opening main program in direct exec mode"); if (argc >= 2) { - rtld_argc = parse_args(argv, argc, &search_in_path, &fd, &argv0); + rtld_argc = parse_args(argv, argc, &search_in_path, &fd, + &argv0, &dir_ignore); explicit_fd = (fd != -1); binpath = NULL; if (!explicit_fd) @@ -621,7 +622,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } else if ((st.st_mode & S_IXOTH) != 0) { dir_enable = true; } - if (!dir_enable) { + if (!dir_enable && !dir_ignore) { _rtld_error("No execute permission for binary %s", argv0); rtld_die(); @@ -5842,7 +5843,7 @@ open_binary_fd(const char *argv0, bool search_in_path, */ static int parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, - const char **argv0) + const char **argv0, bool *dir_ignore) { const char *arg; char machine[64]; @@ -5854,6 +5855,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, dbg("Parsing command-line arguments"); *use_pathp = false; *fdp = -1; + *dir_ignore = false; seen_b = seen_f = false; for (i = 1; i < argc; i++ ) { @@ -5890,6 +5892,9 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, *argv0 = argv[i]; seen_b = true; break; + } else if (opt == 'd') { + *dir_ignore = true; + break; } else if (opt == 'f') { if (seen_b) { _rtld_error("Both -b and -f specified"); @@ -5988,11 +5993,12 @@ print_usage(const char *argv0) { rtld_printf( - "Usage: %s [-h] [-b ] [-f ] [-p] [--] []\n" + "Usage: %s [-h] [-b ] [-d] [-f ] [-p] [--] []\n" "\n" "Options:\n" " -h Display this help message\n" " -b Execute instead of , arg0 is \n" + " -d Ignore lack of exec permissions for the binary\n" " -f Execute instead of searching for \n" " -p Search in PATH for named binary\n" " -u Ignore LD_ environment variables\n" From nobody Wed Oct 20 00:53:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2669A18017E2; Wed, 20 Oct 2021 00:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYsYf0PTyz3M7w; Wed, 20 Oct 2021 00:53:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E22AF1DF7F; Wed, 20 Oct 2021 00:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0rfqw055137; Wed, 20 Oct 2021 00:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0rfCD055136; Wed, 20 Oct 2021 00:53:41 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:53:41 GMT Message-Id: <202110200053.19K0rfCD055136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f89204d6b99d - stable/13 - libc/locale: Fix races between localeconv(3) and setlocale(3) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7 commit f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7 Author: Mark Johnston AuthorDate: 2021-09-17 14:44:23 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 00:53:33 +0000 libc/locale: Fix races between localeconv(3) and setlocale(3) Each locale embeds a lazily initialized lconv which is populated by localeconv(3) and localeconv_l(3). When setlocale(3) updates the global locale, the lconv needs to be (lazily) reinitialized. To signal this, we set flag variables in the locale structure. There are two problems: - The flags are set before the locale is fully updated, so a concurrent localeconv() call can observe partially initialized locale data. - No barriers ensure that localeconv() observes a fully initialized locale if a flag is set. So, move the flag update appropriately, and use acq/rel barriers to provide some synchronization. Note that this is inadequate in the face of multiple concurrent calls to setlocale(3), but this is not expected to work regardless. Thanks to Henry Hu for providing a test case demonstrating the race. PR: 258360 Sponsored by: The FreeBSD Foundation (cherry picked from commit 7eb138a9e53636366e615bdf04062fedc044bcea) --- lib/libc/locale/lmonetary.c | 4 ++-- lib/libc/locale/lnumeric.c | 4 ++-- lib/libc/locale/localeconv.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c index 99800ae69922..b8b4e78c060b 100644 --- a/lib/libc/locale/lmonetary.c +++ b/lib/libc/locale/lmonetary.c @@ -107,8 +107,6 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, &loc->buffer, "LC_MONETARY", LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN, (const char **)l); - if (ret != _LDP_ERROR) - *changed = 1; if (ret == _LDP_LOADED) { l->mon_grouping = __fix_locale_grouping_str(l->mon_grouping); @@ -146,6 +144,8 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, M_ASSIGN_ICHAR(p_sign_posn); M_ASSIGN_ICHAR(n_sign_posn); } + if (ret != _LDP_ERROR) + atomic_store_rel_int(changed, 1); return (ret); } int diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c index 046d1f1817dc..cc1daa3863e3 100644 --- a/lib/libc/locale/lnumeric.c +++ b/lib/libc/locale/lnumeric.c @@ -73,8 +73,6 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed &loc->buffer, "LC_NUMERIC", LCNUMERIC_SIZE, LCNUMERIC_SIZE, (const char**)l); - if (ret != _LDP_ERROR) - *changed= 1; if (ret == _LDP_LOADED) { /* Can't be empty according to C99 */ if (*l->decimal_point == '\0') @@ -83,6 +81,8 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed l->grouping = __fix_locale_grouping_str(l->grouping); } + if (ret != _LDP_ERROR) + atomic_store_rel_int(changed, 1); return (ret); } diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c index 641773944e32..130f93c178f4 100644 --- a/lib/libc/locale/localeconv.c +++ b/lib/libc/locale/localeconv.c @@ -65,7 +65,7 @@ localeconv_l(locale_t loc) FIX_LOCALE(loc); struct lconv *ret = &loc->lconv; - if (loc->monetary_locale_changed) { + if (atomic_load_acq_int(&loc->monetary_locale_changed) != 0) { /* LC_MONETARY part */ struct lc_monetary_T * mptr; @@ -94,10 +94,10 @@ localeconv_l(locale_t loc) M_ASSIGN_CHAR(int_n_sep_by_space); M_ASSIGN_CHAR(int_p_sign_posn); M_ASSIGN_CHAR(int_n_sign_posn); - loc->monetary_locale_changed = 0; + atomic_store_int(&loc->monetary_locale_changed, 0); } - if (loc->numeric_locale_changed) { + if (atomic_load_acq_int(&loc->numeric_locale_changed) != 0) { /* LC_NUMERIC part */ struct lc_numeric_T * nptr; @@ -107,7 +107,7 @@ localeconv_l(locale_t loc) N_ASSIGN_STR(decimal_point); N_ASSIGN_STR(thousands_sep); N_ASSIGN_STR(grouping); - loc->numeric_locale_changed = 0; + atomic_store_int(&loc->numeric_locale_changed, 0); } return ret; From nobody Wed Oct 20 00:53:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A040418012E8; Wed, 20 Oct 2021 00:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYsYg39NQz3MNs; Wed, 20 Oct 2021 00:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C7F1E480; Wed, 20 Oct 2021 00:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K0rgEk055161; Wed, 20 Oct 2021 00:53:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K0rgMr055160; Wed, 20 Oct 2021 00:53:42 GMT (envelope-from git) Date: Wed, 20 Oct 2021 00:53:42 GMT Message-Id: <202110200053.19K0rgMr055160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 348fc38fd539 - stable/13 - mount: Check for !VDIR mount points before handling -o emptydir List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 348fc38fd53920cce82175f90b13765258cee027 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=348fc38fd53920cce82175f90b13765258cee027 commit 348fc38fd53920cce82175f90b13765258cee027 Author: Mark Johnston AuthorDate: 2021-10-13 00:11:02 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 00:53:33 +0000 mount: Check for !VDIR mount points before handling -o emptydir To implement -o emptydir, vfs_emptydir() checks that the passed directory is empty. This should be done after checking whether the vnode is of type VDIR, though, or vfs_emptydir() may end up calling VOP_READDIR on a non-directory. Reported by: syzbot+4006732c69fb0f792b2c@syzkaller.appspotmail.com Reviewed by: kib, imp Sponsored by: The FreeBSD Foundation (cherry picked from commit 03d5820f738de130b2feb66833f18741b7f92a14) --- sys/kern/vfs_mount.c | 10 ++-------- sys/kern/vfs_subr.c | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 09c9a59d1bed..c10c24f4501b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -946,14 +946,6 @@ vfs_domount_first( ASSERT_VOP_ELOCKED(vp, __func__); KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here")); - if ((fsflags & MNT_EMPTYDIR) != 0) { - error = vfs_emptydir(vp); - if (error != 0) { - vput(vp); - return (error); - } - } - /* * If the jail of the calling thread lacks permission for this type of * file system, or is trying to cover its own root, deny immediately. @@ -975,6 +967,8 @@ vfs_domount_first( error = vinvalbuf(vp, V_SAVE, 0, 0); if (error == 0 && vp->v_type != VDIR) error = ENOTDIR; + if (error == 0 && (fsflags & MNT_EMPTYDIR) != 0) + error = vfs_emptydir(vp); if (error == 0) { VI_LOCK(vp); if ((vp->v_iflag & VI_MOUNT) == 0 && vp->v_mountedhere == NULL) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9d0638d1bf38..76e01d1f7816 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -6276,6 +6276,7 @@ vfs_emptydir(struct vnode *vp) eof = 0; ASSERT_VOP_LOCKED(vp, "vfs_emptydir"); + VNASSERT(vp->v_type == VDIR, vp, ("vp is not a directory")); dirent = malloc(sizeof(struct dirent), M_TEMP, M_WAITOK); iov.iov_base = dirent; From nobody Wed Oct 20 01:14:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99DCA180A047; Wed, 20 Oct 2021 01:14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYt1f3yh3z3hdH; Wed, 20 Oct 2021 01:14:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67B931E801; Wed, 20 Oct 2021 01:14:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1EU3i082326; Wed, 20 Oct 2021 01:14:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1EUpj082325; Wed, 20 Oct 2021 01:14:30 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:14:30 GMT Message-Id: <202110200114.19K1EUpj082325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 589daa05be6f - stable/13 - Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 589daa05be6f390bed6fdeb820c47f8db114c5ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=589daa05be6f390bed6fdeb820c47f8db114c5ec commit 589daa05be6f390bed6fdeb820c47f8db114c5ec Author: Mark Johnston AuthorDate: 2021-10-20 01:13:12 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:13:12 +0000 Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)" This reverts commit f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7. I didn't intend to push this commit yet, pending discussion on PR 258360. PR: 258360 --- lib/libc/locale/lmonetary.c | 4 ++-- lib/libc/locale/lnumeric.c | 4 ++-- lib/libc/locale/localeconv.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c index b8b4e78c060b..99800ae69922 100644 --- a/lib/libc/locale/lmonetary.c +++ b/lib/libc/locale/lmonetary.c @@ -107,6 +107,8 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, &loc->buffer, "LC_MONETARY", LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN, (const char **)l); + if (ret != _LDP_ERROR) + *changed = 1; if (ret == _LDP_LOADED) { l->mon_grouping = __fix_locale_grouping_str(l->mon_grouping); @@ -144,8 +146,6 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, M_ASSIGN_ICHAR(p_sign_posn); M_ASSIGN_ICHAR(n_sign_posn); } - if (ret != _LDP_ERROR) - atomic_store_rel_int(changed, 1); return (ret); } int diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c index cc1daa3863e3..046d1f1817dc 100644 --- a/lib/libc/locale/lnumeric.c +++ b/lib/libc/locale/lnumeric.c @@ -73,6 +73,8 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed &loc->buffer, "LC_NUMERIC", LCNUMERIC_SIZE, LCNUMERIC_SIZE, (const char**)l); + if (ret != _LDP_ERROR) + *changed= 1; if (ret == _LDP_LOADED) { /* Can't be empty according to C99 */ if (*l->decimal_point == '\0') @@ -81,8 +83,6 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed l->grouping = __fix_locale_grouping_str(l->grouping); } - if (ret != _LDP_ERROR) - atomic_store_rel_int(changed, 1); return (ret); } diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c index 130f93c178f4..641773944e32 100644 --- a/lib/libc/locale/localeconv.c +++ b/lib/libc/locale/localeconv.c @@ -65,7 +65,7 @@ localeconv_l(locale_t loc) FIX_LOCALE(loc); struct lconv *ret = &loc->lconv; - if (atomic_load_acq_int(&loc->monetary_locale_changed) != 0) { + if (loc->monetary_locale_changed) { /* LC_MONETARY part */ struct lc_monetary_T * mptr; @@ -94,10 +94,10 @@ localeconv_l(locale_t loc) M_ASSIGN_CHAR(int_n_sep_by_space); M_ASSIGN_CHAR(int_p_sign_posn); M_ASSIGN_CHAR(int_n_sign_posn); - atomic_store_int(&loc->monetary_locale_changed, 0); + loc->monetary_locale_changed = 0; } - if (atomic_load_acq_int(&loc->numeric_locale_changed) != 0) { + if (loc->numeric_locale_changed) { /* LC_NUMERIC part */ struct lc_numeric_T * nptr; @@ -107,7 +107,7 @@ localeconv_l(locale_t loc) N_ASSIGN_STR(decimal_point); N_ASSIGN_STR(thousands_sep); N_ASSIGN_STR(grouping); - atomic_store_int(&loc->numeric_locale_changed, 0); + loc->numeric_locale_changed = 0; } return ret; From nobody Wed Oct 20 01:23:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 491DC180F9C4; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCl1XYVz3lgJ; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 155CB1E9D4; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NEFY095439; Wed, 20 Oct 2021 01:23:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NEvq095438; Wed, 20 Oct 2021 01:23:14 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:14 GMT Message-Id: <202110200123.19K1NEvq095438@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: a23e6a1078d6 - main - vm_page: Move vm_page_alloc_check() to after page allocator definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a23e6a1078d6d6c361481ab4f835449f177edac3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a23e6a1078d6d6c361481ab4f835449f177edac3 commit a23e6a1078d6d6c361481ab4f835449f177edac3 Author: Mark Johnston AuthorDate: 2021-10-20 01:22:50 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:50 +0000 vm_page: Move vm_page_alloc_check() to after page allocator definitions This way all of the vm_page_alloc_*() allocator functions are grouped together. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/vm/vm_page.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 25e6dce32aa6..bc1c6bbe4ce1 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2394,28 +2394,6 @@ found: return (m_ret); } -/* - * Check a page that has been freshly dequeued from a freelist. - */ -static void -vm_page_alloc_check(vm_page_t m) -{ - - KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->a.queue == PQ_NONE && - (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p has unexpected queue %d, flags %#x", - m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); - KASSERT(m->ref_count == 0, ("page %p has references", m)); - KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); - KASSERT(m->dirty == 0, ("page %p is dirty", m)); - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, - ("page %p has unexpected memattr %d", - m, pmap_page_get_memattr(m))); - KASSERT(m->valid == 0, ("free page %p is valid", m)); - pmap_vm_page_alloc_check(m); -} - /* * vm_page_alloc_freelist: * @@ -2494,6 +2472,27 @@ again: return (m); } +/* + * Check a page that has been freshly dequeued from a freelist. + */ +static void +vm_page_alloc_check(vm_page_t m) +{ + KASSERT(m->object == NULL, ("page %p has object", m)); + KASSERT(m->ref_count == 0, ("page %p has references", m)); + KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); + KASSERT(m->a.queue == PQ_NONE && + (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p has unexpected queue %d, flags %#x", + m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); + KASSERT(m->valid == 0, ("free page %p is valid", m)); + KASSERT(m->dirty == 0, ("page %p is dirty", m)); + KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, + ("page %p has unexpected memattr %d", + m, pmap_page_get_memattr(m))); + pmap_vm_page_alloc_check(m); +} + static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, int flags) { From nobody Wed Oct 20 01:23:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5195180F8CA; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCl4pRWz3lgK; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634692995; 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=TzeDPt7OWvzZXa7IP4RQTUrvnKEQvjRZrilANL2dW6Y=; b=nw9fdocQYBhWkIxD4j1hlt7y2k+RQKEGAWezQTvuBm9sD+Znm6w8A8toJQqnmptsQQrYM8 dZEDe/IsUK9No5LfQ0LdYCWO8E3VjZFttpZYm0SrvzOU+qeE2efSi7zIiWnBLgMeeaGL6O ctHrS/gLERdEzS9fz1Y0T0jdHYw3k19CGYTjYTpgT0QeeDMTTS9k1VEGYishHRQq5xuMhx l+exfPGdwGob7EyO/7SLpyAF5WwzgjYmCuvrmfJgTqSlu7XvAvudHQ4AbWmemXBxvHZ2tE kRslfpjxA0mkn1oEd0yPXS9oOQDEfR1wXF9QSnEGYPKmOcI4Nns7aAYNRNNiQw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 957B619B22; Wed, 20 Oct 2021 01:23:15 +0000 (UTC) Date: Wed, 20 Oct 2021 01:23:15 +0000 From: Alexey Dokuchaev To: Emmanuel Vadot Cc: Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634692995; 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=TzeDPt7OWvzZXa7IP4RQTUrvnKEQvjRZrilANL2dW6Y=; b=yKLLigL+UQMZpkSKeOQbaxZdqb05/B/4HKa/VCP5GdGdAvjNxPqRsKuaiwOjrNycvQXszM vCil4cMYXjsEnERk353JpUWMPnThHh/NQLyHM0nuD6akhiWNsudxb0oOJCzeIPDg80C/QS kCGnfMro+TsvWGIln/G4dtH/XkFZXKjbEmuqsqQW1iMzVhXbOuiL7LuYoelyshB+bc2qhp 0g06RzQNYhnwcf0dVt3lUkQgzmf21iMLy2TjeRfvFBCatQSVgCxQI1ZUW6ILIOaU0d5lZb wMRlJvHYeMebvTX8IeaLOA2TWXJvSPDXzqoATVc3FAVqUtjp0ZMvDakNQDHaGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634692995; a=rsa-sha256; cv=none; b=oz9aEyc6kyg9+VT86oLMEDhVpSct1B5VYWG5J7tLkErQV3aSjkpCY0zqTWmSQ30MZbKqHE be1haJrC4mbprQMx64jdK8LEz/pjKAvB3WXPc5txWK5bOkUnPjJ+KO9FHF1V3FNtsiLzTM OKghAgHx0/quByXmNc77P1WkQ7NE77rfPMMm0KEPvJ2N9PPOAMDkVR9LLdfg7Hp69xKpwf S6MQyoVag89fXA/kxNfEBsbPN9ewy/MLLPhltrQ6nmMqPHQeg/ENzFH8Cqk37fYoh4ckjU ILfXnlJGE3t72tebSYSKvRKuD5+GHaGxpR0WBOj6MyPt90zLmlPfdVWtw8lEGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > On Tue, 19 Oct 2021 14:21:33 +0300, Slawa Olhovchenkov wrote: > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > vt: Disable bell by default > > > > > > Bell is either useless if you're working on remote servers or > > > really annoying when you're working with a local machine that > > > have a loud buzzer. Switch the default to have it disable. > > > > For you, not for me, for example. Also, this is violate POLA. > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > happy again. Actually, it should've been the other way around: it if annoys *you*, then you should just set kern.vt.enable_bell=0 in /etc/sysctl.conf and be happy. I'm also used to it, it's a nice indicator that things work normally, including the bell itself. > And POLA doesn't means that we can't change a thing. FWIW, controversial changes like this should go through the formal review process, giving everyone interested a chance to chime in, not like closing the differential in less than 24 hours. ./danfe From nobody Wed Oct 20 01:23:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 47201180F860; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCm3dTkz3lcy; Wed, 20 Oct 2021 01:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 529421E6E5; Wed, 20 Oct 2021 01:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NGJE095467; Wed, 20 Oct 2021 01:23:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NGJh095466; Wed, 20 Oct 2021 01:23:16 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:16 GMT Message-Id: <202110200123.19K1NGJh095466@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: b498f71bc56a - main - vm_page: Add a new page allocator interface for unnamed pages List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b498f71bc56af0069d9a4685b8385ee613a00727 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b498f71bc56af0069d9a4685b8385ee613a00727 commit b498f71bc56af0069d9a4685b8385ee613a00727 Author: Mark Johnston AuthorDate: 2021-10-20 00:22:12 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:55 +0000 vm_page: Add a new page allocator interface for unnamed pages The diff adds vm_page_alloc_noobj() and vm_page_alloc_noobj_domain(). These mostly correspond to vm_page_alloc() and vm_page_alloc_domain() when no VM object is specified, with the exception that they handle VM_ALLOC_ZERO by zeroing the page, rather than by preserving PG_ZERO. This simplifies callers and will permit simplification of the vm_page_alloc_domain() definition. Since the new allocator variant is similar to vm_page_alloc_freelist(), implement both of them using a common backend allocator function. No functional change intended. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31985 --- sys/vm/vm_page.c | 141 +++++++++++++++++++++++++++++++++++-------------------- sys/vm/vm_page.h | 14 +++--- 2 files changed, 98 insertions(+), 57 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index bc1c6bbe4ce1..74b09fc27be5 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2395,54 +2395,41 @@ found: } /* - * vm_page_alloc_freelist: - * - * Allocate a physical page from the specified free page list. - * - * The caller must always specify an allocation class. - * - * allocation classes: - * VM_ALLOC_NORMAL normal process request - * VM_ALLOC_SYSTEM system *really* needs a page - * VM_ALLOC_INTERRUPT interrupt time request - * - * optional allocation flags: - * VM_ALLOC_COUNT(number) the number of additional pages that the caller - * intends to allocate - * VM_ALLOC_WIRED wire the allocated page - * VM_ALLOC_ZERO prefer a zeroed page + * Allocate a physical page that is not intended to be inserted into a VM + * object. If the "freelist" parameter is not equal to VM_NFREELIST, then only + * pages from the specified vm_phys freelist will be returned. */ -vm_page_t -vm_page_alloc_freelist(int freelist, int req) -{ - struct vm_domainset_iter di; - vm_page_t m; - int domain; - - vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); - do { - m = vm_page_alloc_freelist_domain(domain, freelist, req); - if (m != NULL) - break; - } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); - - return (m); -} - -vm_page_t -vm_page_alloc_freelist_domain(int domain, int freelist, int req) +static __always_inline vm_page_t +_vm_page_alloc_noobj_domain(int domain, const int freelist, int req) { struct vm_domain *vmd; vm_page_t m; - u_int flags; + int flags; - m = NULL; + KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOOBJ)) == 0, + ("%s: invalid req %#x", __func__, req)); + + flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0; vmd = VM_DOMAIN(domain); again: + if (freelist == VM_NFREELIST && + vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) { + m = uma_zalloc(vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone, + M_NOWAIT | M_NOVM); + if (m != NULL) { + flags |= PG_PCPU_CACHE; + goto found; + } + } + if (vm_domain_allocate(vmd, req, 1)) { vm_domain_free_lock(vmd); - m = vm_phys_alloc_freelist_pages(domain, freelist, - VM_FREEPOOL_DIRECT, 0); + if (freelist == VM_NFREELIST) + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DIRECT, 0); + else + m = vm_phys_alloc_freelist_pages(domain, freelist, + VM_FREEPOOL_DIRECT, 0); vm_domain_free_unlock(vmd); if (m == NULL) vm_domain_freecnt_inc(vmd, 1); @@ -2452,44 +2439,96 @@ again: goto again; return (NULL); } + +found: vm_page_dequeue(m); vm_page_alloc_check(m); - /* - * Initialize the page. Only the PG_ZERO flag is inherited. - */ + /* Consumers should not rely on a useful default pindex value. */ + m->pindex = 0xdeadc0dedeadc0de; + m->flags = (m->flags & PG_ZERO) | flags; m->a.flags = 0; - flags = 0; - if ((req & VM_ALLOC_ZERO) != 0) - flags = PG_ZERO; - m->flags &= flags; + m->oflags = VPO_UNMANAGED; + m->busy_lock = VPB_UNBUSIED; if ((req & VM_ALLOC_WIRED) != 0) { vm_wire_add(1); m->ref_count = 1; } - /* Unmanaged pages don't use "act_count". */ - m->oflags = VPO_UNMANAGED; + + if ((req & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + return (m); +} + +vm_page_t +vm_page_alloc_freelist(int freelist, int req) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_freelist_domain(domain, freelist, req); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + + return (m); +} + +vm_page_t +vm_page_alloc_freelist_domain(int domain, int freelist, int req) +{ + KASSERT(freelist >= 0 && freelist < VM_NFREELIST, + ("%s: invalid freelist %d", __func__, freelist)); + + return (_vm_page_alloc_noobj_domain(domain, freelist, req)); +} + +vm_page_t +vm_page_alloc_noobj(int req) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_noobj_domain(domain, req); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + return (m); } +vm_page_t +vm_page_alloc_noobj_domain(int domain, int req) +{ + return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); +} + /* * Check a page that has been freshly dequeued from a freelist. */ static void vm_page_alloc_check(vm_page_t m) { + KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->ref_count == 0, ("page %p has references", m)); - KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); KASSERT(m->a.queue == PQ_NONE && (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); - KASSERT(m->valid == 0, ("free page %p is valid", m)); + KASSERT(m->ref_count == 0, ("page %p has references", m)); + KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("page %p has unexpected memattr %d", m, pmap_page_get_memattr(m))); + KASSERT(m->valid == 0, ("free page %p is valid", m)); pmap_vm_page_alloc_check(m); } diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 6e0a4328e260..600619b00eaf 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -527,8 +527,8 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * Legend: * (a) - vm_page_alloc() supports the flag. * (c) - vm_page_alloc_contig() supports the flag. - * (f) - vm_page_alloc_freelist() supports the flag. * (g) - vm_page_grab() supports the flag. + * (n) - vm_page_alloc_noobj() and vm_page_alloc_freelist() support the flag. * (p) - vm_page_grab_pages() supports the flag. * Bits above 15 define the count of additional pages that the caller * intends to allocate. @@ -537,10 +537,10 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_INTERRUPT 1 #define VM_ALLOC_SYSTEM 2 #define VM_ALLOC_CLASS_MASK 3 -#define VM_ALLOC_WAITOK 0x0008 /* (acf) Sleep and retry */ -#define VM_ALLOC_WAITFAIL 0x0010 /* (acf) Sleep and return error */ -#define VM_ALLOC_WIRED 0x0020 /* (acfgp) Allocate a wired page */ -#define VM_ALLOC_ZERO 0x0040 /* (acfgp) Allocate a prezeroed page */ +#define VM_ALLOC_WAITOK 0x0008 /* (acn) Sleep and retry */ +#define VM_ALLOC_WAITFAIL 0x0010 /* (acn) Sleep and return error */ +#define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */ +#define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */ #define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ @@ -548,7 +548,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ -#define VM_ALLOC_NOWAIT 0x8000 /* (acfgp) Do not sleep */ +#define VM_ALLOC_NOWAIT 0x8000 /* (acgnp) Do not sleep */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -614,6 +614,8 @@ vm_page_t vm_page_alloc_contig_domain(vm_object_t object, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); +vm_page_t vm_page_alloc_noobj(int); +vm_page_t vm_page_alloc_noobj_domain(int, int); void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int); From nobody Wed Oct 20 01:23:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6194A180F8DC; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCn4t1bz3lRK; Wed, 20 Oct 2021 01:23:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67FF01E89D; Wed, 20 Oct 2021 01:23:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NHmd095494; Wed, 20 Oct 2021 01:23:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NHcA095493; Wed, 20 Oct 2021 01:23:17 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:17 GMT Message-Id: <202110200123.19K1NHcA095493@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: a4667e09e652 - main - Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4667e09e6520dc2c4b0b988051f060fed695a91 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a4667e09e6520dc2c4b0b988051f060fed695a91 commit a4667e09e6520dc2c4b0b988051f060fed695a91 Author: Mark Johnston AuthorDate: 2021-10-20 00:23:39 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK. Similarly, convert vm_page_alloc_domain() callers. Note that callers are now responsible for assigning the pindex. Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31986 --- sys/amd64/amd64/mp_machdep.c | 3 +- sys/amd64/amd64/pmap.c | 44 +++++++++--------------- sys/amd64/amd64/uma_machdep.c | 6 ++-- sys/arm/arm/pmap-v6.c | 20 +++++------ sys/arm64/arm64/pmap.c | 44 +++++++++--------------- sys/arm64/arm64/uma_machdep.c | 6 ++-- sys/arm64/iommu/iommu_pmap.c | 15 +++------ sys/compat/linuxkpi/common/src/linux_page.c | 2 +- sys/dev/drm2/ttm/ttm_page_alloc.c | 7 +--- sys/dev/ti/if_ti.c | 3 +- sys/dev/virtio/balloon/virtio_balloon.c | 3 +- sys/dev/xen/balloon/balloon.c | 21 ++++-------- sys/dev/xen/gntdev/gntdev.c | 11 ++---- sys/fs/nfs/nfs_commonsubs.c | 9 ++--- sys/fs/nfsclient/nfs_clrpcops.c | 9 ++--- sys/i386/i386/pmap.c | 44 +++++++++--------------- sys/kern/kern_mbuf.c | 4 +-- sys/kern/uipc_ktls.c | 8 ++--- sys/kern/uipc_mbuf.c | 5 ++- sys/kern/vfs_bio.c | 5 ++- sys/mips/mips/pmap.c | 4 --- sys/mips/mips/uma_machdep.c | 2 -- sys/powerpc/aim/mmu_oea64.c | 7 ++-- sys/powerpc/aim/mmu_radix.c | 36 ++++++++------------ sys/powerpc/booke/pmap_32.c | 4 +-- sys/powerpc/booke/pmap_64.c | 9 ++--- sys/powerpc/powerpc/uma_machdep.c | 7 ++-- sys/riscv/riscv/pmap.c | 52 ++++++++++------------------- sys/riscv/riscv/uma_machdep.c | 6 ++-- sys/vm/uma_core.c | 22 ++++++------ sys/vm/vm_kern.c | 5 +-- sys/vm/vm_page.c | 3 +- 32 files changed, 146 insertions(+), 280 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 16ec277e9c34..33defe79c8b9 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -305,8 +305,7 @@ mp_realloc_pcpu(int cpuid, int domain) oa = (vm_offset_t)&__pcpu[cpuid]; if (vm_phys_domain(pmap_kextract(oa)) == domain) return; - m = vm_page_alloc_domain(NULL, 0, domain, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) return; na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 168c9eec1b66..8d6c81a5459b 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2342,10 +2342,9 @@ pmap_init_pv_table(void) highest = start + (s / sizeof(*pvd)) - 1; for (j = 0; j < s; j += PAGE_SIZE) { - vm_page_t m = vm_page_alloc_domain(NULL, 0, - domain, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + vm_page_t m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) - panic("vm_page_alloc_domain failed for %lx\n", (vm_offset_t)pvd + j); + panic("failed to allocate PV table page"); pmap_qenter((vm_offset_t)pvd + j, &m, 1); } @@ -4312,15 +4311,11 @@ pmap_alloc_pt_page(pmap_t pmap, vm_pindex_t pindex, int flags) { vm_page_t m; - m = vm_page_alloc(NULL, pindex, flags | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj(flags); if (__predict_false(m == NULL)) return (NULL); - + m->pindex = pindex; pmap_pt_page_count_adj(pmap, 1); - - if ((flags & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - return (m); } @@ -4358,8 +4353,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) /* * allocate the page directory page */ - pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | + VM_ALLOC_WAITOK); pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4389,8 +4384,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { pmltop_pgu = pmap_alloc_pt_page(NULL, 0, - VM_ALLOC_WIRED | VM_ALLOC_NORMAL | - VM_ALLOC_WAITOK); + VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -5480,8 +5474,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(counter_u64_add(pc_chunk_tryfail, 1)); @@ -5584,8 +5577,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -5957,8 +5949,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * priority is normal. */ mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), - (in_kernel ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_WIRED); + (in_kernel ? VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -10355,8 +10346,7 @@ pmap_quick_remove_page(vm_offset_t addr) static vm_page_t pmap_large_map_getptp_unlocked(void) { - return (pmap_alloc_pt_page(kernel_pmap, 0, - VM_ALLOC_NORMAL | VM_ALLOC_ZERO)); + return (pmap_alloc_pt_page(kernel_pmap, 0, VM_ALLOC_ZERO)); } static vm_page_t @@ -11411,12 +11401,10 @@ pmap_kasan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } @@ -11481,12 +11469,10 @@ pmap_kmsan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c index 2fc981f23c83..479cb4e37d9e 100644 --- a/sys/amd64/amd64/uma_machdep.c +++ b/sys/amd64/amd64/uma_machdep.c @@ -49,16 +49,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index f596ace35ba7..51438274f1ff 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2069,12 +2069,12 @@ pmap_growkernel(vm_offset_t addr) /* * Install new PT2s page into kernel PT2TAB. */ - m = vm_page_alloc(NULL, - pte1_index(kernel_vm_end) & ~PT2PG_MASK, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow kernel", __func__); + m->pindex = pte1_index(kernel_vm_end) & ~PT2PG_MASK; + /* * QQQ: To link all new L2 page tables from L1 page * table now and so pmap_kenter_pte1() them @@ -2488,8 +2488,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) /* * Install new PT2s page into pmap PT2TAB. */ - m = vm_page_alloc(NULL, pte1_idx & ~PT2PG_MASK, - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); @@ -2505,6 +2504,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) */ return (NULL); } + m->pindex = pte1_idx & ~PT2PG_MASK; pmap->pm_stats.resident_count++; pt2pg_pa = pmap_pt2pg_init(pmap, va, m); } else { @@ -3062,8 +3062,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_pte2list_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -3711,9 +3711,8 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((opte1 & PTE1_A) == 0 || (m = vm_page_alloc(NULL, - pte1_index(va) & ~PT2PG_MASK, VM_ALLOC_NOOBJ | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED)) == NULL) { + if ((opte1 & PTE1_A) == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); pmap_remove_pte1(pmap, pte1p, pte1_trunc(va), &free); vm_page_free_pages_toq(&free, false); @@ -3721,6 +3720,7 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) __func__, va, pmap); return (FALSE); } + m->pindex = pte1_index(va) & ~PT2PG_MASK; if (va < VM_MAXUSER_ADDRESS) pmap->pm_stats.resident_count++; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 9fbd473abe3a..ab62ca2934f0 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1766,16 +1766,11 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) /* * allocate the l0 page */ - while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - vm_wait(NULL); - + m = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((m->flags & PG_ZERO) == 0) - pagezero(pmap->pm_l0); - pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); @@ -1841,8 +1836,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -1856,8 +1850,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Because of AArch64's weak memory consistency model, we must have a @@ -2191,13 +2184,11 @@ pmap_growkernel(vm_offset_t addr) l1 = pmap_l0_to_l1(l0, kernel_vm_end); if (pmap_load(l1) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L1_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L1_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2214,13 +2205,11 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2565,8 +2554,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -2631,8 +2619,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -6148,8 +6135,8 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va) return (NULL); } - if ((ml2 = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if ((ml2 = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED)) == + NULL) { CTR2(KTR_PMAP, "pmap_demote_l1: failure for va %#lx" " in pmap %p", va, pmap); l2 = NULL; @@ -6282,9 +6269,9 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, * priority (VM_ALLOC_INTERRUPT). Otherwise, the * priority is normal. */ - ml3 = vm_page_alloc(NULL, pmap_l2_pindex(va), - (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + ml3 = vm_page_alloc_noobj( + (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : 0) | + VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -6296,6 +6283,7 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, " in pmap %p", va, pmap); goto fail; } + ml3->pindex = pmap_l2_pindex(va); if (!ADDR_IS_KERNEL(va)) { ml3->ref_count = NL3PG; diff --git a/sys/arm64/arm64/uma_machdep.c b/sys/arm64/arm64/uma_machdep.c index 3ef3dd3cc9e9..d1c656a3b9f1 100644 --- a/sys/arm64/arm64/uma_machdep.c +++ b/sys/arm64/arm64/uma_machdep.c @@ -47,16 +47,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/arm64/iommu/iommu_pmap.c b/sys/arm64/iommu/iommu_pmap.c index 354c213569ff..7ea8a7ee93a3 100644 --- a/sys/arm64/iommu/iommu_pmap.c +++ b/sys/arm64/iommu/iommu_pmap.c @@ -387,16 +387,11 @@ iommu_pmap_pinit_levels(pmap_t pmap, int levels) /* * allocate the l0 page */ - while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - vm_wait(NULL); - + m = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((m->flags & PG_ZERO) == 0) - pagezero(pmap->pm_l0); - pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); @@ -446,16 +441,14 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { /* * Indicate the need to retry. While waiting, the page table * page may have been allocated. */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Because of AArch64's weak memory consistency model, we must have a diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 8da4736ab7d5..f712c0c155a4 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -97,7 +97,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; if (order == 0 && (flags & GFP_DMA32) == 0) { - page = vm_page_alloc(NULL, 0, req); + page = vm_page_alloc_noobj(req); if (page == NULL) return (NULL); } else { diff --git a/sys/dev/drm2/ttm/ttm_page_alloc.c b/sys/dev/drm2/ttm/ttm_page_alloc.c index fbb830405de0..b35a06520e07 100644 --- a/sys/dev/drm2/ttm/ttm_page_alloc.c +++ b/sys/dev/drm2/ttm/ttm_page_alloc.c @@ -178,12 +178,7 @@ ttm_vm_page_alloc_any(int req, vm_memattr_t memattr) { vm_page_t p; - while (1) { - p = vm_page_alloc(NULL, 0, req); - if (p != NULL) - break; - vm_wait(NULL); - } + p = vm_page_alloc_noobj(req | VM_ALLOC_WAITOK); pmap_page_set_memattr(p, memattr); return (p); } diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9871212d6379..e8b4eb537883 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1609,8 +1609,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) "failed -- packet dropped!\n"); goto nobufs; } - frame = vm_page_alloc(NULL, 0, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + frame = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); if (frame == NULL) { device_printf(sc->ti_dev, "buffer allocation " diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 3e2d967dd9af..bf4e5cf916f7 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -460,8 +460,7 @@ vtballoon_alloc_page(struct vtballoon_softc *sc) { vm_page_t m; - m = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP); + m = vm_page_alloc_noobj(VM_ALLOC_NODUMP); if (m != NULL) sc->vtballoon_current_npages++; diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index 01d75204f5bf..007fada24259 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -228,25 +228,18 @@ decrease_reservation(unsigned long nr_pages) nr_pages = nitems(frame_list); for (i = 0; i < nr_pages; i++) { - if ((page = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_ZERO)) == NULL) { + /* + * Zero the page, or else we might be leaking important data to + * other domains on the same host. Xen doesn't scrub ballooned + * out memory pages, the guest is in charge of making sure that + * no information is leaked. + */ + if ((page = vm_page_alloc_noobj(VM_ALLOC_ZERO)) == NULL) { nr_pages = i; need_sleep = 1; break; } - if ((page->flags & PG_ZERO) == 0) { - /* - * Zero the page, or else we might be leaking - * important data to other domains on the same - * host. Xen doesn't scrub ballooned out memory - * pages, the guest is in charge of making - * sure that no information is leaked. - */ - pmap_zero_page(page); - } - frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); diff --git a/sys/dev/xen/gntdev/gntdev.c b/sys/dev/xen/gntdev/gntdev.c index 8249eaba8bcc..0c89133ca1b0 100644 --- a/sys/dev/xen/gntdev/gntdev.c +++ b/sys/dev/xen/gntdev/gntdev.c @@ -368,20 +368,13 @@ gntdev_alloc_gref(struct ioctl_gntdev_alloc_gref *arg) grefs[i].file_index = file_offset + i * PAGE_SIZE; grefs[i].gref_id = GRANT_REF_INVALID; grefs[i].notify = NULL; - grefs[i].page = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL - | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + grefs[i].page = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (grefs[i].page == NULL) { log(LOG_ERR, "Page allocation failed."); error = ENOMEM; break; } - if ((grefs[i].page->flags & PG_ZERO) == 0) { - /* - * Zero the allocated page, as we don't want to - * leak our memory to other domains. - */ - pmap_zero_page(grefs[i].page); - } grefs[i].page->valid = VM_PAGE_BITS_ALL; error = gnttab_grant_foreign_access(arg->domid, diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 73ce2afefd20..98f1f3d642b3 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4913,13 +4913,8 @@ nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg) *bextpg = 0; m->m_next = mp; } else { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m->m_epg_pa[m->m_epg_npgs] = VM_PAGE_TO_PHYS(pg); *bextpg = m->m_epg_npgs; m->m_epg_npgs++; diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index fa0df1c37261..35ce9be88405 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -8920,13 +8920,8 @@ nfsm_split(struct mbuf *mp, uint64_t xfer) * page. */ if (left < plen) { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m2->m_epg_pa[0] = VM_PAGE_TO_PHYS(pg); m2->m_epg_npgs = 1; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index ffd41304be43..62fcbcd90b0b 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2057,7 +2057,6 @@ __CONCAT(PMTYPE, pinit0)(pmap_t pmap) static int __CONCAT(PMTYPE, pinit)(pmap_t pmap) { - vm_page_t m; int i; /* @@ -2085,11 +2084,10 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) * allocate the page directory page(s) */ for (i = 0; i < NPGPTD; i++) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - pmap->pm_ptdpg[i] = m; + pmap->pm_ptdpg[i] = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_WAITOK); #ifdef PMAP_PAE_COMP - pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(m) | PG_V; + pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(pmap->pm_ptdpg[i]) | PG_V; #endif } @@ -2103,10 +2101,6 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) } #endif - for (i = 0; i < NPGPTD; i++) - if ((pmap->pm_ptdpg[i]->flags & PG_ZERO) == 0) - pagezero(pmap->pm_pdir + (i * NPDEPG)); - /* Install the trampoline mapping. */ pmap->pm_pdir[TRPTDI] = PTD[TRPTDI]; @@ -2130,8 +2124,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); @@ -2146,8 +2139,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -2271,16 +2263,13 @@ __CONCAT(PMTYPE, growkernel)(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - + nkpg->pindex = kernel_vm_end >> PDRSHIFT; nkpt++; - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); pdir_pde(KPTD, kernel_vm_end) = newpdir; @@ -2575,8 +2564,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_ptelist_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -2808,9 +2797,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | - VM_ALLOC_WIRED)) == NULL) { + if ((oldpde & PG_A) == 0 || + (mpte = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); sva = trunc_4mpage(va); pmap_remove_pde(pmap, pde, sva, &free); @@ -2821,6 +2809,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) " in pmap %p", va, pmap); return (FALSE); } + mpte->pindex = va >> PDRSHIFT; if (pmap != kernel_pmap) { mpte->ref_count = NPTEPG; pmap->pm_stats.resident_count++; @@ -5914,8 +5903,7 @@ pmap_trm_import(void *unused __unused, vmem_size_t size, int flags, prev_addr += trm_guard; trm_pte = PTmap + atop(prev_addr); for (af = prev_addr; af < addr; af += PAGE_SIZE) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pte_store(&trm_pte[atop(af - prev_addr)], VM_PAGE_TO_PHYS(m) | PG_M | PG_A | PG_RW | PG_V | pgeflag | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE)); @@ -5934,10 +5922,8 @@ pmap_init_trm(void) trm_guard = 0; pmap_trm_arena = vmem_create("i386trampoline", 0, 0, 1, 0, M_WAITOK); vmem_set_import(pmap_trm_arena, pmap_trm_import, NULL, NULL, PAGE_SIZE); - pd_m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK | VM_ALLOC_ZERO); - if ((pd_m->flags & PG_ZERO) == 0) - pmap_zero_page(pd_m); + pd_m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK | + VM_ALLOC_ZERO); PTD[TRPTDI] = VM_PAGE_TO_PHYS(pd_m) | PG_M | PG_A | PG_RW | PG_V | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, TRUE); } diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 36316f2bc3ff..d1f2fd2bd9e4 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1624,8 +1624,8 @@ mb_alloc_ext_plus_pages(int len, int how) npgs = howmany(len, PAGE_SIZE); for (i = 0; i < npgs; i++) { do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); if (pg == NULL) { if (how == M_NOWAIT) { m->m_epg_npgs = i; diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index bde9fca97f50..f6179592fb11 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2101,12 +2101,8 @@ ktls_encrypt_record(struct ktls_wq *wq, struct mbuf *m, } else { off = m->m_epg_1st_off; for (i = 0; i < m->m_epg_npgs; i++, off = 0) { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED | VM_ALLOC_WAITFAIL); - } while (pg == NULL); - + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED | VM_ALLOC_WAITOK); len = m_epg_pagelen(m, i, off); state->parray[i] = VM_PAGE_TO_PHYS(pg); state->dst_iov[i].iov_base = diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 0f1a0c5e4e0c..e0793a16d76f 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1767,8 +1767,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NODUMP | VM_ALLOC_WIRED; MPASS((flags & M_PKTHDR) == 0); MPASS((how & M_ZERO) == 0); @@ -1816,7 +1815,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) needed = length = MIN(maxseg, total); for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) { retry_page: - pg_array[i] = vm_page_alloc(NULL, 0, pflags); + pg_array[i] = vm_page_alloc_noobj(pflags); if (pg_array[i] == NULL) { if (how & M_NOWAIT) { goto failed; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index e234bf2d6563..352c341d05f7 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4926,9 +4926,8 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to) * could interfere with paging I/O, no matter which * process we are. */ - p = vm_page_alloc(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | - VM_ALLOC_WAITOK); + p = vm_page_alloc_noobj(VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | + VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | VM_ALLOC_WAITOK); pmap_qenter(pg, &p, 1); bp->b_pages[index] = p; } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index d459bbeab1b2..a41614c5457b 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1115,10 +1115,6 @@ pmap_alloc_direct_page(unsigned int index, int req) VM_ALLOC_ZERO); if (m == NULL) return (NULL); - - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - m->pindex = index; return (m); } diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c index 5b57447edd6a..321804d634d5 100644 --- a/sys/mips/mips/uma_machdep.c +++ b/sys/mips/mips/uma_machdep.c @@ -75,8 +75,6 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)MIPS_PHYS_TO_DIRECT(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); return (va); } diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 55147d47b2bf..2a9318446c0f 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1915,8 +1915,8 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, *flags = UMA_SLAB_PRIV; needed_lock = !PMAP_LOCKED(kernel_pmap); - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); @@ -1938,9 +1938,6 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, if (needed_lock) PMAP_UNLOCK(kernel_pmap); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero((void *)va, PAGE_SIZE); - return (void *)va; } diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index ca1a4d2f4797..d29ca730d7d6 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -1214,8 +1214,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -1637,8 +1636,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -3529,13 +3527,11 @@ mmu_radix_growkernel(vm_offset_t addr) l2e = pmap_pml2e(kernel_pmap, kernel_vm_end); if ((be64toh(*l2e) & PG_V) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_PAGE_SIZE_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_PAGE_SIZE_SHIFT; paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l2e, paddr); continue; /* try again */ @@ -3550,13 +3546,11 @@ mmu_radix_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, pmap_l3e_pindex(kernel_vm_end), - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = pmap_l3e_pindex(kernel_vm_end); paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l3e, paddr); @@ -4243,8 +4237,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -4257,8 +4250,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - mmu_radix_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -4915,10 +4907,9 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, * is the only part of the kernel address space that must be * handled here. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - pmap_l3e_pindex(va), (va >= DMAP_MIN_ADDRESS && va < - DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { *** 361 LINES SKIPPED *** From nobody Wed Oct 20 01:23:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB42D180FC19; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCp4pvgz3lbH; Wed, 20 Oct 2021 01:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79B751EA31; Wed, 20 Oct 2021 01:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NI71095518; Wed, 20 Oct 2021 01:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NIGI095517; Wed, 20 Oct 2021 01:23:18 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:18 GMT Message-Id: <202110200123.19K1NIGI095517@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: 92db9f3bb762 - main - Introduce vm_page_alloc_noobj_contig() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92db9f3bb7623883231214e74ec38788c3dffc6a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=92db9f3bb7623883231214e74ec38788c3dffc6a commit 92db9f3bb7623883231214e74ec38788c3dffc6a Author: Mark Johnston AuthorDate: 2021-10-20 00:24:21 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Introduce vm_page_alloc_noobj_contig() This is the same as vm_page_alloc_noobj(), but allocates physically contiguous runs of memory. For now it is implemented in terms of vm_page_alloc_contig(), with the difference that vm_page_alloc_noobj_contig() implements VM_ALLOC_ZERO by zeroing the page. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32005 --- sys/vm/vm_page.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/vm/vm_page.h | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 0190f67dd7da..6927d7af4409 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2509,6 +2509,49 @@ vm_page_alloc_noobj_domain(int domain, int req) return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); } +vm_page_t +vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_noobj_contig_domain(domain, req, npages, low, + high, alignment, boundary, memattr); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + + return (m); +} + +vm_page_t +vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + vm_page_t m; + u_long i; + + KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOOBJ)) == 0, + ("%s: invalid req %#x", __func__, req)); + + m = vm_page_alloc_contig_domain(NULL, 0, domain, req | VM_ALLOC_NOOBJ, + npages, low, high, alignment, boundary, memattr); + if (m != NULL && (req & VM_ALLOC_ZERO) != 0) { + for (i = 0; i < npages; i++) { + if ((m[i].flags & PG_ZERO) == 0) + pmap_zero_page(&m[i]); + } + } + return (m); +} + /* * Check a page that has been freshly dequeued from a freelist. */ diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 600619b00eaf..b31ea0241cc7 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -616,6 +616,12 @@ vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); vm_page_t vm_page_alloc_noobj(int); vm_page_t vm_page_alloc_noobj_domain(int, int); +vm_page_t vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); +vm_page_t vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int); From nobody Wed Oct 20 01:23:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E0587180FB7E; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCs6q5Wz3ldN; Wed, 20 Oct 2021 01:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDE721E89E; Wed, 20 Oct 2021 01:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NKmS095566; Wed, 20 Oct 2021 01:23:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NKuT095565; Wed, 20 Oct 2021 01:23:20 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:20 GMT Message-Id: <202110200123.19K1NKuT095565@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: c40cf9bc6271 - main - vm_page: Stop handling VM_ALLOC_NOOBJ in vm_page_alloc_domain_after() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c40cf9bc62718241d4afdb3ef48a68052cb37b50 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c40cf9bc62718241d4afdb3ef48a68052cb37b50 commit c40cf9bc62718241d4afdb3ef48a68052cb37b50 Author: Mark Johnston AuthorDate: 2021-10-20 00:25:14 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 vm_page: Stop handling VM_ALLOC_NOOBJ in vm_page_alloc_domain_after() This makes the allocator simpler since it can assume object != NULL. Also modify the function to unconditionally preserve PG_ZERO, so VM_ALLOC_ZERO is effectively ignored (and still must be implemented by the caller for now). Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32033 --- sys/vm/vm_page.c | 104 +++++++++++++++++++++++++++---------------------------- sys/vm/vm_page.h | 8 ++++- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 0644c1167984..c289bdb6d3da 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1963,8 +1963,6 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex) * intends to allocate * VM_ALLOC_NOBUSY do not exclusive busy the page * VM_ALLOC_NODUMP do not include the page in a kernel core dump - * VM_ALLOC_NOOBJ page is not associated with an object and - * should not be exclusive busy * VM_ALLOC_SBUSY shared busy the allocated page * VM_ALLOC_WIRED wire the allocated page * VM_ALLOC_ZERO prefer a zeroed page @@ -1973,8 +1971,8 @@ vm_page_t vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) { - return (vm_page_alloc_after(object, pindex, req, object != NULL ? - vm_radix_lookup_le(&object->rtree, pindex) : NULL)); + return (vm_page_alloc_after(object, pindex, req, + vm_radix_lookup_le(&object->rtree, pindex))); } vm_page_t @@ -1983,8 +1981,7 @@ vm_page_alloc_domain(vm_object_t object, vm_pindex_t pindex, int domain, { return (vm_page_alloc_domain_after(object, pindex, domain, req, - object != NULL ? vm_radix_lookup_le(&object->rtree, pindex) : - NULL)); + vm_radix_lookup_le(&object->rtree, pindex))); } /* @@ -2071,24 +2068,24 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pindex_t pindex, int domain, { struct vm_domain *vmd; vm_page_t m; - int flags, pool; + int flags; - KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && - (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && - ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != +#define VPA_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \ + VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY | \ + VM_ALLOC_SBUSY | VM_ALLOC_WIRED | \ + VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK) + KASSERT((req & ~VPA_FLAGS) == 0, + ("invalid request %#x", req)); + KASSERT(((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), - ("inconsistent object(%p)/req(%x)", object, req)); - KASSERT(object == NULL || (req & VM_ALLOC_WAITOK) == 0, - ("Can't sleep and retry object insertion.")); + ("invalid request %#x", req)); KASSERT(mpred == NULL || mpred->pindex < pindex, ("mpred %p doesn't precede pindex 0x%jx", mpred, (uintmax_t)pindex)); - if (object != NULL) - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_WLOCKED(object); flags = 0; m = NULL; - pool = object != NULL ? VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT; again: #if VM_NRESERVLEVEL > 0 /* @@ -2101,8 +2098,9 @@ again: } #endif vmd = VM_DOMAIN(domain); - if (vmd->vmd_pgcache[pool].zone != NULL) { - m = uma_zalloc(vmd->vmd_pgcache[pool].zone, M_NOWAIT | M_NOVM); + if (vmd->vmd_pgcache[VM_FREEPOOL_DEFAULT].zone != NULL) { + m = uma_zalloc(vmd->vmd_pgcache[VM_FREEPOOL_DEFAULT].zone, + M_NOWAIT | M_NOVM); if (m != NULL) { flags |= PG_PCPU_CACHE; goto found; @@ -2113,7 +2111,7 @@ again: * If not, allocate it from the free page queues. */ vm_domain_free_lock(vmd); - m = vm_phys_alloc_pages(domain, pool, 0); + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, 0); vm_domain_free_unlock(vmd); if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); @@ -2142,15 +2140,13 @@ found: /* * Initialize the page. Only the PG_ZERO flag is inherited. */ - if ((req & VM_ALLOC_ZERO) != 0) - flags |= (m->flags & PG_ZERO); + flags |= m->flags & PG_ZERO; if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; m->a.flags = 0; - m->oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? - VPO_UNMANAGED : 0; - if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ | VM_ALLOC_SBUSY)) == 0) + m->oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; + if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) m->busy_lock = VPB_CURTHREAD_EXCLUSIVE; else if ((req & VM_ALLOC_SBUSY) != 0) m->busy_lock = VPB_SHARERS_WORD(1); @@ -2162,31 +2158,28 @@ found: } m->a.act_count = 0; - if (object != NULL) { - if (vm_page_insert_after(m, object, pindex, mpred)) { - if (req & VM_ALLOC_WIRED) { - vm_wire_sub(1); - m->ref_count = 0; - } - KASSERT(m->object == NULL, ("page %p has object", m)); - m->oflags = VPO_UNMANAGED; - m->busy_lock = VPB_UNBUSIED; - /* Don't change PG_ZERO. */ - vm_page_free_toq(m); - if (req & VM_ALLOC_WAITFAIL) { - VM_OBJECT_WUNLOCK(object); - vm_radix_wait(); - VM_OBJECT_WLOCK(object); - } - return (NULL); + if (vm_page_insert_after(m, object, pindex, mpred)) { + if (req & VM_ALLOC_WIRED) { + vm_wire_sub(1); + m->ref_count = 0; + } + KASSERT(m->object == NULL, ("page %p has object", m)); + m->oflags = VPO_UNMANAGED; + m->busy_lock = VPB_UNBUSIED; + /* Don't change PG_ZERO. */ + vm_page_free_toq(m); + if (req & VM_ALLOC_WAITFAIL) { + VM_OBJECT_WUNLOCK(object); + vm_radix_wait(); + VM_OBJECT_WLOCK(object); } + return (NULL); + } - /* Ignore device objects; the pager sets "memattr" for them. */ - if (object->memattr != VM_MEMATTR_DEFAULT && - (object->flags & OBJ_FICTITIOUS) == 0) - pmap_page_set_memattr(m, object->memattr); - } else - m->pindex = pindex; + /* Ignore device objects; the pager sets "memattr" for them. */ + if (object->memattr != VM_MEMATTR_DEFAULT && + (object->flags & OBJ_FICTITIOUS) == 0) + pmap_page_set_memattr(m, object->memattr); return (m); } @@ -2405,9 +2398,12 @@ _vm_page_alloc_noobj_domain(int domain, const int freelist, int req) vm_page_t m; int flags; - KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | - VM_ALLOC_NOOBJ)) == 0, - ("%s: invalid req %#x", __func__, req)); +#define VPAN_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \ + VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | \ + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | \ + VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK) + KASSERT((req & ~VPAN_FLAGS) == 0, + ("invalid request %#x", req)); flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0; vmd = VM_DOMAIN(domain); @@ -2443,7 +2439,9 @@ found: vm_page_dequeue(m); vm_page_alloc_check(m); - /* Consumers should not rely on a useful default pindex value. */ + /* + * Consumers should not rely on a useful default pindex value. + */ m->pindex = 0xdeadc0dedeadc0de; m->flags = (m->flags & PG_ZERO) | flags; m->a.flags = 0; @@ -4508,7 +4506,7 @@ vm_page_grab_pflags(int allocflags) pflags = allocflags & ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL | - VM_ALLOC_NOBUSY); + VM_ALLOC_NOBUSY | VM_ALLOC_IGN_SBUSY); if ((allocflags & VM_ALLOC_NOWAIT) == 0) pflags |= VM_ALLOC_WAITFAIL; if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) @@ -4681,7 +4679,7 @@ vm_page_grab_valid(vm_page_t *mp, vm_object_t object, vm_pindex_t pindex, int al ("vm_page_grab_valid: Invalid flags 0x%X", allocflags)); VM_OBJECT_ASSERT_WLOCKED(object); pflags = allocflags & ~(VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY | - VM_ALLOC_WIRED); + VM_ALLOC_WIRED | VM_ALLOC_IGN_SBUSY); pflags |= VM_ALLOC_WAITFAIL; retrylookup: diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index b31ea0241cc7..140ea7e2fadb 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -549,8 +549,14 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ #define VM_ALLOC_NOWAIT 0x8000 /* (acgnp) Do not sleep */ +#define VM_ALLOC_COUNT_MAX 0xffff #define VM_ALLOC_COUNT_SHIFT 16 -#define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) +#define VM_ALLOC_COUNT_MASK (VM_ALLOC_COUNT(VM_ALLOC_COUNT_MAX)) +#define VM_ALLOC_COUNT(count) ({ \ + KASSERT((count) <= VM_ALLOC_COUNT_MAX, \ + ("%s: invalid VM_ALLOC_COUNT value", __func__)); \ + (count) << VM_ALLOC_COUNT_SHIFT; \ +}) #ifdef M_NOWAIT static inline int From nobody Wed Oct 20 01:23:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2CDE5180FD02; Wed, 20 Oct 2021 01:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCr06v2z3lVH; Wed, 20 Oct 2021 01:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BCC01EA32; Wed, 20 Oct 2021 01:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NJxe095542; Wed, 20 Oct 2021 01:23:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NJ4h095541; Wed, 20 Oct 2021 01:23:19 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:19 GMT Message-Id: <202110200123.19K1NJ4h095541@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: 84c3922243a7 - main - Convert consumers to vm_page_alloc_noobj_contig() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84c3922243a7b7fd510dcfb100aec59c878c57d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=84c3922243a7b7fd510dcfb100aec59c878c57d0 commit 84c3922243a7b7fd510dcfb100aec59c878c57d0 Author: Mark Johnston AuthorDate: 2021-10-20 00:25:04 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Convert consumers to vm_page_alloc_noobj_contig() Remove now-unneeded page zeroing. No functional change intended. Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32006 --- sys/amd64/amd64/mp_machdep.c | 3 +-- sys/amd64/amd64/pmap.c | 28 ++++++---------------------- sys/arm/nvidia/drm2/tegra_bo.c | 12 ++++-------- sys/compat/linuxkpi/common/src/linux_page.c | 17 +++-------------- sys/dev/drm2/ttm/ttm_bo.c | 11 +++++------ sys/dev/drm2/ttm/ttm_page_alloc.c | 6 +++--- sys/kern/uipc_ktls.c | 7 +++---- sys/powerpc/aim/mmu_radix.c | 8 ++++---- sys/powerpc/aim/slb.c | 9 +++------ sys/riscv/riscv/pmap.c | 2 -- sys/vm/uma_core.c | 19 +++++++------------ sys/vm/vm_page.c | 28 ++++++++++++++-------------- 12 files changed, 53 insertions(+), 97 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 33defe79c8b9..e954e8cebbb9 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -334,8 +334,7 @@ start_all_aps(void) mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); MPASS(bootMP_size <= PAGE_SIZE); - m_boottramp = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, 1, 0, + m_boottramp = vm_page_alloc_noobj_contig(0, 1, 0, (1ULL << 20), /* Trampoline should be below 1M for real mode */ PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); boot_address = VM_PAGE_TO_PHYS(m_boottramp); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8d6c81a5459b..f8bb384afdaf 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2110,14 +2110,8 @@ pmap_init_pat(void) vm_page_t pmap_page_alloc_below_4g(bool zeroed) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, (zeroed ? VM_ALLOC_ZERO : 0) | - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if (m != NULL && zeroed && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - return (m); + return (vm_page_alloc_noobj_contig((zeroed ? VM_ALLOC_ZERO : 0), + 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT)); } extern const char la57_trampoline[], la57_trampoline_gdt_desc[], @@ -11411,13 +11405,8 @@ pmap_kasan_enter_alloc_4k(void) static vm_page_t pmap_kasan_enter_alloc_2m(void) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); - if (m != NULL) - memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); - return (m); + return (vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, + NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); } /* @@ -11479,13 +11468,8 @@ pmap_kmsan_enter_alloc_4k(void) static vm_page_t pmap_kmsan_enter_alloc_2m(void) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); - if (m != NULL) - memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); - return (m); + return (vm_page_alloc_noobj_contig(VM_ALLOC_ZERO | VM_ALLOC_WIRED, + NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); } /* diff --git a/sys/arm/nvidia/drm2/tegra_bo.c b/sys/arm/nvidia/drm2/tegra_bo.c index 7479fd8bc8da..be5177973f4f 100644 --- a/sys/arm/nvidia/drm2/tegra_bo.c +++ b/sys/arm/nvidia/drm2/tegra_bo.c @@ -97,21 +97,19 @@ tegra_bo_alloc_contig(size_t npages, u_long alignment, vm_memattr_t memattr, vm_page_t **ret_page) { vm_page_t m; - int pflags, tries, i; + int tries, i; vm_paddr_t low, high, boundary; low = 0; high = -1UL; boundary = 0; - pflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_WIRED | VM_ALLOC_ZERO; tries = 0; retry: - m = vm_page_alloc_contig(NULL, 0, pflags, npages, low, high, alignment, - boundary, memattr); + m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRE | VM_ALLOC_ZERO, npages, + low, high, alignment, boundary, memattr); if (m == NULL) { if (tries < 3) { - if (!vm_page_reclaim_contig(pflags, npages, low, high, + if (!vm_page_reclaim_contig(0, npages, low, high, alignment, boundary)) vm_wait(NULL); tries++; @@ -121,8 +119,6 @@ retry: } for (i = 0; i < npages; i++, m++) { - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; (*ret_page)[i] = m; } diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index f712c0c155a4..3c8bc2bd3c5b 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -92,7 +92,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if (PMAP_HAS_DMAP) { unsigned long npages = 1UL << order; - int req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_NORMAL; + int req = VM_ALLOC_WIRED; if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; @@ -104,9 +104,8 @@ linux_alloc_pages(gfp_t flags, unsigned int order) vm_paddr_t pmax = (flags & GFP_DMA32) ? BUS_SPACE_MAXADDR_32BIT : BUS_SPACE_MAXADDR; retry: - page = vm_page_alloc_contig(NULL, 0, req, - npages, 0, pmax, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - + page = vm_page_alloc_noobj_contig(req, npages, 0, pmax, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); if (page == NULL) { if (flags & M_WAITOK) { if (!vm_page_reclaim_contig(req, @@ -119,16 +118,6 @@ linux_alloc_pages(gfp_t flags, unsigned int order) return (NULL); } } - if (flags & M_ZERO) { - unsigned long x; - - for (x = 0; x != npages; x++) { - vm_page_t pgo = page + x; - - if ((pgo->flags & PG_ZERO) == 0) - pmap_zero_page(pgo); - } - } } else { vm_offset_t vaddr; diff --git a/sys/dev/drm2/ttm/ttm_bo.c b/sys/dev/drm2/ttm/ttm_bo.c index 010afe6d8b3b..d5c11ecff25d 100644 --- a/sys/dev/drm2/ttm/ttm_bo.c +++ b/sys/dev/drm2/ttm/ttm_bo.c @@ -1488,21 +1488,20 @@ int ttm_bo_global_init(struct drm_global_reference *ref) struct ttm_bo_global_ref *bo_ref = container_of(ref, struct ttm_bo_global_ref, ref); struct ttm_bo_global *glob = ref->object; - int req, ret; + int ret; int tries; sx_init(&glob->device_list_mutex, "ttmdlm"); mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF); glob->mem_glob = bo_ref->mem_glob; - req = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ; tries = 0; retry: - glob->dummy_read_page = vm_page_alloc_contig(NULL, 0, req, - 1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); + glob->dummy_read_page = vm_page_alloc_noobj_contig(0, 1, 0, + VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); if (unlikely(glob->dummy_read_page == NULL)) { - if (tries < 1 && vm_page_reclaim_contig(req, 1, - 0, VM_MAX_ADDRESS, PAGE_SIZE, 0)) { + if (tries < 1 && vm_page_reclaim_contig(0, 1, 0, + VM_MAX_ADDRESS, PAGE_SIZE, 0)) { tries++; goto retry; } diff --git a/sys/dev/drm2/ttm/ttm_page_alloc.c b/sys/dev/drm2/ttm/ttm_page_alloc.c index b35a06520e07..6fc12cad121f 100644 --- a/sys/dev/drm2/ttm/ttm_page_alloc.c +++ b/sys/dev/drm2/ttm/ttm_page_alloc.c @@ -163,8 +163,8 @@ ttm_vm_page_alloc_dma32(int req, vm_memattr_t memattr) int tries; for (tries = 0; ; tries++) { - p = vm_page_alloc_contig(NULL, 0, req, 1, 0, 0xffffffff, - PAGE_SIZE, 0, memattr); + p = vm_page_alloc_noobj_contig(req, 1, 0, 0xffffffff, PAGE_SIZE, + 0, memattr); if (p != NULL || tries > 2) return (p); if (!vm_page_reclaim_contig(req, 1, 0, 0xffffffff, @@ -191,7 +191,7 @@ ttm_vm_page_alloc(int flags, enum ttm_caching_state cstate) int req; memattr = ttm_caching_state_to_vm(cstate); - req = VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ; + req = VM_ALLOC_WIRED; if ((flags & TTM_PAGE_FLAG_ZERO_ALLOC) != 0) req |= VM_ALLOC_ZERO; diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index f6179592fb11..1d3321fd4ff6 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -341,16 +341,15 @@ static int ktls_buffer_import(void *arg, void **store, int count, int domain, int flags) { vm_page_t m; - int i; + int i, req; KASSERT((ktls_maxlen & PAGE_MASK) == 0, ("%s: ktls max length %d is not page size-aligned", __func__, ktls_maxlen)); + req = VM_ALLOC_WIRED | VM_ALLOC_NODUMP | malloc2vm_flags(flags); for (i = 0; i < count; i++) { - m = vm_page_alloc_contig_domain(NULL, 0, domain, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_NODUMP | malloc2vm_flags(flags), + m = vm_page_alloc_noobj_contig_domain(domain, req, atop(ktls_maxlen), 0, ~0ul, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); if (m == NULL) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index d29ca730d7d6..95c3f5f009e4 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -3570,14 +3570,14 @@ static int radix_pgd_import(void *arg __unused, void **store, int count, int domain __unused, int flags) { + int req; + req = VM_ALLOC_WIRED | malloc2vm_flags(flags); for (int i = 0; i < count; i++) { - vm_page_t m = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_WAITOK, RADIX_PGD_SIZE/PAGE_SIZE, + vm_page_t m = vm_page_alloc_noobj_contig(req, + RADIX_PGD_SIZE / PAGE_SIZE, 0, (vm_paddr_t)-1, RADIX_PGD_SIZE, L1_PAGE_SIZE, VM_MEMATTR_DEFAULT); - /* XXX zero on alloc here so we don't have to later */ store[i] = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); } return (count); diff --git a/sys/powerpc/aim/slb.c b/sys/powerpc/aim/slb.c index 886e11c9b356..c107fcbcfc43 100644 --- a/sys/powerpc/aim/slb.c +++ b/sys/powerpc/aim/slb.c @@ -500,9 +500,9 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, int domain, realmax = platform_real_maxaddr(); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_contig_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED, - 1, 0, realmax, PAGE_SIZE, PAGE_SIZE, VM_MEMATTR_DEFAULT); + m = vm_page_alloc_noobj_contig_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED, 1, 0, realmax, PAGE_SIZE, PAGE_SIZE, + VM_MEMATTR_DEFAULT); if (m == NULL) return (NULL); @@ -513,9 +513,6 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, int domain, pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); } - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); } diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index e1ff056117eb..9abf75a731f5 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2757,8 +2757,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, VM_ALLOC_ZERO); if (l3_m == NULL) panic("pmap_enter: l3 pte_m == NULL"); - if ((l3_m->flags & PG_ZERO) == 0) - pmap_zero_page(l3_m); l3_pa = VM_PAGE_TO_PHYS(l3_m); l3_pn = (l3_pa / PAGE_SIZE); diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index a510295b3c65..68553bda2249 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1885,17 +1885,15 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, { vm_paddr_t pa; vm_page_t m; - void *mem; - int pages; - int i; + int i, pages; pages = howmany(bytes, PAGE_SIZE); KASSERT(pages > 0, ("%s can't reserve 0 pages", __func__)); *pflag = UMA_SLAB_BOOT; - m = vm_page_alloc_contig_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED, pages, - (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT); + m = vm_page_alloc_noobj_contig_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED, pages, (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, + VM_MEMATTR_DEFAULT); if (m == NULL) return (NULL); @@ -1907,13 +1905,10 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, dump_add_page(pa); #endif } - /* Allocate KVA and indirectly advance bootmem. */ - mem = (void *)pmap_map(&bootmem, m->phys_addr, - m->phys_addr + (pages * PAGE_SIZE), VM_PROT_READ | VM_PROT_WRITE); - if ((wait & M_ZERO) != 0) - bzero(mem, pages * PAGE_SIZE); - return (mem); + /* Allocate KVA and indirectly advance bootmem. */ + return ((void *)pmap_map(&bootmem, m->phys_addr, + m->phys_addr + (pages * PAGE_SIZE), VM_PROT_READ | VM_PROT_WRITE)); } static void diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 6927d7af4409..0644c1167984 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2883,32 +2883,32 @@ vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, * "m_run" and "high" only as a last * resort. */ - req = req_class | VM_ALLOC_NOOBJ; + req = req_class; if ((m->flags & PG_NODUMP) != 0) req |= VM_ALLOC_NODUMP; if (trunc_page(high) != ~(vm_paddr_t)PAGE_MASK) { - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - round_page(high), - ~(vm_paddr_t)0, - PAGE_SIZE, 0, - VM_MEMATTR_DEFAULT); + m_new = + vm_page_alloc_noobj_contig( + req, 1, round_page(high), + ~(vm_paddr_t)0, PAGE_SIZE, + 0, VM_MEMATTR_DEFAULT); } else m_new = NULL; if (m_new == NULL) { pa = VM_PAGE_TO_PHYS(m_run); - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - 0, pa - 1, PAGE_SIZE, 0, + m_new = + vm_page_alloc_noobj_contig( + req, 1, 0, pa - 1, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); } if (m_new == NULL) { pa += ptoa(npages); - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - pa, high, PAGE_SIZE, 0, - VM_MEMATTR_DEFAULT); + m_new = + vm_page_alloc_noobj_contig( + req, 1, pa, high, PAGE_SIZE, + 0, VM_MEMATTR_DEFAULT); } if (m_new == NULL) { vm_page_xunbusy(m); From nobody Wed Oct 20 01:23:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2456F180FC43; Wed, 20 Oct 2021 01:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCt2Dc6z3ltb; Wed, 20 Oct 2021 01:23:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D48EF1EB89; Wed, 20 Oct 2021 01:23:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NLm8095590; Wed, 20 Oct 2021 01:23:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NLCG095589; Wed, 20 Oct 2021 01:23:21 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:21 GMT Message-Id: <202110200123.19K1NLCG095589@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: 02fb0585e7b3 - main - vm_page: Drop handling of VM_ALLOC_NOOBJ in vm_page_alloc_contig_domain() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02fb0585e7b31718b392f62bebe6efd426074793 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=02fb0585e7b31718b392f62bebe6efd426074793 commit 02fb0585e7b31718b392f62bebe6efd426074793 Author: Mark Johnston AuthorDate: 2021-10-20 00:26:09 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 vm_page: Drop handling of VM_ALLOC_NOOBJ in vm_page_alloc_contig_domain() As in vm_page_alloc_domain_after(), unconditionally preserve PG_ZERO. Implement vm_page_alloc_noobj_contig_domain(). Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32034 --- sys/vm/vm_page.c | 178 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 71 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index c289bdb6d3da..eca5d0801b7f 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2217,8 +2217,6 @@ found: * optional allocation flags: * VM_ALLOC_NOBUSY do not exclusive busy the page * VM_ALLOC_NODUMP do not include the page in a kernel core dump - * VM_ALLOC_NOOBJ page is not associated with an object and - * should not be exclusive busy * VM_ALLOC_SBUSY shared busy the allocated page * VM_ALLOC_WIRED wire the allocated page * VM_ALLOC_ZERO prefer a zeroed page @@ -2252,28 +2250,21 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t m, m_ret, mpred; u_int busy_lock, flags, oflags; - mpred = NULL; /* XXX: pacify gcc */ - KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && - (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && - ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != +#define VPAC_FLAGS VPA_FLAGS + KASSERT((req & ~VPAC_FLAGS) == 0, + ("invalid request %#x", req)); + KASSERT(((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), - ("vm_page_alloc_contig: inconsistent object(%p)/req(%x)", object, - req)); - KASSERT(object == NULL || (req & VM_ALLOC_WAITOK) == 0, - ("Can't sleep and retry object insertion.")); - if (object != NULL) { - VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT((object->flags & OBJ_FICTITIOUS) == 0, - ("vm_page_alloc_contig: object %p has fictitious pages", - object)); - } + ("invalid request %#x", req)); + VM_OBJECT_ASSERT_WLOCKED(object); + KASSERT((object->flags & OBJ_FICTITIOUS) == 0, + ("vm_page_alloc_contig: object %p has fictitious pages", + object)); KASSERT(npages > 0, ("vm_page_alloc_contig: npages is zero")); - if (object != NULL) { - mpred = vm_radix_lookup_le(&object->rtree, pindex); - KASSERT(mpred == NULL || mpred->pindex != pindex, - ("vm_page_alloc_contig: pindex already allocated")); - } + mpred = vm_radix_lookup_le(&object->rtree, pindex); + KASSERT(mpred == NULL || mpred->pindex != pindex, + ("vm_page_alloc_contig: pindex already allocated")); /* * Can we allocate the pages without the number of free pages falling @@ -2325,14 +2316,11 @@ found: /* * Initialize the pages. Only the PG_ZERO flag is inherited. */ - flags = 0; - if ((req & VM_ALLOC_ZERO) != 0) - flags = PG_ZERO; + flags = PG_ZERO; if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; - oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? - VPO_UNMANAGED : 0; - if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ | VM_ALLOC_SBUSY)) == 0) + oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; + if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) busy_lock = VPB_CURTHREAD_EXCLUSIVE; else if ((req & VM_ALLOC_SBUSY) != 0) busy_lock = VPB_SHARERS_WORD(1); @@ -2340,11 +2328,9 @@ found: busy_lock = VPB_UNBUSIED; if ((req & VM_ALLOC_WIRED) != 0) vm_wire_add(npages); - if (object != NULL) { - if (object->memattr != VM_MEMATTR_DEFAULT && - memattr == VM_MEMATTR_DEFAULT) - memattr = object->memattr; - } + if (object->memattr != VM_MEMATTR_DEFAULT && + memattr == VM_MEMATTR_DEFAULT) + memattr = object->memattr; for (m = m_ret; m < &m_ret[npages]; m++) { m->a.flags = 0; m->flags = (m->flags | PG_NODUMP) & flags; @@ -2353,32 +2339,29 @@ found: m->ref_count = 1; m->a.act_count = 0; m->oflags = oflags; - if (object != NULL) { - if (vm_page_insert_after(m, object, pindex, mpred)) { - if ((req & VM_ALLOC_WIRED) != 0) - vm_wire_sub(npages); - KASSERT(m->object == NULL, - ("page %p has object", m)); - mpred = m; - for (m = m_ret; m < &m_ret[npages]; m++) { - if (m <= mpred && - (req & VM_ALLOC_WIRED) != 0) - m->ref_count = 0; - m->oflags = VPO_UNMANAGED; - m->busy_lock = VPB_UNBUSIED; - /* Don't change PG_ZERO. */ - vm_page_free_toq(m); - } - if (req & VM_ALLOC_WAITFAIL) { - VM_OBJECT_WUNLOCK(object); - vm_radix_wait(); - VM_OBJECT_WLOCK(object); - } - return (NULL); - } + if (vm_page_insert_after(m, object, pindex, mpred)) { + if ((req & VM_ALLOC_WIRED) != 0) + vm_wire_sub(npages); + KASSERT(m->object == NULL, + ("page %p has object", m)); mpred = m; - } else - m->pindex = pindex; + for (m = m_ret; m < &m_ret[npages]; m++) { + if (m <= mpred && + (req & VM_ALLOC_WIRED) != 0) + m->ref_count = 0; + m->oflags = VPO_UNMANAGED; + m->busy_lock = VPB_UNBUSIED; + /* Don't change PG_ZERO. */ + vm_page_free_toq(m); + } + if (req & VM_ALLOC_WAITFAIL) { + VM_OBJECT_WUNLOCK(object); + vm_radix_wait(); + VM_OBJECT_WLOCK(object); + } + return (NULL); + } + mpred = m; if (memattr != VM_MEMATTR_DEFAULT) pmap_page_set_memattr(m, memattr); pindex++; @@ -2532,22 +2515,75 @@ vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr) { - vm_page_t m; - u_long i; - - KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | - VM_ALLOC_NOOBJ)) == 0, - ("%s: invalid req %#x", __func__, req)); - - m = vm_page_alloc_contig_domain(NULL, 0, domain, req | VM_ALLOC_NOOBJ, - npages, low, high, alignment, boundary, memattr); - if (m != NULL && (req & VM_ALLOC_ZERO) != 0) { - for (i = 0; i < npages; i++) { - if ((m[i].flags & PG_ZERO) == 0) - pmap_zero_page(&m[i]); + struct vm_domain *vmd; + vm_page_t m, m_ret; + u_int flags; + +#define VPANC_FLAGS VPAN_FLAGS + KASSERT((req & ~VPANC_FLAGS) == 0, + ("invalid request %#x", req)); + KASSERT(((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != + (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), + ("invalid request %#x", req)); + KASSERT(npages > 0, ("vm_page_alloc_contig: npages is zero")); + + m_ret = NULL; +again: + vmd = VM_DOMAIN(domain); + if (vm_domain_allocate(vmd, req, npages)) { + /* + * allocate them from the free page queues. + */ + vm_domain_free_lock(vmd); + m_ret = vm_phys_alloc_contig(domain, npages, low, high, + alignment, boundary); + vm_domain_free_unlock(vmd); + if (m_ret == NULL) { + vm_domain_freecnt_inc(vmd, npages); } } - return (m); + if (m_ret == NULL) { + if (vm_domain_alloc_fail(vmd, NULL, req)) + goto again; + return (NULL); + } + + /* + * Initialize the pages. Only the PG_ZERO flag is inherited. + */ + flags = PG_ZERO; + if ((req & VM_ALLOC_NODUMP) != 0) + flags |= PG_NODUMP; + if ((req & VM_ALLOC_WIRED) != 0) + vm_wire_add(npages); + for (m = m_ret; m < &m_ret[npages]; m++) { + vm_page_dequeue(m); + vm_page_alloc_check(m); + + /* + * Consumers should not rely on a useful default pindex value. + */ + m->pindex = 0xdeadc0dedeadc0de; + m->a.flags = 0; + m->flags = (m->flags | PG_NODUMP) & flags; + m->busy_lock = VPB_UNBUSIED; + if ((req & VM_ALLOC_WIRED) != 0) + m->ref_count = 1; + m->a.act_count = 0; + m->oflags = VPO_UNMANAGED; + + /* + * Zero the page before updating any mappings since the page is + * not yet shared with any devices which might require the + * non-default memory attribute. pmap_page_set_memattr() + * flushes data caches before returning. + */ + if ((req & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + if (memattr != VM_MEMATTR_DEFAULT) + pmap_page_set_memattr(m, memattr); + } + return (m_ret); } /* From nobody Wed Oct 20 01:23:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2CF80180FE83; Wed, 20 Oct 2021 01:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCv6CDdz3lgs; Wed, 20 Oct 2021 01:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BFE41E9D5; Wed, 20 Oct 2021 01:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NMos095620; Wed, 20 Oct 2021 01:23:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NMpV095619; Wed, 20 Oct 2021 01:23:22 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:22 GMT Message-Id: <202110200123.19K1NMpV095619@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: 6d3c78d97028 - main - Rewrite the vm_page_alloc manual page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d3c78d970283dc5e64eaf10a4ae40b54613d608 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3c78d970283dc5e64eaf10a4ae40b54613d608 commit 6d3c78d970283dc5e64eaf10a4ae40b54613d608 Author: Mark Johnston AuthorDate: 2021-10-20 00:26:30 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Rewrite the vm_page_alloc manual page Document the new allocator variants and flesh out the description of some details of the page allocator interface. Reviewed by: kib, alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32035 --- share/man/man9/Makefile | 11 ++ share/man/man9/vm_page_alloc.9 | 339 ++++++++++++++++++++++++++++++++++------- 2 files changed, 292 insertions(+), 58 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index fdaa14bc93e4..eb4465259226 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2330,6 +2330,17 @@ MLINKS+=vm_map_stack.9 vm_map_growstack.9 MLINKS+=vm_map_wire.9 vm_map_wire_mapped.9 \ vm_page_wire.9 vm_page_unwire.9 \ vm_page_wire.9 vm_page_unwire_noq.9 +MLINKS+=vm_page_alloc.9 vm_page_alloc_after.9 \ + vm_page_alloc.9 vm_page_alloc_contig.9 \ + vm_page_alloc.9 vm_page_alloc_contig_domain.9 \ + vm_page_alloc.9 vm_page_alloc_domain.9 \ + vm_page_alloc.9 vm_page_alloc_domain_after.9 \ + vm_page_alloc.9 vm_page_alloc_freelist.9 \ + vm_page_alloc.9 vm_page_alloc_freelist_domain.9 \ + vm_page_alloc.9 vm_page_alloc_noobj.9 \ + vm_page_alloc.9 vm_page_alloc_noobj_contig.9 \ + vm_page_alloc.9 vm_page_alloc_noobj_contig_domain.9 \ + vm_page_alloc.9 vm_page_alloc_noobj_domain.9 MLINKS+=vm_page_bits.9 vm_page_clear_dirty.9 \ vm_page_bits.9 vm_page_dirty.9 \ vm_page_bits.9 vm_page_is_valid.9 \ diff --git a/share/man/man9/vm_page_alloc.9 b/share/man/man9/vm_page_alloc.9 index aa3854b47aea..1b587339b0cd 100644 --- a/share/man/man9/vm_page_alloc.9 +++ b/share/man/man9/vm_page_alloc.9 @@ -1,5 +1,9 @@ .\" .\" Copyright (C) 2001 Chad David . All rights reserved. +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Mark Johnston under +.\" sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -26,102 +30,321 @@ .\" .\" $FreeBSD$ .\" -.Dd November 16, 2016 +.Dd October 17, 2021 .Dt VM_PAGE_ALLOC 9 .Os .Sh NAME .Nm vm_page_alloc -.Nd "allocate a page for a" -.Vt vm_object +.Nd "allocate a page of memory" .Sh SYNOPSIS .In sys/param.h .In vm/vm.h .In vm/vm_page.h .Ft vm_page_t .Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int req" +.Ft vm_page_t +.Fo vm_page_alloc_after +.Fa "vm_object_t object" +.Fa "vm_pindex_t pindex" +.Fa "int req" +.Fa "vm_page_t mpred" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_contig +.Fa "vm_object_t object" +.Fa "vm_pindex_t pindex" +.Fa "int req" +.Fa "u_long npages" +.Fa "vm_paddr_t low" +.Fa "vm_paddr_t high" +.Fa "u_long alignment" +.Fa "vm_paddr_t boundary" +.Fa "vm_memattr_t memattr" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_contig_domain +.Fa "vm_object_t object" +.Fa "vm_pindex_t pindex" +.Fa "int req" +.Fa "u_long npages" +.Fa "vm_paddr_t low" +.Fa "vm_paddr_t high" +.Fa "u_long alignment" +.Fa "vm_paddr_t boundary" +.Fa "vm_memattr_t memattr" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_domain +.Fa "vm_object_t object" +.Fa "vm_pindex_t pindex" +.Fa "int domain" +.Fa "int req" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_domain_after +.Fa "vm_object_t object" +.Fa "vm_pindex_t pindex" +.Fa "int domain" +.Fa "int req" +.Fa "vm_page_t mpred" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_freelist +.Fa "int freelist" +.Fa "int req" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_freelist_domain +.Fa "int domain" +.Fa "int freelist" +.Fa "int req" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_noobj +.Fa "int req" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_noobj_contig +.Fa "int req" +.Fa "u_long npages" +.Fa "vm_paddr_t low" +.Fa "vm_paddr_t high" +.Fa "u_long alignment" +.Fa "vm_paddr_t boundary" +.Fa "vm_memattr_t memattr" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_noobj_contig_domain +.Fa "int domain" +.Fa "int req" +.Fa "u_long npages" +.Fa "vm_paddr_t low" +.Fa "vm_paddr_t high" +.Fa "u_long alignment" +.Fa "vm_paddr_t boundary" +.Fa "vm_memattr_t memattr" +.Fc +.Ft vm_page_t +.Fo vm_page_alloc_noobj_domain +.Fa "int domain" +.Fa "int req" +.Fc .Sh DESCRIPTION The .Fn vm_page_alloc -function allocates a page at +family of functions allocate one or more pages of physical memory. +Most kernel code should not call these functions directly but should instead +use a kernel memory allocator such as +.Xr malloc 9 +or +.Xr uma 9 , +or should use a higher-level interface to the page cache, such as +.Xr vm_page_grab 9 . +.Pp +All of the functions take a +.Fa req +parameter which encodes the allocation priority and optional modifier flags, +described below. +The functions whose names do not include +.Dq noobj +additionally insert the pages starting at index .Fa pindex -within +in the +VM object .Fa object . -It is assumed that a page has not already been allocated at -.Fa pindex . -The page returned is inserted into the object, unless -.Dv VM_ALLOC_NOOBJ -is specified in the -.Fa req . +The object must be write-locked and not have a page already resident at the +specified index. +The functions whose names include +.Dq domain +support NUMA-aware allocation by returning pages from the +.Xr numa 4 +domain specified by +.Fa domain . .Pp +The +.Fn vm_page_alloc_after +and +.Fn vm_page_alloc_domain_after +functions behave identically to .Fn vm_page_alloc -will not sleep. +and +.Fn vm_page_alloc_domain , +respectively, except that they take an additional parameter +.Fa mpred +which must be the page resident in +.Fa object +with largest index smaller than +.Fa pindex , +or +.Dv NULL +if no such page exists. +These functions exist to optimize the common case of loops that allocate +multiple pages at successive indices within an object. .Pp -Its arguments are: -.Bl -tag -width ".Fa object" -.It Fa object -The VM object to allocate the page for. The -.Fa object -must be locked if -.Dv VM_ALLOC_NOOBJ -is not specified. -.It Fa pindex -The index into the object at which the page should be inserted. -.It Fa req -The bitwise-inclusive OR of a class and any optional flags indicating -how the page should be allocated. +.Fn vm_page_alloc_contig +and +.Fn vm_page_alloc_noobj_contig +functions and their NUMA-aware variants allocate a physically contiguous run of +.Fa npages +pages which satisfies the specified constraints. +The +.Fa low +and +.Fa high +parameters specify a physical address range from which the run is to +be allocated. +The +.Fa alignment +parameter specifies the requested alignment of the first page in the run +and must be a power of two. +If the +.Fa boundary +parameter is non-zero, the pages constituting the run will not cross a +physical address that is a multiple of the parameter value, which must be a +power of two. +If +.Fa memattr +is not equal to +.Dv VM_MEMATTR_DEFAULT , +then mappings of the returned pages created by, e.g., +.Xr pmap_enter 9 +or +.Xr pmap_qenter 9 , +will carry the machine-dependent encoding of the memory attribute. +Additionally, the direct mapping of the page, if any, will be updated to +reflect the requested memory attribute. +.Pp +The +.Fn vm_page_alloc_freelist +and +.Fn vm_page_alloc_freelist_domain +functions behave identically to +.Fn vm_page_alloc_noobj +and +.Fn vm_page_alloc_noobj_domain , +respectively, except that a successful allocation will return a page from the +specified physical memory freelist. +These functions are not intended for use outside of the virtual memory +subsystem and exist only to support the requirements of certain platforms. +.Sh REQUEST FLAGS +All page allocator functions accept a +.Fa req +parameter that governs certain aspects of the function's behavior. +.Pp +The +.Dv VM_ALLOC_WAITOK , +.Dv VM_ALLOC_WAITFAIL , +and +.Dv VM_ALLOC_NOWAIT +flags specify the behavior of the allocator if free pages could not be +immediately allocated. +The +.Dv VM_ALLOC_WAITOK +flag can only be used with the +.Dq noobj +variants. +If +.Dv VM_ALLOC_NOWAIT +is specified, then the allocator gives up and returns +.Dv NULL . +.Dv VM_ALLOC_NOWAIT +is specified implicitly if none of the flags are present in the request. +If either +.Dv VM_ALLOC_WAITOK +or +.Dv VM_ALLOC_WAITFAIL +is specified, the allocator will put the calling thread to sleep until +sufficient free pages become available. +At this point, if +.Dv VM_ALLOC_WAITFAIL +is specified the allocator will return +.Dv NULL , +and if +.Dv VM_ALLOC_WAITOK +is specified the allocator will retry the allocation. +After a failed +.Dv VM_ALLOC_WAITFAIL +allocation returns, the VM object, if any, will have been unlocked while the +thread was sleeping. +In this case the VM object write lock will be re-acquired before the function +call returns. .Pp -Exactly one of the following classes must be specified: +.Fa req +also encodes the allocation request priority. +By default the page(s) are allocated with no special treatment. +If the number of available free pages is below a certain watermark, the +allocation will fail or the allocating thread will sleep, depending on +the specified wait flag. +The watermark is computed at boot time and corresponds to a small (less than +one percent) fraction of the system's total physical memory. +To allocate memory more aggressively, one of following flags may be specified. .Bl -tag -width ".Dv VM_ALLOC_INTERRUPT" -.It Dv VM_ALLOC_NORMAL -The page should be allocated with no special treatment. .It Dv VM_ALLOC_SYSTEM -The page can be allocated if the cache is empty and the free -page count is above the interrupt reserved water mark. +The page can be allocated if the free page count is above the interrupt +reserved water mark. This flag should be used only when the system really needs the page. .It Dv VM_ALLOC_INTERRUPT -.Fn vm_page_alloc -is being called during an interrupt. -A page will be returned successfully if the free page count is greater -than zero. +The allocation will fail only if zero free pages are available. +This flag should be used only if the consequences of an allocation failure +are worse than leaving the system without free memory. +For example, this flag is used when allocating kernel page table pages, where +allocation failures trigger a kernel panic. .El .Pp -The optional flags are: +The following optional flags can further modify allocator behavior: .Bl -tag -width ".Dv VM_ALLOC_NOBUSY" +.It Dv VM_ALLOC_SBUSY +The returned page will be shared-busy. +This flag may only be specified when allocating pages in a VM object. .It Dv VM_ALLOC_NOBUSY -The returned page will not be exclusive busy. +The returned page will not be busy. +This flag is implicit when allocating pages without a VM object. +When allocating pages in a VM object, and neither +.Dv VM_ALLOC_SBUSY +nor +.Dv VM_ALLOC_NOBUSY +are specified, the returned pages will be exclusively busied. .It Dv VM_ALLOC_NODUMP The returned page will not be included in any kernel core dumps regardless of whether or not it is mapped in to KVA. -.It Dv VM_ALLOC_NOOBJ -Do not associate the allocated page with a vm object. -The -.Fa object -argument is ignored. -.It Dv VM_ALLOC_SBUSY -The returned page will be shared busy. .It Dv VM_ALLOC_WIRED The returned page will be wired. .It Dv VM_ALLOC_ZERO -Indicate a preference for a pre-zeroed page. -There is no guarantee that the returned page will be zeroed, but it -will have the -.Dv PG_ZERO -flag set if it is zeroed. -.El +If this flag is specified, the +.Dq noobj +variants will return zeroed pages. +The other allocator interfaces ignore this flag. +.It Dv VM_ALLOC_COUNT(n) +Hint that at least +.Fa n +pages will be allocated by the caller in the near future. +.Fa n +must be no larger than 65535. +If the system is short of free pages, this hint may cause the kernel +to reclaim memory more aggressively than it would otherwise. .El .Sh RETURN VALUES -The -.Vt vm_page_t -that was allocated is returned if successful; otherwise, +If the allocation was successful, a pointer to the +.Vt struct vm_page +corresponding to the allocated page is returned. +If the allocation request specified multiple pages, the returned +pointer points to an array of +.Vt struct vm_page +constituting the run. +Upon failure, .Dv NULL is returned. -.Sh NOTES -The pager process is always upgraded to -.Dv VM_ALLOC_SYSTEM -unless -.Dv VM_ALLOC_INTERRUPT -is set. +Regardless of whether the allocation succeeds or fails, the VM +object +.Fa object +will be write-locked upon return. +.Sh SEE ALSO +.Xr numa 4 , +.Xr malloc 9 , +.Xr uma 9 , +.Xr vm_page_grab 9 , +.Xr vm_page_sbusy 9 .Sh AUTHORS This manual page was written by .An Chad David Aq Mt davidc@acns.ab.ca . From nobody Wed Oct 20 01:23:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1DC4180FDA0; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCx0kMYz3llr; Wed, 20 Oct 2021 01:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23D5E1EB8A; Wed, 20 Oct 2021 01:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NOQf095644; Wed, 20 Oct 2021 01:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NOo7095643; Wed, 20 Oct 2021 01:23:24 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:24 GMT Message-Id: <202110200123.19K1NOo7095643@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: b801c79dda53 - main - vm_fault: Stop specifying VM_ALLOC_ZERO List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b801c79dda53294b55fa19b81d43be25e00ec81f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b801c79dda53294b55fa19b81d43be25e00ec81f commit b801c79dda53294b55fa19b81d43be25e00ec81f Author: Mark Johnston AuthorDate: 2021-10-20 00:27:23 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 vm_fault: Stop specifying VM_ALLOC_ZERO Now vm_page_alloc() and friends will unconditionally preserve PG_ZERO, so there is no point in setting this flag. Eliminate a local variable and add a comment explaining why we prioritize the allocation when the process is doomed. No functional change intended. Reviewed by: kib, alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32036 --- sys/vm/vm_fault.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 8a4b5a543dd6..6bc59222b50e 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1113,7 +1113,6 @@ static int vm_fault_allocate(struct faultstate *fs) { struct domainset *dset; - int alloc_req; int rv; if ((fs->object->flags & OBJ_SIZEVNLOCK) != 0) { @@ -1150,9 +1149,14 @@ vm_fault_allocate(struct faultstate *fs) /* * Allocate a new page for this object/offset pair. * - * Unlocked read of the p_flag is harmless. At worst, the P_KILLED - * might be not observed there, and allocation can fail, causing - * restart and new reading of the p_flag. + * If the process has a fatal signal pending, prioritize the allocation + * with the expectation that the process will exit shortly and free some + * pages. In particular, the signal may have been posted by the page + * daemon in an attempt to resolve an out-of-memory condition. + * + * The unlocked read of the p_flag is harmless. At worst, the P_KILLED + * might be not observed here, and allocation fails, causing a restart + * and new reading of the p_flag. */ dset = fs->object->domain.dr_policy; if (dset == NULL) @@ -1161,12 +1165,8 @@ vm_fault_allocate(struct faultstate *fs) #if VM_NRESERVLEVEL > 0 vm_object_color(fs->object, atop(fs->vaddr) - fs->pindex); #endif - alloc_req = P_KILLED(curproc) ? - VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL; - if (fs->object->type != OBJT_VNODE && - fs->object->backing_object == NULL) - alloc_req |= VM_ALLOC_ZERO; - fs->m = vm_page_alloc(fs->object, fs->pindex, alloc_req); + fs->m = vm_page_alloc(fs->object, fs->pindex, + P_KILLED(curproc) ? VM_ALLOC_SYSTEM : 0); } if (fs->m == NULL) { if (vm_fault_allocate_oom(fs)) From nobody Wed Oct 20 01:23:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 24F1817F0098; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCz5f62z3ljh; Wed, 20 Oct 2021 01:23:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50C661EB11; Wed, 20 Oct 2021 01:23:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NPKb095668; Wed, 20 Oct 2021 01:23:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NPnV095667; Wed, 20 Oct 2021 01:23:25 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:25 GMT Message-Id: <202110200123.19K1NPnV095667@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: a9d6f1fe0a2f - main - Remove some remaining references to VM_ALLOC_NOOBJ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9d6f1fe0a2f852efe7a324f65d7142537b2c14e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a9d6f1fe0a2f852efe7a324f65d7142537b2c14e commit a9d6f1fe0a2f852efe7a324f65d7142537b2c14e Author: Mark Johnston AuthorDate: 2021-10-20 00:28:54 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Remove some remaining references to VM_ALLOC_NOOBJ Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32037 --- sys/vm/uma.h | 3 ++- sys/vm/uma_core.c | 2 +- sys/vm/vm_page.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 5d473ba909b6..743e02cdddf9 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -483,7 +483,8 @@ void uma_zone_reserve(uma_zone_t zone, int nitems); /* * Reserves the maximum KVA space required by the zone and configures the zone - * to use a VM_ALLOC_NOOBJ-based backend allocator. + * to use a backend that allocates physical memory and maps it using the + * reserved KVA. * * Arguments: * zone The zone to update. diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 68553bda2249..35ed473da5ca 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2014,7 +2014,7 @@ fail: } /* - * Allocates a number of pages from within an object + * Allocates a number of pages not belonging to a VM object * * Arguments: * bytes The number of bytes requested diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 140ea7e2fadb..21e33facc0a8 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -542,9 +542,10 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */ #define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */ #define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */ -#define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ +#define VM_ALLOC_AVAIL0 0x0100 #define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ #define VM_ALLOC_NOCREAT 0x0400 /* (gp) Don't create a page */ +#define VM_ALLOC_AVAIL1 0x0800 #define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ From nobody Wed Oct 20 01:23:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 24E6C17F0097; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCz3KP9z3lww; Wed, 20 Oct 2021 01:23:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 670ED1E89F; Wed, 20 Oct 2021 01:23:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NQHG095692; Wed, 20 Oct 2021 01:23:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NQlc095691; Wed, 20 Oct 2021 01:23:26 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:26 GMT Message-Id: <202110200123.19K1NQlc095691@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: ff93447d8ed6 - main - Use the vm_radix_init() helper when initializing pmaps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff93447d8ed61081adfe00a23a1e4c7bee479e53 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ff93447d8ed61081adfe00a23a1e4c7bee479e53 commit ff93447d8ed61081adfe00a23a1e4c7bee479e53 Author: Mark Johnston AuthorDate: 2021-10-20 00:29:05 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Use the vm_radix_init() helper when initializing pmaps No functional change intended. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32527 --- sys/amd64/amd64/pmap.c | 4 ++-- sys/arm64/arm64/pmap.c | 4 ++-- sys/arm64/iommu/iommu_pmap.c | 2 +- sys/i386/i386/pmap.c | 4 ++-- sys/powerpc/aim/mmu_radix.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f8bb384afdaf..8d6379ab170c 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4177,7 +4177,7 @@ pmap_pinit0(pmap_t pmap) pmap->pm_cr3 = kernel_pmap->pm_cr3; /* hack to keep pmap_pti_pcid_invalidate() alive */ pmap->pm_ucr3 = PMAP_NO_CR3; - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -4398,7 +4398,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) break; } - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index ab62ca2934f0..cd499e026036 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1748,7 +1748,7 @@ pmap_pinit0(pmap_t pmap) bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_l0_paddr = READ_SPECIALREG(ttbr0_el1); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); pmap->pm_cookie = COOKIE_FROM(ASID_RESERVED_FOR_PID_0, INT_MIN); pmap->pm_stage = PM_STAGE1; pmap->pm_levels = 4; @@ -1771,7 +1771,7 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); diff --git a/sys/arm64/iommu/iommu_pmap.c b/sys/arm64/iommu/iommu_pmap.c index 7ea8a7ee93a3..0f7b9ba24b0a 100644 --- a/sys/arm64/iommu/iommu_pmap.c +++ b/sys/arm64/iommu/iommu_pmap.c @@ -392,7 +392,7 @@ iommu_pmap_pinit_levels(pmap_t pmap, int levels) pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); MPASS(levels == 3 || levels == 4); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 62fcbcd90b0b..3b8e335701d2 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2043,7 +2043,7 @@ __CONCAT(PMTYPE, pinit0)(pmap_t pmap) #ifdef PMAP_PAE_COMP pmap->pm_pdpt = IdlePDPT; #endif - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -2075,7 +2075,7 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) KASSERT(pmap_kextract((vm_offset_t)pmap->pm_pdpt) < (4ULL<<30), ("pmap_pinit: pdpt above 4g")); #endif - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); } KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_pinit: pmap has reserved page table page(s)")); diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 95c3f5f009e4..420a7a227c10 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4202,7 +4202,7 @@ mmu_radix_pinit(pmap_t pmap) for (int j = 0; j < RADIX_PGD_SIZE_SHIFT; j++) pagezero((vm_offset_t)pmap->pm_pml1 + j * PAGE_SIZE); - pmap->pm_radix.rt_root = 0; + vm_radix_init(&pmap->pm_radix); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = PMAP_PDE_SUPERPAGE; @@ -4433,7 +4433,7 @@ mmu_radix_pinit0(pmap_t pmap) pmap->pm_pml1 = kernel_pmap->pm_pml1; pmap->pm_pid = kernel_pmap->pm_pid; - pmap->pm_radix.rt_root = 0; + vm_radix_init(&pmap->pm_radix); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); kernel_pmap->pm_flags = From nobody Wed Oct 20 01:23:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3A606180FD5F; Wed, 20 Oct 2021 01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtD11R1Sz3lpF; Wed, 20 Oct 2021 01:23:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8560E1E81D; Wed, 20 Oct 2021 01:23:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NRJn095716; Wed, 20 Oct 2021 01:23:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NRrx095715; Wed, 20 Oct 2021 01:23:27 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:27 GMT Message-Id: <202110200123.19K1NRrx095715@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: 34fac29e9831 - main - amd64: Add comments to pmap_pinit_type() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34fac29e98313fb0bfba0503e2e19e352b452516 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=34fac29e98313fb0bfba0503e2e19e352b452516 commit 34fac29e98313fb0bfba0503e2e19e352b452516 Author: Mark Johnston AuthorDate: 2021-10-20 00:29:18 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:57 +0000 amd64: Add comments to pmap_pinit_type() ... explaining why we don't pass the pmap pointer to pmap_alloc_pt_page(). Reported by: alc Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32528 --- sys/amd64/amd64/pmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8d6379ab170c..66d7ac6669da 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4345,7 +4345,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) int i; /* - * allocate the page directory page + * Allocate the page directory page. Pass NULL instead of a pointer to + * the pmap here to avoid recording this page in the resident count, as + * optimizations in pmap_remove() depend on this. */ pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); @@ -4377,6 +4379,10 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) else pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { + /* + * As with pmltop_pg, pass NULL instead of a pointer to + * the pmap to ensure that the PTI page isn't counted. + */ pmltop_pgu = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( From nobody Wed Oct 20 01:23:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C4B0F17F0207; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtD450vxz3lph; Wed, 20 Oct 2021 01:23:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6DFA1EB8B; Wed, 20 Oct 2021 01:23:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NTaK095770; Wed, 20 Oct 2021 01:23:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NTZ9095769; Wed, 20 Oct 2021 01:23:29 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:29 GMT Message-Id: <202110200123.19K1NTZ9095769@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: 4c812fe61b7c - main - vlapic: Schedule callouts on the local CPU List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c812fe61b7ce2f297a381950ff7bd87fd51f698 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4c812fe61b7ce2f297a381950ff7bd87fd51f698 commit 4c812fe61b7ce2f297a381950ff7bd87fd51f698 Author: Mark Johnston AuthorDate: 2021-10-20 00:50:06 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:57 +0000 vlapic: Schedule callouts on the local CPU The virtual LAPIC driver uses callouts to implement the LAPIC timer. Callouts are armed using callout_reset_sbt(), which currently puts everything on CPU 0. On systems running many bhyve VMs this results in a large amount of contention for CPU 0's callout lock. Modify vlapic to schedule callouts on the local CPU instead. This allows timer interrupts to be scheduled more evenly among CPUs where bhyve is running. Reviewed by: grehan, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32559 --- sys/amd64/vmm/io/vlapic.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 4e7ddbafd447..940e45cce458 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #define VLAPIC_BUS_FREQ (128 * 1024 * 1024) static void vlapic_set_error(struct vlapic *, uint32_t, bool); +static void vlapic_callout_handler(void *arg); static __inline uint32_t vlapic_get_id(struct vlapic *vlapic) @@ -710,6 +711,13 @@ vlapic_trigger_lvt(struct vlapic *vlapic, int vector) return (0); } +static void +vlapic_callout_reset(struct vlapic *vlapic, sbintime_t t) +{ + callout_reset_sbt_curcpu(&vlapic->callout, t, 0, + vlapic_callout_handler, vlapic, 0); +} + static void vlapic_callout_handler(void *arg) { @@ -765,8 +773,7 @@ vlapic_callout_handler(void *arg) } bintime_add(&vlapic->timer_fire_bt, &vlapic->timer_period_bt); - callout_reset_sbt(&vlapic->callout, rem_sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, rem_sbt); } done: VLAPIC_TIMER_UNLOCK(vlapic); @@ -792,8 +799,7 @@ vlapic_icrtmr_write_handler(struct vlapic *vlapic) bintime_add(&vlapic->timer_fire_bt, &vlapic->timer_period_bt); sbt = bttosbt(vlapic->timer_period_bt); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } else callout_stop(&vlapic->callout); @@ -1667,8 +1673,7 @@ vlapic_reset_callout(struct vlapic *vlapic, uint32_t ccr) bintime_add(&vlapic->timer_fire_bt, &bt); sbt = bttosbt(bt); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } else { /* even if the CCR was 0, periodic timers should be reset */ if (vlapic_periodic_timer(vlapic)) { @@ -1678,8 +1683,7 @@ vlapic_reset_callout(struct vlapic *vlapic, uint32_t ccr) sbt = bttosbt(vlapic->timer_period_bt); callout_stop(&vlapic->callout); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } } From nobody Wed Oct 20 01:23:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BEBD4180FFEE; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtD44mp4z3m34; Wed, 20 Oct 2021 01:23:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F24F11EA33; Wed, 20 Oct 2021 01:23:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NUqn095795; Wed, 20 Oct 2021 01:23:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NUIX095794; Wed, 20 Oct 2021 01:23:30 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:30 GMT Message-Id: <202110200123.19K1NUIX095794@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: 0ac2a6498375 - main - sysctl.3: sys/types.h no longer needs to be explicitly included List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ac2a649837512c7694cc8f5af84d470b3209fdd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0ac2a649837512c7694cc8f5af84d470b3209fdd commit 0ac2a649837512c7694cc8f5af84d470b3209fdd Author: Mark Johnston AuthorDate: 2021-10-20 01:19:18 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:57 +0000 sysctl.3: sys/types.h no longer needs to be explicitly included Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32562 --- lib/libc/gen/sysctl.3 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index c8f1430656a6..2d8da3974086 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd October 30, 2020 +.Dd October 18, 2021 .Dt SYSCTL 3 .Os .Sh NAME @@ -39,7 +39,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In sys/sysctl.h .Ft int .Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen" From nobody Wed Oct 20 01:23:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AC53B180FFEC; Wed, 20 Oct 2021 01:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtD40v1Nz3lmB; Wed, 20 Oct 2021 01:23:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABD2A1E6E6; Wed, 20 Oct 2021 01:23:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NS6C095746; Wed, 20 Oct 2021 01:23:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NST3095745; Wed, 20 Oct 2021 01:23:28 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:28 GMT Message-Id: <202110200123.19K1NST3095745@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: bd49c454ca62 - main - Bump __FreeBSD_version for the preceding page allocator changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd49c454ca62170506a98959c1acab7ad50c3276 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bd49c454ca62170506a98959c1acab7ad50c3276 commit bd49c454ca62170506a98959c1acab7ad50c3276 Author: Mark Johnston AuthorDate: 2021-10-20 00:30:28 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:57 +0000 Bump __FreeBSD_version for the preceding page allocator changes None of the usual suspects (e.g., drm-kmod, virtualbox-ose-kmod, nvidia-driver) seem to be affected by the changes, but it is likely that something else is affected. Sponsored by: The FreeBSD Foundation --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index ecdd233c4c2b..42e200de2eae 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400038 +#define __FreeBSD_version 1400039 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Wed Oct 20 01:42:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2971317FBD40; Wed, 20 Oct 2021 01:42: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtdg0ZDHz4SN5; Wed, 20 Oct 2021 01:42:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7C0F1E8FC; Wed, 20 Oct 2021 01:42:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1gEI9022503; Wed, 20 Oct 2021 01:42:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1gEj1022502; Wed, 20 Oct 2021 01:42:14 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:42:14 GMT Message-Id: <202110200142.19K1gEj1022502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 701eb03cc0dc - stable/13 - nfscl: Fix a deadlock related to the NFSv4 clientID lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 701eb03cc0dca907de872a41407b8487c38429fc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=701eb03cc0dca907de872a41407b8487c38429fc commit 701eb03cc0dca907de872a41407b8487c38429fc Author: Rick Macklem AuthorDate: 2021-10-12 04:58:24 +0000 Commit: Rick Macklem CommitDate: 2021-10-20 01:36:56 +0000 nfscl: Fix a deadlock related to the NFSv4 clientID lock Without this patch, it is possible for a process doing an NFSv4 Open/create of a file to block to allow another process to acquire the exclusive lock on the clientID when holding a shared lock on the clientID. As such, both processes deadlock, with one wanting the exclusive lock, while the other holds the shared lock. This deadlock is unlikely to occur unless delegations are in use on the NFSv4 mount. This patch fixes the problem by not deferring to the process waiting for the exclusive lock when a shared lock (reference cnt) is already held by the process. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit 120b20bdf49630cf2a7dbc5f93b9e985e1f4f198) --- sys/fs/nfs/nfs_var.h | 4 ++-- sys/fs/nfsclient/nfs_clrpcops.c | 12 ++++++------ sys/fs/nfsclient/nfs_clstate.c | 29 ++++++++++++++++------------- sys/fs/nfsclient/nfs_clvfsops.c | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 9cbaeae361a6..846ab2503981 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -569,12 +569,12 @@ void nfsrpc_bindconnsess(CLIENT *, void *, struct ucred *); /* nfs_clstate.c */ int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **, - int *, int *, int); + int *, int *, int, bool); int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, nfsv4stateid_t *, void **); void nfscl_ownerrelease(struct nfsmount *, struct nfsclowner *, int, int, int); void nfscl_openrelease(struct nfsmount *, struct nfsclopen *, int, int); -int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, bool, +int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, bool, bool, struct nfsclclient **); struct nfsclclient *nfscl_findcl(struct nfsmount *); void nfscl_clientrelease(struct nfsclclient *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 984a63484777..dbbfdb3b2976 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -390,7 +390,7 @@ else printf(" fhl=0\n"); do { dp = NULL; error = nfscl_open(vp, nfhp->nfh_fh, nfhp->nfh_len, mode, 1, - cred, p, NULL, &op, &newone, &ret, 1); + cred, p, NULL, &op, &newone, &ret, 1, true); if (error) { return (error); } @@ -2061,7 +2061,7 @@ nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, dp = NULL; error = nfscl_open(dvp, NULL, 0, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, cred, p, &owp, NULL, &newone, - NULL, 1); + NULL, 1, true); if (error) return (error); if (nmp->nm_clp != NULL) @@ -2347,7 +2347,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ error = nfscl_open(dvp, nfhp->nfh_fh, nfhp->nfh_len, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, - cred, p, NULL, &op, &newone, NULL, 0); + cred, p, NULL, &op, &newone, NULL, 0, false); if (error) goto nfsmout; op->nfso_stateid = stateid; @@ -3968,7 +3968,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, do { nd->nd_repstat = 0; if (op == F_GETLK) { - error = nfscl_getcl(vp->v_mount, cred, p, false, &clp); + error = nfscl_getcl(vp->v_mount, cred, p, false, true, &clp); if (error) return (error); error = nfscl_lockt(vp, clp, off, len, fl, p, id, flags); @@ -3985,7 +3985,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, * We must loop around for all lockowner cases. */ callcnt = 0; - error = nfscl_getcl(vp->v_mount, cred, p, false, &clp); + error = nfscl_getcl(vp->v_mount, cred, p, false, true, &clp); if (error) return (error); do { @@ -7931,7 +7931,7 @@ nfsrpc_createlayout(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ error = nfscl_open(dvp, nfhp->nfh_fh, nfhp->nfh_len, (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, - cred, p, NULL, &op, &newone, NULL, 0); + cred, p, NULL, &op, &newone, NULL, 0, false); if (error != 0) goto nfsmout; op->nfso_stateid = stateid; diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8d1c4de0ba8e..5aebd68dd9e1 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -218,7 +218,7 @@ static short *nfscl_cberrmap[] = { int nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, struct ucred *cred, NFSPROC_T *p, struct nfsclowner **owpp, - struct nfsclopen **opp, int *newonep, int *retp, int lockit) + struct nfsclopen **opp, int *newonep, int *retp, int lockit, bool firstref) { struct nfsclclient *clp; struct nfsclowner *owp, *nowp; @@ -246,7 +246,7 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, fhlen - 1, M_NFSCLOPEN, M_WAITOK); nop->nfso_hash.le_prev = NULL; } - ret = nfscl_getcl(vp->v_mount, cred, p, false, &clp); + ret = nfscl_getcl(vp->v_mount, cred, p, false, firstref, &clp); if (ret != 0) { free(nowp, M_NFSCLOWNER); if (nop != NULL) @@ -865,7 +865,7 @@ nfscl_openrelease(struct nfsmount *nmp, struct nfsclopen *op, int error, */ int nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, - bool tryminvers, struct nfsclclient **clpp) + bool tryminvers, bool firstref, struct nfsclclient **clpp) { struct nfsclclient *clp; struct nfsclclient *newclp = NULL; @@ -934,14 +934,16 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, NFSCLSTATEMUTEXPTR, mp); if (igotlock == 0) { /* - * Call nfsv4_lock() with "iwantlock == 0" so that it will - * wait for a pending exclusive lock request. This gives the - * exclusive lock request priority over this shared lock - * request. + * Call nfsv4_lock() with "iwantlock == 0" on the firstref so + * that it will wait for a pending exclusive lock request. + * This gives the exclusive lock request priority over this + * shared lock request. * An exclusive lock on nfsc_lock is used mainly for server - * crash recoveries. + * crash recoveries and delegation recalls. */ - nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); + if (firstref) + nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, + mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); } if (igotlock == 0 && NFSCL_FORCEDISM(mp)) { @@ -1123,7 +1125,8 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, if (recovery) clp = rclp; else - error = nfscl_getcl(vp->v_mount, cred, p, false, &clp); + error = nfscl_getcl(vp->v_mount, cred, p, false, true, + &clp); } if (error) { free(nlp, M_NFSCLLOCKOWNER); @@ -1454,7 +1457,7 @@ nfscl_checkwritelocked(vnode_t vp, struct flock *fl, end = NFS64BITSSET; } - error = nfscl_getcl(vp->v_mount, cred, p, false, &clp); + error = nfscl_getcl(vp->v_mount, cred, p, false, true, &clp); if (error) return (1); nfscl_filllockowner(id, own, flags); @@ -3247,7 +3250,7 @@ nfscl_getclose(vnode_t vp, struct nfsclclient **clpp) struct nfsfh *nfhp; int error, notdecr; - error = nfscl_getcl(vp->v_mount, NULL, NULL, false, &clp); + error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); if (error) return (error); *clpp = clp; @@ -3321,7 +3324,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) struct nfsclrecalllayout *recallp; int error; - error = nfscl_getcl(vp->v_mount, NULL, NULL, false, &clp); + error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); if (error) return (error); *clpp = clp; diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index d6ec1f9a3825..57ac7f59f38d 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1611,7 +1611,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { NFSCL_DEBUG(3, "at getcl\n"); - error = nfscl_getcl(mp, cred, td, tryminvers, &clp); + error = nfscl_getcl(mp, cred, td, tryminvers, true, &clp); NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; From nobody Wed Oct 20 01:43:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 691FD17FD918; Wed, 20 Oct 2021 01:43: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtgV275Gz4T2b; Wed, 20 Oct 2021 01:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29B0E1EB5B; Wed, 20 Oct 2021 01:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1ho1i022716; Wed, 20 Oct 2021 01:43:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1hoMx022715; Wed, 20 Oct 2021 01:43:50 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:43:50 GMT Message-Id: <202110200143.19K1hoMx022715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 00595201ad4d - stable/13 - nfscl: Fix another deadlock related to the NFSv4 clientID lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00595201ad4de48a1537d43c77445873df6028db Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=00595201ad4de48a1537d43c77445873df6028db commit 00595201ad4de48a1537d43c77445873df6028db Author: Rick Macklem AuthorDate: 2021-10-13 00:21:01 +0000 Commit: Rick Macklem CommitDate: 2021-10-20 01:40:27 +0000 nfscl: Fix another deadlock related to the NFSv4 clientID lock Without this patch, it is possible to hang the NFSv4 client, when a rename/remove is being done on a file where the client holds a delegation, if pNFS is being used. For a delegation to be returned, dirty data blocks must be flushed to the NFSv4 server. When pNFS is in use, a shared lock on the clientID must be acquired while doing a write to the DS(s). However, if rename/remove is doing the delegation return an exclusive lock will be acquired on the clientID, preventing the write to the DS(s) from acquiring a shared lock on the clientID. This patch stops rename/remove from doing a delegation return if pNFS is enabled. Since doing delegation return in the same compound as rename/remove is only an optimization, not doing so should not cause problems. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit b82168e657d378ff86ea18c4f03b98aac9ee9bb3) --- sys/fs/nfsclient/nfs_clstate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 5aebd68dd9e1..276e94002d34 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4609,6 +4609,8 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; nmp = VFSTONFS(vp->v_mount); + if (NFSHASPNFS(nmp)) + return (retcnt); NFSLOCKMNT(nmp); if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { NFSUNLOCKMNT(nmp); @@ -4714,6 +4716,8 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, nmp = VFSTONFS(fvp->v_mount); *gotfdp = 0; *gottdp = 0; + if (NFSHASPNFS(nmp)) + return (retcnt); NFSLOCKCLSTATE(); /* * Loop around waiting for: From nobody Wed Oct 20 01:55:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EA83E1802C3F for ; Wed, 20 Oct 2021 01:55:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtxG6866z4Xpk for ; Wed, 20 Oct 2021 01:55:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb33.google.com with SMTP id a7so8411408yba.6 for ; Tue, 19 Oct 2021 18:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EQ2cNebXoIMPXPZK/W9XOi+eA7cy+4JGj9+Skk4AZS8=; b=kQxNrfO8OcBtO0iLhR0zCgP+ITPh+qivcaijq7/6dk/o7CsDCzp+T2VDxHEA8tzJ+j fnkaxAQ5ZbJjw4hV/1eZ75cL4slQv1MPolbUkXJxq4+kPlU3000Qdw5/Xe6x8C5SyW0X 96EwFYoOg+0ywXud3sPEzKuCsBsCBd8L6dinM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EQ2cNebXoIMPXPZK/W9XOi+eA7cy+4JGj9+Skk4AZS8=; b=Hrwvsx47B0Y9q+rhc9hTzmgr4B7JDDKOvnrqUEDgc67Qwf7T+AkGMOQo5aSiOv53T+ vzSBKjlWpXDlIbtTziI7I98hsOT1GEcKSVZ5Ygkk6lS6iO1+jIwZYKeRruowwNQ6Nk1v AjFynJyuuN6wSuLcZDpQtnlgkTbDAEFBVr/qZrRXZERLNdlSv+4Ba4wIEFgRbmscfjvI VJVBrGhi7cwmRIaYf5c/W5gj85Jv++OraaMTDpMEiA0xMxRHeVXOVJGDBg9PBh03EiDA 2dVJQXPBpMA4YbMQ0qfD/d/whN87y3fAuVqS91zLjXzDpT0fol7e2IRVOu3+3F0oZfsV AuYQ== X-Gm-Message-State: AOAM530kXefqSYdu161dd9Yf60/Dw6E8iBlrx15jHPdnjirUBpEGC3FH 5mkAXJT0tNeHqMCCLBLiXjV0zqL4wdfboj0DRAQvLA== X-Google-Smtp-Source: ABdhPJyTeyG2vnEL/yhEOkReZpE01y3jjNVxhzHGzTQr3+eatLQGSypiCOotPB6VZPqB7Rfh53FYpDw/jl3/Sx4kM+M= X-Received: by 2002:a05:6902:120a:: with SMTP id s10mr41513564ybu.224.1634694946044; Tue, 19 Oct 2021 18:55:46 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> In-Reply-To: From: Kevin Bowling Date: Tue, 19 Oct 2021 18:55:34 -0700 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: Alexey Dokuchaev Cc: Emmanuel Vadot , Slawa Olhovchenkov , src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HYtxG6866z4Xpk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 6:25 PM Alexey Dokuchaev wrote: > > On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > > On Tue, 19 Oct 2021 14:21:33 +0300, Slawa Olhovchenkov wrote: > > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > > > vt: Disable bell by default > > > > > > > > Bell is either useless if you're working on remote servers or > > > > really annoying when you're working with a local machine that > > > > have a loud buzzer. Switch the default to have it disable. > > > > > > For you, not for me, for example. Also, this is violate POLA. > > > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > > happy again. > > Actually, it should've been the other way around: it if annoys *you*, > then you should just set kern.vt.enable_bell=0 in /etc/sysctl.conf > and be happy. I'm also used to it, it's a nice indicator that things > work normally, including the bell itself. > > > And POLA doesn't means that we can't change a thing. I think a POLA violation here was that some equipment emits a jarringly loud noise, and rushing to turn that off is more stressful than the change of turning it on if you value it. Safe defaults. > FWIW, controversial changes like this should go through the formal > review process, giving everyone interested a chance to chime in, not > like closing the differential in less than 24 hours. > > ./danfe > From nobody Wed Oct 20 02:40:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3F45A1815EEC; Wed, 20 Oct 2021 02:40:24 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYvwm1GCJz4lcH; Wed, 20 Oct 2021 02:40:24 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634697624; 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=qAdhK5q30r4SBgCm/LPjtzG2Ki64EDQtEuhAMY/tHvk=; b=L6rS2MyufdC2gDTL2DsMWxFxpJRRe8tw46cNoVW30NwWpnZUlSgTmblXbwn9jL0jDhEuoY 5/D1W1L4Rt3GzeBnPPEzkurkxoL6TUK324Th2mA9XIXvB0yvu3rL+6eHlZ7dZdAv+KZ+26 Ed3xM51z3w25LgOWMfx8a3QWKcEcHuV1pW0KVNqh9Hxj75WnSU5V0GGUSBuA4Mrw5PJvLe RbP4MzMY+nKzKT0atOVPGRQffkjcgspgbokUXFAwTqQ225fcjaBaTuE8LTINas5cPHYavj rb73BsKJCsCgpoUnWiry1iuz6Tni3kvZ9M2Gjqyk952cKqA6k1su1/NY5wlm/w== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 1374D1A32C; Wed, 20 Oct 2021 02:40:24 +0000 (UTC) Date: Wed, 20 Oct 2021 02:40:24 +0000 From: Alexey Dokuchaev To: Kevin Bowling Cc: Emmanuel Vadot , Slawa Olhovchenkov , src-committers , "" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634697624; 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=qAdhK5q30r4SBgCm/LPjtzG2Ki64EDQtEuhAMY/tHvk=; b=tbK5pRp72dCvyk+AwREvXCbkU5+3yVILOMw6u6jws3DiTEro7GIGwfBJQzm5xf+74g1P4i meujwzMDKLlH1lkzpWXQq+1gWBw7ahrE5UbZOkdXm6g473gEtMfIXLKTfb1IxSHStkzUdk VidHATJ/Toq4RXuUtob5p0oNhwfAlJ/rnWUf/s8u0TyZ5nBvhhs/E6ifUZITNZ6U+ZVa2y 1VQ+x7gIJHJ36TNxZ3YXcqmd4LbqosScqyH1vOFOADhwlAtrk7B0Tm9hAiT3IZ+/fuCPFT qv0NlpjeBYF1JihvYilbGxUWliqrsZ6zUlJLY2YPfwQq1OCljAHX/Tln0inQ2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634697624; a=rsa-sha256; cv=none; b=LeDdoQ5BYLFoghkQyhG+9Sngmcp/lZxiLBuD6n6v7+QaBBHiX9KY5bdfZTKWuEZ8YGQUvu A1KN+BE4emuG5k6Wck1ZYLTU+MmbGb3zzEZTgdm7TV8VpZD7PX03uYfmUvJCL8t7vsVsQ+ WqeEPBt6RqHsaxq45rnik0zk8Uyj2r1CUAbhzMeecdlbvNjWt/Lu0x9igzicKd7mlSEO3t WzX176iSE0vHgsmHywezgAMnlcbzDJa1genmxjdmtgZhIqv4qo9cyrwYTPngBU+foY+eBB lC8PcvfFXIL5E8ql3FLIArUeJpfBfeiiGBKswGY1ru8SyTdyvdUpTXEJa2pOsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 06:55:34PM -0700, Kevin Bowling wrote: > On Tue, Oct 19, 2021 at 6:25 PM Alexey Dokuchaev wrote: > > On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > > > On Tue, 19 Oct 2021 14:21:33 +0300, Slawa Olhovchenkov wrote: > > > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > > > > > vt: Disable bell by default > > > > > > > > > > Bell is either useless if you're working on remote servers or > > > > > really annoying when you're working with a local machine that > > > > > have a loud buzzer. Switch the default to have it disable. > > > > > > > > For you, not for me, for example. Also, this is violate POLA. > > > > > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > > > happy again. > > > > Actually, it should've been the other way around: it if annoys *you*, > > then you should just set kern.vt.enable_bell=0 in /etc/sysctl.conf > > and be happy. I'm also used to it, it's a nice indicator that things > > work normally, including the bell itself. > > > > > And POLA doesn't means that we can't change a thing. > > I think a POLA violation here was that some equipment emits a > jarringly loud noise, and rushing to turn that off is more stressful > than the change of turning it on if you value it. If "some equipment" has a buzzer so annoying that it stresses one enough that she gets lost as to how to turn it off then perhaps admin of such equipment should complain to its vendor instead. > Safe defaults. When I issue BEL (\a) on the console, I expect to hear the beep, and should not do anything to enable it. Computers don't have many ways to talk back to us, muting one of the low-level signals like this is dubious at the very least and should've undergone broader discussion. ./danfe From nobody Wed Oct 20 03:35:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 559471804677; Wed, 20 Oct 2021 03:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYx8X1p6Fz3GMP; Wed, 20 Oct 2021 03:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 172232078C; Wed, 20 Oct 2021 03:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K3ZdKf070861; Wed, 20 Oct 2021 03:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K3ZdfS070860; Wed, 20 Oct 2021 03:35:39 GMT (envelope-from git) Date: Wed, 20 Oct 2021 03:35:39 GMT Message-Id: <202110200335.19K3ZdfS070860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: 262717e270c3 - main - arswitch(4): Add new manpage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 262717e270c3e8a28fa2937db750ba946be8c836 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=262717e270c3e8a28fa2937db750ba946be8c836 commit 262717e270c3e8a28fa2937db750ba946be8c836 Author: Felix Johnson AuthorDate: 2021-10-20 03:29:11 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-20 03:35:04 +0000 arswitch(4): Add new manpage PR: 211668 Reported by: O. Hartmann Reviewed by: adrian, debdrup, imp Differential Revision: https://reviews.freebsd.org/D32476 --- share/man/man4/arswitch.4 | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/share/man/man4/arswitch.4 b/share/man/man4/arswitch.4 new file mode 100644 index 000000000000..481a3a08f339 --- /dev/null +++ b/share/man/man4/arswitch.4 @@ -0,0 +1,91 @@ +.\"- +.\" Copyright (c) 2021 Felix Johnson +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 19, 2021 +.Dt ARSWITCH 4 +.Os +.Sh NAME +.Nm arswitch +.Nd driver for Atheros Fast Ethernet switch +.Sh SYNOPSIS +.Cd "device mdio" +.Cd "device etherswitch" +.Cd "device arswitch" +.Sh DESCRIPTION +The +.Nm +device driver provides a management interface to multiple Atheros +fast ethernet switch chips: +.Bl -tag -compact -width "AR7240" +.It AR7240 +Wireless Network Processor SOC with five Fast Ethernet PHYs +.It AR8216 +Fast Ethernet Switch +.It AR8226 +.It AR8316 +Six-port Gigabit Ethernet Switch +.It AR8327 +Seven-port Gigabit Ethernet Switch +.It AR9340 +Wireless networking SoC +.El +.Pp +The driver uses an +.Xr mdio 4 +or +.Xr miibus 4 +interface to configure the ethernet interface. +.Pp +This driver supports port based vlan, and +IEEE 802.1Q (QinQ). +These options can be configured with the +.Xr etherswitchcfg 8 +command. +.Nm +supports +.Dv addtag , +.Dv striptag , +and +.Dv doubletag . +.Dv addtag +and +.Dv striptag +are mutually exclusive. +.Pp +Setting the switch MAC address is not supported. +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +manual was written by +.An Felix Johnson . From nobody Wed Oct 20 04:37:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A44B1800B08; Wed, 20 Oct 2021 04:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYyWf24Kjz3nkV; Wed, 20 Oct 2021 04:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 276FC20F42; Wed, 20 Oct 2021 04:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K4bI6O050235; Wed, 20 Oct 2021 04:37:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K4bIjA050234; Wed, 20 Oct 2021 04:37:18 GMT (envelope-from git) Date: Wed, 20 Oct 2021 04:37:18 GMT Message-Id: <202110200437.19K4bIjA050234@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: d4cf7dc0df28 - main - camcontrol(8): Clean up references to removed symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4cf7dc0df289ad0e16b5b40b076311c71e663dc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d4cf7dc0df289ad0e16b5b40b076311c71e663dc commit d4cf7dc0df289ad0e16b5b40b076311c71e663dc Author: Felix Johnson AuthorDate: 2021-10-20 04:32:54 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-20 04:32:54 +0000 camcontrol(8): Clean up references to removed symbols Patch the manpage to remove references to devq_openings and devq_queued. Document the allocated tag that has been added in the same commit. The relevant code change was committed as r271588 (959ec2581b23aefebb3bae26c527c1b25834a9e3) by mav@. PR: 223651 MFH after: 3 days Reported by: Bertrand Petit --- sbin/camcontrol/camcontrol.8 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index 7790d047a255..6f1d00269633 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 2019 +.Dd October 20, 2021 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -1092,18 +1092,8 @@ to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB: This is the amount of capacity for transactions queued to a given device. .It dev_active This is the number of transactions currently queued to a device. -.It devq_openings -This is the kernel queue space for transactions. -This count usually mirrors -dev_openings except during error recovery operations when -the device queue is frozen (device is not allowed to receive -commands), the number of dev_openings is reduced, or transaction -replay is occurring. -.It devq_queued -This is the number of transactions waiting in the kernel queue for capacity -on the device. -This number is usually zero unless error recovery is in -progress. +.It allocated +This is the number of CCBs allocated for the device. .It held The held count is the number of CCBs held by peripheral drivers that have either just been completed or are about to be released to the transport From nobody Wed Oct 20 04:42:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 659B01802464; Wed, 20 Oct 2021 04:42:32 +0000 (UTC) (envelope-from ygy@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYydh0Nrlz3q2P; Wed, 20 Oct 2021 04:42:32 +0000 (UTC) (envelope-from ygy@freebsd.org) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: ygy) by smtp.freebsd.org (Postfix) with ESMTPSA id D1F255A18; Wed, 20 Oct 2021 04:42:31 +0000 (UTC) (envelope-from ygy@freebsd.org) Received: by mail-wm1-f53.google.com with SMTP id s198-20020a1ca9cf000000b0030d6986ea9fso7144702wme.1; Tue, 19 Oct 2021 21:42:31 -0700 (PDT) X-Gm-Message-State: AOAM530ZxGMqd7kKt32QWGL1YRG8FYk6aUCU4Wx8n7YLMn2rYlW5Y5/2 WWRTygnB8+MnmV7nhSDYcW1IL+Fpt029QPaQV3A= X-Google-Smtp-Source: ABdhPJwojibUhTHZsbZWsbvHVRbxcgzv9uR39e/vmauqfd4sL0aQ80fLlxLj31tvwk8WZsmqhUYSS3cfSIuwLmsXwCc= X-Received: by 2002:a05:6000:1544:: with SMTP id 4mr51106810wry.374.1634704950475; Tue, 19 Oct 2021 21:42:30 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110200437.19K4bIjA050234@gitrepo.freebsd.org> In-Reply-To: <202110200437.19K4bIjA050234@gitrepo.freebsd.org> From: Guangyuan Yang Date: Wed, 20 Oct 2021 00:42:22 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d4cf7dc0df28 - main - camcontrol(8): Clean up references to removed symbols To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N Guangyuan Yang =E4=BA=8E2021=E5=B9=B410=E6=9C=8820=E6=97= =A5=E5=91=A8=E4=B8=89 =E4=B8=8A=E5=8D=8812:37=E5=86=99=E9=81=93=EF=BC=9A > > The branch main has been updated by ygy (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dd4cf7dc0df289ad0e16b5b40b0= 76311c71e663dc > > commit d4cf7dc0df289ad0e16b5b40b076311c71e663dc > Author: Felix Johnson > AuthorDate: 2021-10-20 04:32:54 +0000 > Commit: Guangyuan Yang > CommitDate: 2021-10-20 04:32:54 +0000 > > camcontrol(8): Clean up references to removed symbols > > Patch the manpage to remove references to devq_openings and devq_queu= ed. > Document the allocated tag that has been added in the same commit. Th= e > relevant code change was committed as r271588 > (959ec2581b23aefebb3bae26c527c1b25834a9e3) by mav@. > > PR: 223651 > MFH after: 3 days > Reported by: Bertrand Petit Typo - s/MFH/MFC/. /facepalm --=20 Guangyuan Yang ygy@FreeBSD.org From nobody Wed Oct 20 06:03:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2DEE017FC2D0; Wed, 20 Oct 2021 06:03: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ0RD0Z46z4g2b; Wed, 20 Oct 2021 06:03:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6CF62242A; Wed, 20 Oct 2021 06:03:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K63ZBI070616; Wed, 20 Oct 2021 06:03:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K63ZJj070615; Wed, 20 Oct 2021 06:03:35 GMT (envelope-from git) Date: Wed, 20 Oct 2021 06:03:35 GMT Message-Id: <202110200603.19K63ZJj070615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 8d7fe65348a2 - main - stress2: Added a "mdconfig -o force" test scenario List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d7fe65348a2fa13fe007975a0560567ac141458 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=8d7fe65348a2fa13fe007975a0560567ac141458 commit 8d7fe65348a2fa13fe007975a0560567ac141458 Author: Peter Holm AuthorDate: 2021-10-20 06:01:58 +0000 Commit: Peter Holm CommitDate: 2021-10-20 06:01:58 +0000 stress2: Added a "mdconfig -o force" test scenario --- tools/test/stress2/misc/force9.sh | 92 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tools/test/stress2/misc/force9.sh b/tools/test/stress2/misc/force9.sh new file mode 100755 index 000000000000..325b227888a6 --- /dev/null +++ b/tools/test/stress2/misc/force9.sh @@ -0,0 +1,92 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# "mdconfig -o force" test scenario. +# "panic: ffs_checkblk: cylinder group read failed" seen: +# https://people.freebsd.org/~pho/stress/log/log0170.txt + +" "panic: softdep_update_inodeblock inconsistent ip ..." seen: +# https://people.freebsd.org/~pho/stress/log/log0184.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +log=/tmp/force7.sh.log +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +truncate -s 10g $diskimage +mdconfig -a -t vnode -f $diskimage -u $mdstart +flags=$newfs_flags +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null 2>&1 + +export TESTPROGS=`cd ..; find testcases/ -perm -1 -type f | \ + egrep -Ev "/run/|/badcode/|/pty/|/shm/|/socket/|sysctl|tcp|thr|udp"` +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX +start=`date +%s` +while [ $((`date +%s` - start)) -lt $((15 * 60)) ]; do + mount /dev/md$mdstart $mntpoint + rm -fr $mntpoint/lost+found + chmod 777 $mntpoint + + echo "Start tests" + su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ + /dev/null 2>&1 & + + sleep `jot -r 1 60 180` + echo "Force destroy MD disk" + while mdconfig -l | grep -q md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 + done + sleep 1 + ../tools/killall.sh + wait + n=0 + while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } + done + mdconfig -a -t vnode -f $diskimage -u $mdstart + fsck_ffs -fyR /dev/md$mdstart > $log 2>&1; s=$? + [ $s -ne 0 ] && break + grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=100; break; } +done +if [ $s -eq 0 ]; then + mount /dev/md$mdstart $mntpoint + cp -R /usr/include $mntpoint + dd if=/dev/zero of=$mntpoint/big bs=1m count=10 status=none + find $mntpoint/* -delete + umount $mntpoint + mdconfig -d -u $mdstart + rm -f $diskimage $log +else + cat $log +fi +exit $s From nobody Wed Oct 20 06:25:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F148618052E4; Wed, 20 Oct 2021 06:25:10 +0000 (UTC) (envelope-from pstef@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ0w66Ty9z4mYw; Wed, 20 Oct 2021 06:25:10 +0000 (UTC) (envelope-from pstef@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634711110; 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=K6/wPiEmG7Lhd2/D/NPX/Km8eOUwLUoQP4mP5U5xT60=; b=ONaglU0sBY4RhzGkJG1pvluJOZ+dx+E9WpIq9zUCbXej7v4lXbtXyRo+D5p3rOJ4h/ASgy /UvoTKm2QB/vPTovHwCB1cFxGx9hzxz8XAC2aQi741NMHcsQaUH9+6yFHxFJbzRVT56i9V zBpoTVkCdqKIWdJbi6iSEW9LM8megD3zF+J829AlZSmqu3lOGKlVl9m/OvGuXBtKnLhc1b TY5432VRI82y1Dxbq5sfUrRmaEQtbw4j33dWmLxnp5ZMcN7U4kCrrMbHGkL4kbZu64h0RF 6d9oosyZ8w5KuEzqW261aiSPJGTYOIPr8jrOUhkObx3COUr5M5FfzQQpYEpqew== Received: by freefall.freebsd.org (Postfix, from userid 1403) id C27611B116; Wed, 20 Oct 2021 06:25:10 +0000 (UTC) Date: Wed, 20 Oct 2021 06:25:10 +0000 From: "Piotr P. Stefaniak" To: Alexey Dokuchaev Cc: Kevin Bowling , Emmanuel Vadot , Slawa Olhovchenkov , src-committers , "" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634711110; 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=K6/wPiEmG7Lhd2/D/NPX/Km8eOUwLUoQP4mP5U5xT60=; b=ZsMpIpTNukyY7gNlLtisjPfS7hppemSbxfLJKG6zwTdqWEL+ZNi3LuTyinRHdpjlRXYKX2 fttgnbBTcIu3Ypn5egatDU+TDDd6jePJGmfxoe1oU5aTU6DL1Ig5SiEySIW7loWB96SMEp c9UizzwYi6JoNjoOhWNSnDxkJhYpXXV+qd/pVaPXZvGXURLXPczdA/Tfo4L6178HPTqUUQ tmGZo9KHGjs/B0rztOurGXxZEzEVNOPCzMcZtAq92bKgnB0YfzrPiUQM1cVDhlq0qY5dvw TiX8Uqd2LwfSBnXsUzrIcKDS3RVytOIPccQP79BctyAFfETCk+on0p1vzYugKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634711110; a=rsa-sha256; cv=none; b=cdG26VLQ0hoIxeZ1NEAij7EWHqTjoQQeVpwjNBHOWlfYgLRqAS+GAZuuO2FIm+7l/eMnmn vzGbLDK1lwYHEFUZFdb1JFXN3ulJatlrMXZNM2ipfY77BwduUfDdDIhO3FOiuzehPF6oqe ku9OGJk0Dr6Fy5RzCIsm/WySAgrmWQVi1V9DLCUC2Za3VT8UOtwrh28IOlL+PJ0R5gT7Cq X6olKxkI3lCOooPs5PU8BsZtxpxf6ov8yFbzmK06q+IIA+/jxe9j4UhJIRJP8TRSwqF+Lm 8KN0fHeh6g69euZgyZ8/C4SSFtiF+iYXdPfCzWACLG77X1sJBFRZIQRnw3AWew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 2021-10-20 02:40:24, Alexey Dokuchaev wrote: >On Tue, Oct 19, 2021 at 06:55:34PM -0700, Kevin Bowling wrote: >> >> I think a POLA violation here was that some equipment emits a >> jarringly loud noise, and rushing to turn that off is more stressful >> than the change of turning it on if you value it. > >If "some equipment" has a buzzer so annoying that it stresses one >enough that she gets lost as to how to turn it off then perhaps admin >of such equipment should complain to its vendor instead. When I installed FreeBSD on my laptop, I was mostly happy with how it worked, except it had an Astonishingly loud beeper. I had to waste Colin's time to learn about how to disable it. Me complaining to vendor of an old laptop won't buy us anything. In general, the defaults are really not for you or me. We use FreeBSD no matter what and whenever a setting is not what we like, we change it, or the sources. The defaults are for the people who don't have any FreeBSD configs yet and probably don't intend to write them for some time. Some people will want to grow their own configs over time, unless they're discouraged by the generally unfriendly look and feel of FreeBSD. Piotr From nobody Wed Oct 20 07:00:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 04EB6181410D; Wed, 20 Oct 2021 07:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ1hL6hkZz4wng; Wed, 20 Oct 2021 07:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C787A22FE0; Wed, 20 Oct 2021 07:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K702S2039877; Wed, 20 Oct 2021 07:00:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K702QZ039875; Wed, 20 Oct 2021 07:00:02 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:00:02 GMT Message-Id: <202110200700.19K702QZ039875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: dbdc8e3e3f64 - stable/13 - bhyve: Update usage and synopsis for the -k flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dbdc8e3e3f64e1c4d8aadcbdbfc1a8bf3609d571 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dbdc8e3e3f64e1c4d8aadcbdbfc1a8bf3609d571 commit dbdc8e3e3f64e1c4d8aadcbdbfc1a8bf3609d571 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-10-12 19:49:43 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-10-20 06:59:11 +0000 bhyve: Update usage and synopsis for the -k flag Let's make it clear to users that -k is for configuration files. Also, point to bhyve_config(5) in the paragraph describing the flag. Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32467 (cherry picked from commit f656df586ad1aa86a2b9f076a224f746d5308613) --- usr.sbin/bhyve/bhyve.8 | 9 ++++++--- usr.sbin/bhyve/bhyverun.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 79b6d9bfb240..4f5b544cfc65 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2021 +.Dd October 13, 2021 .Dt BHYVE 8 .Os .Sh NAME @@ -46,7 +46,7 @@ .Oc .Sm on .Op Fl G Ar port -.Op Fl k Ar file +.Op Fl k Ar config_file .Oo Fl l .Sm off .Ar lpcdev Op Cm \&, Ar conf @@ -155,7 +155,7 @@ Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. .It Fl h Print help message and exit. -.It Fl k Ar file +.It Fl k Ar config_file Set configuration variables from a simple, key-value config file. Each line of the config file is expected to consist of a config variable name, an equals sign @@ -166,6 +166,9 @@ value. Blank lines and lines starting with .Sq # are ignored. +See +.Xr bhyve_config 5 +for more details. .It Fl l Cm help Print a list of supported LPC devices. .It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index d14219bbef65..e4d96d2293fa 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -224,7 +224,7 @@ usage(int code) fprintf(stderr, "Usage: %s [-AaCDeHhPSuWwxY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" - " %*s [-G port] [-k file] [-l lpc] [-m mem] [-o var=value]\n" + " %*s [-G port] [-k config_file] [-l lpc] [-m mem] [-o var=value]\n" " %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n" " -A: create ACPI tables\n" " -a: local apic is in xAPIC mode (deprecated)\n" From nobody Wed Oct 20 07:34:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D283F17FADC1; Wed, 20 Oct 2021 07:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2S65T8kz56N3; Wed, 20 Oct 2021 07:34:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CBDF2376A; Wed, 20 Oct 2021 07:34:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K7YU2w090832; Wed, 20 Oct 2021 07:34:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K7YURw090831; Wed, 20 Oct 2021 07:34:30 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:34:30 GMT Message-Id: <202110200734.19K7YURw090831@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: 5aeb26000a41 - main - ncurses: documents the latest changes in RELNOTES List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 5aeb26000a41efb54fae2f0c631db6fcda268bb5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5aeb26000a41efb54fae2f0c631db6fcda268bb5 commit 5aeb26000a41efb54fae2f0c631db6fcda268bb5 Author: Baptiste Daroussin AuthorDate: 2021-10-19 06:43:39 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 07:33:04 +0000 ncurses: documents the latest changes in RELNOTES --- RELNOTES | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RELNOTES b/RELNOTES index c5d4c038cfe7..225872fe497b 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,12 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +396851c20ae: + libncursesw has been split into libtinfow and libncursesw, linker + scripts should make it transparent for consumers. pkg-config files + are also now installed to ease ports detecting the ncurses setup from + base. + 422084abbda: LLVM's MemorySanitizer can now be used in amd64 kernels. See the kmsan(9) manual page for more information. From nobody Wed Oct 20 07:34:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4989F17FAE06; Wed, 20 Oct 2021 07:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2S80SV9z56BM; Wed, 20 Oct 2021 07:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C910C2376B; Wed, 20 Oct 2021 07:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K7YVlg090856; Wed, 20 Oct 2021 07:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K7YVTH090855; Wed, 20 Oct 2021 07:34:31 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:34:31 GMT Message-Id: <202110200734.19K7YVTH090855@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: ef0d94a3d34c - main - sh(1): interactive mode improvement List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: ef0d94a3d34c880bd9f86cd842ee01b6075bc1d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ef0d94a3d34c880bd9f86cd842ee01b6075bc1d8 commit ef0d94a3d34c880bd9f86cd842ee01b6075bc1d8 Author: Baptiste Daroussin AuthorDate: 2021-10-19 06:37:47 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 07:33:04 +0000 sh(1): interactive mode improvement In the default configuration add 2 bindings which has been requested by many during the HEADSUP discussion: * csh like arrow history navigation * ctrl-arrow to jump from word to words Add an alias to make the history command exist as an alias to fc -l. --- bin/sh/dot.shrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/sh/dot.shrc b/bin/sh/dot.shrc index 5277e5b07b0a..5a111a61a38d 100644 --- a/bin/sh/dot.shrc +++ b/bin/sh/dot.shrc @@ -31,6 +31,15 @@ # alias mv='mv -i' # alias rm='rm -i' +# # csh like history on arrow up and down +bind ^[[A ed-search-prev-history +bind ^[[B ed-search-next-history + +# # ctrl+arrow allow to jump from words to words +bind "\\e[1;5C" em-next-word +bind "\\e[1;5D" ed-prev-word +alias history='fc -l' + # read(2) of directories may not be desirable by default, as this will provoke # EISDIR errors from each directory encountered. # alias grep='grep -d skip' From nobody Wed Oct 20 07:34:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 97FF517FA925; Wed, 20 Oct 2021 07:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2S91pY3z56b6; Wed, 20 Oct 2021 07:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E283123832; Wed, 20 Oct 2021 07:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K7YWc3090886; Wed, 20 Oct 2021 07:34:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K7YWgT090885; Wed, 20 Oct 2021 07:34:32 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:34:32 GMT Message-Id: <202110200734.19K7YWgT090885@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: d410b585b6f0 - main - sh(1): make it the default shell for the root user List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: d410b585b6f00a26c2de7724d6576a3ea7d548b7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=d410b585b6f00a26c2de7724d6576a3ea7d548b7 commit d410b585b6f00a26c2de7724d6576a3ea7d548b7 Author: Baptiste Daroussin AuthorDate: 2021-10-19 06:46:12 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 07:34:05 +0000 sh(1): make it the default shell for the root user In the recent history sh(1) has gain the missing features for it to become a usable interractive shell: - command completion - persistent history support - improvements on the default bindings in emacs mode - improvements in the vi mode (repect $EDITOR) - print a newline when exiting via ^D - default prompt and improvements on how PS1 can be configured - and more. This changes also simplifies making tiny freebsd images with only sh(1) as a shell --- UPDATING | 6 ++++++ etc/master.passwd | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 6184d2df8a8d..798f188971b8 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20211020: + sh(1) is now the default shell for the root user. to force root to use + the csh shell, please run the following command as root: + + $ chsh -s csh + 20211004: Ncurses distribution has been split between libtinfow and libncurses with libncurses.so becoming a linker (ld) script to seamlessly link diff --git a/etc/master.passwd b/etc/master.passwd index a1be886f1e8d..b61c13fdd9fe 100644 --- a/etc/master.passwd +++ b/etc/master.passwd @@ -1,6 +1,6 @@ # $FreeBSD$ # -root::0:0::0:0:Charlie &:/root:/bin/csh +root::0:0::0:0:Charlie &:/root:/bin/sh toor:*:0:0::0:0:Bourne-again Superuser:/root: daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin operator:*:2:5::0:0:System &:/:/usr/sbin/nologin From nobody Wed Oct 20 07:35:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 84DCA17FC1FA; Wed, 20 Oct 2021 07:35:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2TM1q8kz57Sv; Wed, 20 Oct 2021 07:35:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 188E2236DD; Wed, 20 Oct 2021 07:35:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K7ZYTc091076; Wed, 20 Oct 2021 07:35:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K7ZYcr091075; Wed, 20 Oct 2021 07:35:34 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:35:34 GMT Message-Id: <202110200735.19K7ZYcr091075@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: 1fca3dca2339 - main - RELNOTES: document the change of the default shell List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 1fca3dca2339cceda5efce0d6b87846faac3dba9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=1fca3dca2339cceda5efce0d6b87846faac3dba9 commit 1fca3dca2339cceda5efce0d6b87846faac3dba9 Author: Baptiste Daroussin AuthorDate: 2021-10-20 07:35:07 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 07:35:07 +0000 RELNOTES: document the change of the default shell --- RELNOTES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELNOTES b/RELNOTES index 225872fe497b..60942ddd5422 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +d410b585b6f: + sh(1) is now the default shell for the root user. + 396851c20ae: libncursesw has been split into libtinfow and libncursesw, linker scripts should make it transparent for consumers. pkg-config files From nobody Wed Oct 20 07:43:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CB5AE1800DC4; Wed, 20 Oct 2021 07:43:01 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2dx5BYFz3DX6; Wed, 20 Oct 2021 07:43:01 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634715781; 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=ODqGkhTUaXOKnPs71LpK9VD1tvf0WD1yJQxVpWye2II=; b=GlOSpwx1n1hOp6FKYq9OL7u+dButX+AATqgp3Sv7I0yRproUsVQfZhZ2VhZZfqa49kh+Xh rUY1/x5cdDJY6gWBmmvtUTC9CkRYRngQQJ23HBP8iU1HrDVFc9mSuFHQB5wtKAt8pq26B0 LBrA3vR7LQIgSpbbTG9GCqR+827CLpPGUTtq1yt237kl7r2ABgtEG45+j0beLc8g013IvG q5lnfZ4nBG4rUvOtZMLXYUKCRDpHsEBlO6q8TXp6bYoV+xFlJmNs6vsrUSyrM4iaqGJJxG OUali6mDUoIgDiVNtAnLBhtk3Nb8gxxVfF1pE3GEhpmf4OrSMl73hdsxPU6Qrw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 95CC21B66D; Wed, 20 Oct 2021 07:43:01 +0000 (UTC) Date: Wed, 20 Oct 2021 07:43:01 +0000 From: Alexey Dokuchaev To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d410b585b6f0 - main - sh(1): make it the default shell for the root user Message-ID: References: <202110200734.19K7YWgT090885@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202110200734.19K7YWgT090885@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634715781; 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=ODqGkhTUaXOKnPs71LpK9VD1tvf0WD1yJQxVpWye2II=; b=c2eiey4sIEy49NqOK1BWpXH6XZbHyT3WJxrYBgP8un9qZVP20eT7Ooyc5u4HFO52wrQCmI eCB30VfOYYO/iknyFL5JOehna4NU+b8g8T7jcrNMcvxf0OjS5F6JQ6DGaD9qsBdX32cJ2s niF/Vb/XnWON0aI2+3DHevq9i/77qbI8wa+nBAZjgZhwYwbElGWfYsIdlO2U5eWIJLVamj EbkK122Ws62V4G1FhjmC7QRWIpV4RdGSmD/4PAeJ4fSUe+eSB5qP9mFwyxT+8fdJ0sygeW AxP5y6JJ5/bpLpX3/UL+kYB8JgKTgMz3GuADyKB14QR69P0VoFmSDG+YOFMAuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634715781; a=rsa-sha256; cv=none; b=gnDWw7/X7wbww/y2D8TlVwUFEI2dukgKBsGPEDW+ALNPtyZSBKP7rktO9grWCuH7o6v2I2 uScQWNXWxMcPs95YvduvVOuNA95hKOKySDjF7iCPpncfG7N3x/KkplH6JjkBU8iwSnKmxJ BOnlpBm8gtpzHv0BVTM2dnLh0dmfvghWT+ilc7rcCTTwbiOQbnKhgsuKGB9w99GgwDqt89 g0OjOIwyD5PIxIJZmR8sgFzjwweHRF7FNgqJH8GQjAyHS5MHqxarRe9056jh/IeEJuQU6y unIKuD9vcdmcOCUYdTgxuSh7Crx2RQ97zSP9knSsTth+vpPdWSjsJ/IukuiEtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 07:34:32AM +0000, Baptiste Daroussin wrote: > commit d410b585b6f00a26c2de7724d6576a3ea7d548b7 > > sh(1): make it the default shell for the root user > > @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > world, or to merely disable the most expensive debugging functionality > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20211020: > + sh(1) is now the default shell for the root user. to force root to use New sentences start with capital letter. We also typically use double space to separate sentences as it makes easier to read text with fixed- width fonts, e.g. on the terminal. > + the csh shell, please run the following command as root: > + > + $ chsh -s csh Suggesting to run the command as root and using non-root prompt ($) in the example is confusing. ./danfe From nobody Wed Oct 20 07:47:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 03C8418030D9; Wed, 20 Oct 2021 07:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2kh65bbz3Fsg; Wed, 20 Oct 2021 07:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B096323BAC; Wed, 20 Oct 2021 07:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K7l8To004643; Wed, 20 Oct 2021 07:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K7l8RL004642; Wed, 20 Oct 2021 07:47:08 GMT (envelope-from git) Date: Wed, 20 Oct 2021 07:47:08 GMT Message-Id: <202110200747.19K7l8RL004642@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: 6ae38ab45396 - main - UPDATING: fix style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 6ae38ab45396edaea26b4725e0c7db8cffa5f208 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=6ae38ab45396edaea26b4725e0c7db8cffa5f208 commit 6ae38ab45396edaea26b4725e0c7db8cffa5f208 Author: Baptiste Daroussin AuthorDate: 2021-10-20 07:44:44 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 07:44:44 +0000 UPDATING: fix style Reported by: danfe --- UPDATING | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UPDATING b/UPDATING index 798f188971b8..8028c5f192cb 100644 --- a/UPDATING +++ b/UPDATING @@ -28,10 +28,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20211020: - sh(1) is now the default shell for the root user. to force root to use + sh(1) is now the default shell for the root user. To force root to use the csh shell, please run the following command as root: - $ chsh -s csh + # chsh -s csh 20211004: Ncurses distribution has been split between libtinfow and libncurses From nobody Wed Oct 20 07:47:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AF618180365D; Wed, 20 Oct 2021 07:47:42 +0000 (UTC) (envelope-from bapt@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ2lL4cg5z3GHX; Wed, 20 Oct 2021 07:47:42 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from aniel.nours.eu (nours.eu [IPv6:2001:41d0:8:3a4d::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 625586B2C; Wed, 20 Oct 2021 07:47:42 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 24868B2CCC; Wed, 20 Oct 2021 09:47:40 +0200 (CEST) Date: Wed, 20 Oct 2021 09:47:40 +0200 From: Baptiste Daroussin To: Alexey Dokuchaev Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d410b585b6f0 - main - sh(1): make it the default shell for the root user Message-ID: <20211020074740.dn5qnunqwmtxzhpq@aniel.nours.eu> References: <202110200734.19K7YWgT090885@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 07:43:01AM +0000, Alexey Dokuchaev wrote: > On Wed, Oct 20, 2021 at 07:34:32AM +0000, Baptiste Daroussin wrote: > > commit d410b585b6f00a26c2de7724d6576a3ea7d548b7 > > > > sh(1): make it the default shell for the root user > > > > @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > > world, or to merely disable the most expensive debugging functionality > > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > > > +20211020: > > + sh(1) is now the default shell for the root user. to force root to use > > New sentences start with capital letter. We also typically use double > space to separate sentences as it makes easier to read text with fixed- > width fonts, e.g. on the terminal. > > > + the csh shell, please run the following command as root: > > + > > + $ chsh -s csh > > Suggesting to run the command as root and using non-root prompt ($) in > the example is confusing. > > ./danfe Fixed, Thanks, Bapt From nobody Wed Oct 20 08:08:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EA0C0180C27E; Wed, 20 Oct 2021 08:08:40 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ3CX62XPz3MZs; Wed, 20 Oct 2021 08:08:40 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634717320; 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=wikI98zyGaY+ofUNc0H3FaXcErzdFVQffnc83CNPuJM=; b=slqeiJWTRZsbb21xU96pVQ646SFTQ+NohqltqIgiRKzu4v8xSpvYJ/3YluFKQ9PbEvUDNu FHKIBhS62+OXffe6JQCx+ZhQ+WGrsO9ztpvmURnTQ0buz5rZR/UIl3wzTdfku6zu4gF24w sNcrA4hcuM0F9YYpS9zab0z2jRjfeZnv73kRbkyDsIgc9XS7Fib/WhM0WJ/ie8Ua8MsRju CqwO7Kw2obBlyyCkfvrIMO+lmA5v3rDI7zhyKG7HBYrmjEMmg/GYu4uQrk0q7cXiKGKXoG UHmTbJoVa2Wdl8Ma+PK4rxTyhv94QJpMadN2MvS8KS+yRdkSbhx5lHz9cdnxJg== Received: by freefall.freebsd.org (Postfix, from userid 1033) id AE2121BB8E; Wed, 20 Oct 2021 08:08:40 +0000 (UTC) Date: Wed, 20 Oct 2021 08:08:40 +0000 From: Alexey Dokuchaev To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d410b585b6f0 - main - sh(1): make it the default shell for the root user Message-ID: References: <202110200734.19K7YWgT090885@gitrepo.freebsd.org> <20211020074740.dn5qnunqwmtxzhpq@aniel.nours.eu> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020074740.dn5qnunqwmtxzhpq@aniel.nours.eu> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634717320; 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=wikI98zyGaY+ofUNc0H3FaXcErzdFVQffnc83CNPuJM=; b=s4sHM9q8yD957B7Etvt3QdPJhCp0fooOOuptBJU/x+DoEu4dJLWAhqE/ML9b0VfIKqXLHa KKwfAONJnZJGUzfNhgGuIR5H+baP9XyyaWvyLchow1Kh52Sdl4AjwZQjPh3qZhLgnGlxfF tEMf0JxlrPFahkKxFmr+Di1jJmWM7Q+gxwWS5A9juCu5dPVLEl9oCBjnJoUenM65rE///n OaCfQ8mSRTJwxxRMpuyCWyIb8SE9djxWKRdV22AgEeyLp7GHksoEzJUWcN/0/5Si5p3759 6AfwMQThr8zpsXlzgAU98y/y9h8fjybM2SaZTEQPzehH81hdmeLY6dfmTeaAEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634717320; a=rsa-sha256; cv=none; b=Xd2/8oy/VaJsJxJ7K12OfSBfGhUL09rriRDo4vM9XaCk2kSylVzU1DAaTpShBD3KWkUt5h uG4LwrSGYtblfMFLmqfoT3oudlcR5UhUo52QWC54Z0mKrmDIp8r0McoROmRx8yljYmIeZ1 tFoDPXyG+7HbqJodkQhS85UVJIRihydblXcO6ejKNXX0RozpDqJbnCi3sCU/NUpSN9GUGd PBBKyyATS89yMtTxKevanY9GwRLaGguFNwDPDzlXbdBGAgFHEsjN1uM3YdfcdGcFFtlGwL T8jg/ATJbDylcoVPn2i4MmmxlQGissPmm4r1cdwANYJ9Z0vhrGYBQIzBB+vmlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 09:47:40AM +0200, Baptiste Daroussin wrote: > On Wed, Oct 20, 2021 at 07:43:01AM +0000, Alexey Dokuchaev wrote: > > On Wed, Oct 20, 2021 at 07:34:32AM +0000, Baptiste Daroussin wrote: > > > commit d410b585b6f00a26c2de7724d6576a3ea7d548b7 > > > > > > sh(1): make it the default shell for the root user > > > > > > @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > > > world, or to merely disable the most expensive debugging functionality > > > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > > > > > +20211020: > > > + sh(1) is now the default shell for the root user. to force root to use > > > > New sentences start with capital letter. We also typically use double > > space to separate sentences as it makes easier to read text with fixed- > > width fonts, e.g. on the terminal. > > > > > + the csh shell, please run the following command as root: > > > + > > > + $ chsh -s csh > > > > Suggesting to run the command as root and using non-root prompt ($) in > > the example is confusing. > > Fixed, Very nice, thank you! ./danfe From nobody Wed Oct 20 09:04:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B80051805A05; Wed, 20 Oct 2021 09:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ4Rd4prqz3rl9; Wed, 20 Oct 2021 09:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A7B524A4A; Wed, 20 Oct 2021 09:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K94DeZ011790; Wed, 20 Oct 2021 09:04:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K94DTj011789; Wed, 20 Oct 2021 09:04:13 GMT (envelope-from git) Date: Wed, 20 Oct 2021 09:04:13 GMT Message-Id: <202110200904.19K94DTj011789@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: 68914dab436a - main - timeout: eliminate usage of sysexits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 68914dab436acf166b8f851c4fa0acecb7c7c510 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=68914dab436acf166b8f851c4fa0acecb7c7c510 commit 68914dab436acf166b8f851c4fa0acecb7c7c510 Author: Baptiste Daroussin AuthorDate: 2021-10-20 08:39:34 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 08:39:34 +0000 timeout: eliminate usage of sysexits It brings no value at all the sysexits and maybe misleading as the return value of timeout(1) matters. --- usr.bin/timeout/timeout.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c index d682541e9162..6af795ba7408 100644 --- a/usr.bin/timeout/timeout.c +++ b/usr.bin/timeout/timeout.c @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #define EXIT_TIMEOUT 124 @@ -58,7 +57,7 @@ usage(void) " [--kill-after time | -k time] [--foreground] " " \n", getprogname()); - exit(EX_USAGE); + exit(EXIT_FAILURE); } static double @@ -75,7 +74,7 @@ parse_duration(const char *duration) return (ret); if (end != NULL && *(end + 1) != '\0') - errx(EX_USAGE, "invalid duration"); + errx(125, "invalid duration"); switch (*end) { case 's': @@ -156,7 +155,7 @@ set_interval(double iv) tim.it_value.tv_usec = (suseconds_t)(iv * 1000000UL); if (setitimer(ITIMER_REAL, &tim, NULL) == -1) - err(EX_OSERR, "setitimer()"); + err(EXIT_FAILURE, "setitimer()"); } int @@ -229,7 +228,7 @@ main(int argc, char **argv) if (!foreground) { /* Acquire a reaper */ if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1) - err(EX_OSERR, "Fail to acquire the reaper"); + err(EXIT_FAILURE, "Fail to acquire the reaper"); } memset(&signals, 0, sizeof(signals)); @@ -247,14 +246,14 @@ main(int argc, char **argv) for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++) if (signums[i] != -1 && signums[i] != 0 && sigaction(signums[i], &signals, NULL) == -1) - err(EX_OSERR, "sigaction()"); + err(EXIT_FAILURE, "sigaction()"); signal(SIGTTIN, SIG_IGN); signal(SIGTTOU, SIG_IGN); pid = fork(); if (pid == -1) - err(EX_OSERR, "fork()"); + err(EXIT_FAILURE, "fork()"); else if (pid == 0) { /* child process */ signal(SIGTTIN, SIG_DFL); @@ -270,7 +269,7 @@ main(int argc, char **argv) } if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1) - err(EX_OSERR, "sigprocmask()"); + err(EXIT_FAILURE, "sigprocmask()"); /* parent continues here */ set_interval(first_kill); @@ -344,7 +343,7 @@ main(int argc, char **argv) while (!child_done && wait(&pstat) == -1) { if (errno != EINTR) - err(EX_OSERR, "waitpid()"); + err(EXIT_FAILURE, "waitpid()"); } if (!foreground) From nobody Wed Oct 20 09:04:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 01717180592D; Wed, 20 Oct 2021 09:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ4Rf5yTjz3rw4; Wed, 20 Oct 2021 09:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A872624D89; Wed, 20 Oct 2021 09:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K94EQO011814; Wed, 20 Oct 2021 09:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K94EYr011813; Wed, 20 Oct 2021 09:04:14 GMT (envelope-from git) Date: Wed, 20 Oct 2021 09:04:14 GMT Message-Id: <202110200904.19K94EYr011813@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: 3f550f019185 - main - timeout: style fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 3f550f01918511ac73884828f98ad1eaae2c18b4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3f550f01918511ac73884828f98ad1eaae2c18b4 commit 3f550f01918511ac73884828f98ad1eaae2c18b4 Author: Baptiste Daroussin AuthorDate: 2021-10-20 08:44:32 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 08:44:32 +0000 timeout: style fixes --- usr.bin/timeout/timeout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c index 6af795ba7408..d6b82373c0a1 100644 --- a/usr.bin/timeout/timeout.c +++ b/usr.bin/timeout/timeout.c @@ -127,7 +127,7 @@ sig_handler(int signo) return; } - switch(signo) { + switch (signo) { case 0: case SIGINT: case SIGHUP: @@ -237,13 +237,13 @@ main(int argc, char **argv) if (killsig != SIGKILL && killsig != SIGSTOP) signums[0] = killsig; - for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++) + for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i++) sigaddset(&signals.sa_mask, signums[i]); signals.sa_handler = sig_handler; signals.sa_flags = SA_RESTART; - for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++) + for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i++) if (signums[i] != -1 && signums[i] != 0 && sigaction(signums[i], &signals, NULL) == -1) err(EXIT_FAILURE, "sigaction()"); @@ -351,7 +351,7 @@ main(int argc, char **argv) if (WEXITSTATUS(pstat)) pstat = WEXITSTATUS(pstat); - else if(WIFSIGNALED(pstat)) + else if (WIFSIGNALED(pstat)) pstat = 128 + WTERMSIG(pstat); if (timedout && !preserve) From nobody Wed Oct 20 09:24:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 970D0180EA0A; Wed, 20 Oct 2021 09:24: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ4vG3jMPz4SNW; Wed, 20 Oct 2021 09:24:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B7BA25120; Wed, 20 Oct 2021 09:24:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K9Ogud037917; Wed, 20 Oct 2021 09:24:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K9Ogpc037916; Wed, 20 Oct 2021 09:24:42 GMT (envelope-from git) Date: Wed, 20 Oct 2021 09:24:42 GMT Message-Id: <202110200924.19K9Ogpc037916@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: 5fe973734866 - main - skel: update .shrc as well List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 5fe97373486619373e3eeecb25582b5c937a26c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5fe97373486619373e3eeecb25582b5c937a26c5 commit 5fe97373486619373e3eeecb25582b5c937a26c5 Author: Baptiste Daroussin AuthorDate: 2021-10-20 09:23:13 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 09:23:13 +0000 skel: update .shrc as well Somehow we end up having 2 definition of the same .shrc in the source tree, both of them should have been updated. A batter fix would be to only keep one copy of the same file. but that would be for another commit Reported by: lme --- share/skel/dot.shrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/share/skel/dot.shrc b/share/skel/dot.shrc index f497bd66f819..56a6b1828131 100644 --- a/share/skel/dot.shrc +++ b/share/skel/dot.shrc @@ -31,6 +31,14 @@ alias g='egrep -i' # alias mv='mv -i' # alias rm='rm -i' +# # csh like history on arrow up and down +bind ^[[A ed-search-prev-history +bind ^[[B ed-search-next-history + +# # ctrl+arrow allow to jump from words to words +bind "\\e[1;5C" em-next-word +bind "\\e[1;5D" ed-prev-word +alias history='fc -l' # set prompt: ``username@hostname:directory $ '' PS1="\u@\h:\w \\$ " From nobody Wed Oct 20 09:52:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DC77717F0862; Wed, 20 Oct 2021 09:52:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ5Vx58Qyz4ZC7; Wed, 20 Oct 2021 09:52:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1md8GU-000681-4e; Wed, 20 Oct 2021 12:52:06 +0300 Date: Wed, 20 Oct 2021 12:52:06 +0300 From: Slawa Olhovchenkov To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211020095206.GA77338@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HZ5Vx58Qyz4ZC7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > On Tue, 19 Oct 2021 14:21:33 +0300 > Slawa Olhovchenkov wrote: > > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > > > The branch main has been updated by manu: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > Author: Emmanuel Vadot > > > AuthorDate: 2021-10-18 08:16:41 +0000 > > > Commit: Emmanuel Vadot > > > CommitDate: 2021-10-19 07:37:28 +0000 > > > > > > vt: Disable bell by default > > > > > > Bell is either useless if you're working on remote servers or really annoying > > > when you're working with a local machine that have a loud buzzer. > > > Switch the default to have it disable. > > > > For you, not for me, for example. Also, this is violate POLA. > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > happy again. I'll do some UPDATING note. > And POLA doesn't means that we can't change a thing. Modify bsdinstall to set kern.vt.enable_bell=0 in /etc/sysctl.conf, this is don't break POLA for updating existing install and be happy you. From nobody Wed Oct 20 10:02:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 04C1617F686D; Wed, 20 Oct 2021 10:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ5kh6mkJz4dRV; Wed, 20 Oct 2021 10:02:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8456253FF; Wed, 20 Oct 2021 10:02:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KA2Kku091233; Wed, 20 Oct 2021 10:02:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KA2Kfr091232; Wed, 20 Oct 2021 10:02:20 GMT (envelope-from git) Date: Wed, 20 Oct 2021 10:02:20 GMT Message-Id: <202110201002.19KA2Kfr091232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 4fb002805e0d - main - Pass the ACPI ID when reading the ACPI domain List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fb002805e0dc0d08825bce65a0f4e533c53ec54 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4fb002805e0dc0d08825bce65a0f4e533c53ec54 commit 4fb002805e0dc0d08825bce65a0f4e533c53ec54 Author: Andrew Turner AuthorDate: 2021-10-18 09:04:06 +0000 Commit: Andrew Turner CommitDate: 2021-10-20 10:02:06 +0000 Pass the ACPI ID when reading the ACPI domain The ACPI ID may not be the same as the FreeBSD CPU id. Use the former when finding the CPU domain as there is no requirement for it to be identical to the latter. Reported by: dch, kevans Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32546 --- sys/arm64/arm64/mp_machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 5f88900f4074..15e05ef46262 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -569,7 +569,7 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) domain = 0; #ifdef NUMA if (vm_ndomains > 1) - domain = acpi_pxm_get_cpu_locality(*cpuid); + domain = acpi_pxm_get_cpu_locality(intr->Uid); #endif if (start_cpu(id, intr->ArmMpidr, domain)) { MPASS(cpuid_to_pcpu[id] != NULL); From nobody Wed Oct 20 11:42:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 359BC17FA8E6; Wed, 20 Oct 2021 11:42:46 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ7yY5JWFz3Ly8; Wed, 20 Oct 2021 11:42:45 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634730158; 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=hccGPi8jlaK8bMaxtX/0phPhC6vwEudJU0OpRlsraus=; b=CPZnfx0tUvoVdlPOPfDK3KRL2BRNPeX15V2hYxnFur7epZIUbJOksqjC2BobBJ+gSYFf/k Ai8GDYrDHv+BvlVweC4IcSUeZLKfdvMiwOr+2n6yxtRmyFWVLQAGPqNrHjyPEw1WlF3/8t QIrS9rcsVrSkr2ZMgDVXLqOSHwCbgEM= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 185098ab (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 20 Oct 2021 11:42:37 +0000 (UTC) Date: Wed, 20 Oct 2021 13:42:37 +0200 From: Emmanuel Vadot To: Slawa Olhovchenkov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> In-Reply-To: <20211020095206.GA77338@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HZ7yY5JWFz3Ly8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, 20 Oct 2021 12:52:06 +0300 Slawa Olhovchenkov wrote: > On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > > > On Tue, 19 Oct 2021 14:21:33 +0300 > > Slawa Olhovchenkov wrote: > > > > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > > > > > The branch main has been updated by manu: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > Author: Emmanuel Vadot > > > > AuthorDate: 2021-10-18 08:16:41 +0000 > > > > Commit: Emmanuel Vadot > > > > CommitDate: 2021-10-19 07:37:28 +0000 > > > > > > > > vt: Disable bell by default > > > > > > > > Bell is either useless if you're working on remote servers or really annoying > > > > when you're working with a local machine that have a loud buzzer. > > > > Switch the default to have it disable. > > > > > > For you, not for me, for example. Also, this is violate POLA. > > > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > > happy again. I'll do some UPDATING note. > > And POLA doesn't means that we can't change a thing. > > Modify bsdinstall to set kern.vt.enable_bell=0 in /etc/sysctl.conf, > this is don't break POLA for updating existing install and be happy you. Stop using POLA for "This is a change that I don't agree with". In the past weeks we had commits that changed mixer(8) cli in a non-backward compatible way and changed the root shell. For both you haven't complain so it means that either you don't care or you agree with those changes. I agree that the bell is clearly a user preference and also I could have left the review opened for more time (but I've been there and usually you have review/feedback the first day and after it's silent). I wish there was an easy way for developer (and community member) to create a poll for changes like that but we don't have one right now. Now based on the number of people who reviewed and the people who sent me private message to thanks me for this change I think that more people are annoyed by the bell than people who wants it and we want sane default that most users agrees on in base FreeBSD. If you don't agree with the defaults we have a way to change them. Cheers, -- Emmanuel Vadot From nobody Wed Oct 20 12:00:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D4FFF1803EFC; Wed, 20 Oct 2021 12:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ8Lt5jQsz3jg2; Wed, 20 Oct 2021 12:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A402B27126; Wed, 20 Oct 2021 12:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KC0MTI046086; Wed, 20 Oct 2021 12:00:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KC0MJq046085; Wed, 20 Oct 2021 12:00:22 GMT (envelope-from git) Date: Wed, 20 Oct 2021 12:00:22 GMT Message-Id: <202110201200.19KC0MJq046085@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: f3aad18d5e57 - main - sh(1): fix home/del key on mobaxterm env List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: f3aad18d5e57328469be0e3be9e17d7bc48e6822 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f3aad18d5e57328469be0e3be9e17d7bc48e6822 commit f3aad18d5e57328469be0e3be9e17d7bc48e6822 Author: Baptiste Daroussin AuthorDate: 2021-10-20 11:58:18 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 12:00:20 +0000 sh(1): fix home/del key on mobaxterm env For $reason mobaxterm default on sending unusual sequence from home/del key, which makes libedit unabel to catch them and bind them correctly. mobaxterm seems popular on the windows environment, so add proper keybinding to default shrc configuration so it works out of box. Reported by: lme --- bin/sh/dot.shrc | 4 ++++ share/skel/dot.shrc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/bin/sh/dot.shrc b/bin/sh/dot.shrc index 5a111a61a38d..75d0ec047734 100644 --- a/bin/sh/dot.shrc +++ b/bin/sh/dot.shrc @@ -40,6 +40,10 @@ bind "\\e[1;5C" em-next-word bind "\\e[1;5D" ed-prev-word alias history='fc -l' +# Fix home/del for mobaxterm +bind ^[[5~ ed-move-to-beg +bind ^[[6~ ed-move-to-end + # read(2) of directories may not be desirable by default, as this will provoke # EISDIR errors from each directory encountered. # alias grep='grep -d skip' diff --git a/share/skel/dot.shrc b/share/skel/dot.shrc index 56a6b1828131..1f33504db0c0 100644 --- a/share/skel/dot.shrc +++ b/share/skel/dot.shrc @@ -40,6 +40,10 @@ bind "\\e[1;5C" em-next-word bind "\\e[1;5D" ed-prev-word alias history='fc -l' +# Fix home/del for mobaxterm +bind ^[[5~ ed-move-to-beg +bind ^[[6~ ed-move-to-end + # set prompt: ``username@hostname:directory $ '' PS1="\u@\h:\w \\$ " From nobody Wed Oct 20 12:15:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1C4D3180AD6B; Wed, 20 Oct 2021 12:15:41 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ8hX6bNVz3nxd; Wed, 20 Oct 2021 12:15:40 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mdAVI-0006k6-NJ; Wed, 20 Oct 2021 15:15:32 +0300 Date: Wed, 20 Oct 2021 15:15:32 +0300 From: Slawa Olhovchenkov To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211020121532.GX33191@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HZ8hX6bNVz3nxd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 01:42:37PM +0200, Emmanuel Vadot wrote: > On Wed, 20 Oct 2021 12:52:06 +0300 > Slawa Olhovchenkov wrote: > > > On Tue, Oct 19, 2021 at 01:37:00PM +0200, Emmanuel Vadot wrote: > > > > > On Tue, 19 Oct 2021 14:21:33 +0300 > > > Slawa Olhovchenkov wrote: > > > > > > > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > > > > > > > > The branch main has been updated by manu: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147 > > > > > > > > > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > > Author: Emmanuel Vadot > > > > > AuthorDate: 2021-10-18 08:16:41 +0000 > > > > > Commit: Emmanuel Vadot > > > > > CommitDate: 2021-10-19 07:37:28 +0000 > > > > > > > > > > vt: Disable bell by default > > > > > > > > > > Bell is either useless if you're working on remote servers or really annoying > > > > > when you're working with a local machine that have a loud buzzer. > > > > > Switch the default to have it disable. > > > > > > > > For you, not for me, for example. Also, this is violate POLA. > > > > > > Just set kern.vt.enable_bell=1 in /etc/sysctl.conf and you will be > > > happy again. I'll do some UPDATING note. > > > And POLA doesn't means that we can't change a thing. > > > > Modify bsdinstall to set kern.vt.enable_bell=0 in /etc/sysctl.conf, > > this is don't break POLA for updating existing install and be happy you. > > Stop using POLA for "This is a change that I don't agree with". > In the past weeks we had commits that changed mixer(8) cli in a > non-backward compatible way and changed the root shell. For both you > haven't complain so it means that either you don't care or you agree > with those changes. root shell change promises same behavior as present (and don't changed on existing install w/o manual confirm by etcupdate), mixer cli don't used by me daily (every time I am read manual) > I agree that the bell is clearly a user preference and also I could > have left the review opened for more time (but I've been there and > usually you have review/feedback the first day and after it's silent). > I wish there was an easy way for developer (and community member) to > create a poll for changes like that but we don't have one right now. > Now based on the number of people who reviewed and the people who sent > me private message to thanks me for this change I think that more > people are annoyed by the bell than people who wants it and we want > sane default that most users agrees on in base FreeBSD. If you don't > agree with the defaults we have a way to change them. I am say not about for new install, I am say about change behavior of existing install after upgrade to 14. Modify bsdinstall satisfy people are annoyed by the bell and don't touch people accepted bell on existing install. win-win mostly. From nobody Wed Oct 20 12:24:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 46E3E180EEAE; Wed, 20 Oct 2021 12:24: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ8tc1Pjtz3s4x; Wed, 20 Oct 2021 12:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 105BE27916; Wed, 20 Oct 2021 12:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KCONQC077045; Wed, 20 Oct 2021 12:24:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KCONV8077044; Wed, 20 Oct 2021 12:24:23 GMT (envelope-from git) Date: Wed, 20 Oct 2021 12:24:23 GMT Message-Id: <202110201224.19KCONV8077044@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: 2a213a2e2829 - main - OptionalObsoleteFiles: add more googletest files to remove List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 2a213a2e2829e026cf374480ee2402c8d6c35a7c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=2a213a2e2829e026cf374480ee2402c8d6c35a7c commit 2a213a2e2829e026cf374480ee2402c8d6c35a7c Author: Baptiste Daroussin AuthorDate: 2021-10-20 12:18:37 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 12:18:37 +0000 OptionalObsoleteFiles: add more googletest files to remove --- tools/build/mk/OptionalObsoleteFiles.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index acd578912e77..141f691ba83e 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2250,6 +2250,7 @@ OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-death-test_ex_nocatch_test OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-unittest-api_test OLD_FILES+=usr/tests/lib/googletest/gtest/Kyuafile OLD_DIRS+=usr/tests/lib/googletest/gtest +OLD_FILES+=usr/tests/lib/googletest/gtest_main/Kyuafile OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-death-test-test OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-filepath-test OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test @@ -2259,16 +2260,17 @@ OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-options-test OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-port-test OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-printers-test OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-test-part-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest-typed-test_test OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_help_test_ OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_main_unittest OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_pred_impl_unittest OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_prod_test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_skip_in_environment_setup_test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_skip_test OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_sole_header_test OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_unittest OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile1_test_ OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile2_test_ -OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest-typed-test_test -OLD_FILES+=usr/tests/lib/googletest/gtest_main/Kyuafile OLD_DIRS+=usr/tests/lib/googletest/gtest_main OLD_FILES+=usr/tests/lib/googletest/Kyuafile OLD_DIRS+=usr/tests/lib/googletest/ From nobody Wed Oct 20 13:33:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 258031806C44; Wed, 20 Oct 2021 13:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZBQl0fHvz4gNF; Wed, 20 Oct 2021 13:33:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB1FA712; Wed, 20 Oct 2021 13:33:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KDXoOY070199; Wed, 20 Oct 2021 13:33:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KDXoef070198; Wed, 20 Oct 2021 13:33:50 GMT (envelope-from git) Date: Wed, 20 Oct 2021 13:33:50 GMT Message-Id: <202110201333.19KDXoef070198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a90b5b1104db - stable/12 - pf: Introduce pf_nvbool() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a90b5b1104db4d50a5fb65861c6cc627c0a38dfe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a90b5b1104db4d50a5fb65861c6cc627c0a38dfe commit a90b5b1104db4d50a5fb65861c6cc627c0a38dfe Author: Kristof Provost AuthorDate: 2021-10-13 09:00:46 +0000 Commit: Kristof Provost CommitDate: 2021-10-20 07:53:23 +0000 pf: Introduce pf_nvbool() Similar to the existing functions for strings and ints, this lets us simplify some of the nvlist conversion code. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 776df104fa54bb581e1fb88ac44af4fa7fd4052b) --- sys/netpfil/pf/pf_nv.c | 14 ++++++++++++-- sys/netpfil/pf/pf_nv.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d1eca90e0ee5..5eda6b3917f4 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -99,6 +99,17 @@ __FBSDID("$FreeBSD$"); } \ } +int +pf_nvbool(const nvlist_t *nvl, const char *name, bool *val) +{ + if (! nvlist_exists_bool(nvl, name)) + return (EINVAL); + + *val = nvlist_get_bool(nvl, name); + + return (0); +} + int pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, size_t expected_size) @@ -840,8 +851,7 @@ pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, sizeof(kill->psk_ifname))); PFNV_CHK(pf_nvstring(nvl, "label", kill->psk_label, sizeof(kill->psk_label))); - if (nvlist_exists_bool(nvl, "kill_match")) - kill->psk_kill_match = nvlist_get_bool(nvl, "kill_match"); + PFNV_CHK(pf_nvbool(nvl, "kill_match", &kill->psk_kill_match)); errout: return (error); diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index f1cdc52aad6b..7ac3bc4153ee 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -70,6 +70,7 @@ PF_NV_DEF_UINT(uint16, uint16_t, UINT16_MAX); PF_NV_DEF_UINT(uint32, uint32_t, UINT32_MAX); PF_NV_DEF_UINT(uint64, uint64_t, UINT64_MAX); +int pf_nvbool(const nvlist_t *, const char *, bool *); int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); int pf_nvint(const nvlist_t *, const char *, int *); int pf_nvstring(const nvlist_t *, const char *, char *, size_t); From nobody Wed Oct 20 13:33:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 772851806BDC; Wed, 20 Oct 2021 13:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZBQm1nCnz4gc9; Wed, 20 Oct 2021 13:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C4833E3; Wed, 20 Oct 2021 13:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KDXqZB070302; Wed, 20 Oct 2021 13:33:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KDXq8M070301; Wed, 20 Oct 2021 13:33:52 GMT (envelope-from git) Date: Wed, 20 Oct 2021 13:33:52 GMT Message-Id: <202110201333.19KDXq8M070301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fc391b7a56d9 - stable/13 - pf: Introduce pf_nvbool() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fc391b7a56d9b8eec3f1585397c8263923153442 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fc391b7a56d9b8eec3f1585397c8263923153442 commit fc391b7a56d9b8eec3f1585397c8263923153442 Author: Kristof Provost AuthorDate: 2021-10-13 09:00:46 +0000 Commit: Kristof Provost CommitDate: 2021-10-20 07:51:34 +0000 pf: Introduce pf_nvbool() Similar to the existing functions for strings and ints, this lets us simplify some of the nvlist conversion code. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 776df104fa54bb581e1fb88ac44af4fa7fd4052b) --- sys/netpfil/pf/pf_nv.c | 14 ++++++++++++-- sys/netpfil/pf/pf_nv.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d1eca90e0ee5..5eda6b3917f4 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -99,6 +99,17 @@ __FBSDID("$FreeBSD$"); } \ } +int +pf_nvbool(const nvlist_t *nvl, const char *name, bool *val) +{ + if (! nvlist_exists_bool(nvl, name)) + return (EINVAL); + + *val = nvlist_get_bool(nvl, name); + + return (0); +} + int pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, size_t expected_size) @@ -840,8 +851,7 @@ pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, sizeof(kill->psk_ifname))); PFNV_CHK(pf_nvstring(nvl, "label", kill->psk_label, sizeof(kill->psk_label))); - if (nvlist_exists_bool(nvl, "kill_match")) - kill->psk_kill_match = nvlist_get_bool(nvl, "kill_match"); + PFNV_CHK(pf_nvbool(nvl, "kill_match", &kill->psk_kill_match)); errout: return (error); diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index f1cdc52aad6b..7ac3bc4153ee 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -70,6 +70,7 @@ PF_NV_DEF_UINT(uint16, uint16_t, UINT16_MAX); PF_NV_DEF_UINT(uint32, uint32_t, UINT32_MAX); PF_NV_DEF_UINT(uint64, uint64_t, UINT64_MAX); +int pf_nvbool(const nvlist_t *, const char *, bool *); int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); int pf_nvint(const nvlist_t *, const char *, int *); int pf_nvstring(const nvlist_t *, const char *, char *, size_t); From nobody Wed Oct 20 13:57:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5617A180FCE0 for ; Wed, 20 Oct 2021 13:57:12 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZBxg1kc5z4mdh for ; Wed, 20 Oct 2021 13:57:11 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82d.google.com with SMTP id w8so3061390qts.4 for ; Wed, 20 Oct 2021 06:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=V9EefiqIWTg55GqTiYdCzRwBuMFS+YbiEwebUn2RmnI=; b=B/cYwzk+NnSyCNgXev9wiYZJRP9V91h8Tnq9Tv5DXQgivyyW0m99JLTfttpH6AR2Ld mOWXZOr1+SS8QVLadfhtbiL+h/D/vaIUppHfbVn8UTCKisTSr5ik+CpuRFGJgI9/F+19 SGI41nINFh+CoSGUTy30RK3UDIr+v3WdFY0nD4SUj7NUF3GanUMcnMhZw581LDJHSSfH dxKygMfskmcCdxK4NdQ15o2i6bzxf1e+FA9ReRh4DaQbNycEYLMhm5TUrvZkIAZQOUwR 0GiJ9bN9EOWUqWtpGUImrWCHpj3lK2Aia28ZNnHMzZktPeC+pIf18TlAmVVZHadWAyro iiJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=V9EefiqIWTg55GqTiYdCzRwBuMFS+YbiEwebUn2RmnI=; b=WkPthR3xCQljwNXRDOTwCB4w+St6sc0F2yydtfyx4+MoXdD/DJ5zety8MmXekHbMBx 6bz8cigSNJXRzC8tkml2zC+Dt4u37ZGB+PWMXatoqtvgM3cG/rm3pc0x33rmYEDk951b 6mVm3Tf7w4ZvcnF7x3Nlvf54kwCJlhKMgLNdQJ4A8hOaSae+oVKaDumtlYSgE2K6iofT 8N+6vdoMWJ3+AWTN2T+EYg1LkE53L1b92JqFlNVJYT/0Q5xEaepJZUEp6Ffxy5/7Zrjj ayFmdpSUbZnK8B8PFfmw5E5oTnw9lssZ9z1DzXG1Jd31CeKx8CBNbpcK9lD57zTttuu7 jHiA== X-Gm-Message-State: AOAM5339Njcgq94sD91IfExPUrfw2RDwS+INYagUdDBLh86Ywajvocie wlRpnruIWADh/tCylRpljlPsZA== X-Google-Smtp-Source: ABdhPJyvw8HbCrZ4Gbr0WpDgY1fyxYNJTth2lQNA+PYhS/JRop0/WICguEtAkt7ToFXNtiHvg7lTCQ== X-Received: by 2002:a05:622a:550:: with SMTP id m16mr8661qtx.343.1634738225471; Wed, 20 Oct 2021 06:57:05 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id m6sm1004348qkh.69.2021.10.20.06.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 06:57:05 -0700 (PDT) Date: Wed, 20 Oct 2021 09:57:04 -0400 From: Shawn Webb To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211020135704.e2krf765elhscvfd@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bcgmyc4tcxzttycz" Content-Disposition: inline In-Reply-To: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HZBxg1kc5z4mdh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b="B/cYwzk+"; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::82d as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.00)[-0.003]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82d:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[100.16.224.136:received] X-ThisMailContainsUnwantedMimeParts: N --bcgmyc4tcxzttycz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > The branch main has been updated by manu: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D225639e7db685a4047e384abdb= c296c0e02bd147 >=20 > commit 225639e7db685a4047e384abdbc296c0e02bd147 > Author: Emmanuel Vadot > AuthorDate: 2021-10-18 08:16:41 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-10-19 07:37:28 +0000 >=20 > vt: Disable bell by default > =20 > Bell is either useless if you're working on remote servers or really = annoying > when you're working with a local machine that have a loud buzzer. > Switch the default to have it disable. I have no objection to the change (or any opinion on the matter), but I wonder if changes like this carry an accessibility impact. I wonder if any hard-of-sight folks relied on the original behavior. Just thinkin' out loud. ;-) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bcgmyc4tcxzttycz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFwICwACgkQ/y5nonf4 4fpgqBAAgZgl1QLjaTd41QjDJYCae5V8JsrI0oC86OncBDu1l4eUq3TCD5UIiIKl CsnwG1nJU9dKyQH373wu9F/EtHrXoN4LXUsYu+kD2PNg3562qL100WPg2loVBmHl 8RQrakCH9ew8OsVdr9sGXC4+gXMbfC4AmsAbPTK1peABwWKpIbxBDiWVZj8N2Huh uh+XwPik0Be2SHllsbpt9DoFopNmD/bQeJwTD5hNqAVwpSz4MT2NJ+MClAH8rN5X r8TuysVY7iXikbkzi3F8ybyAJnbVLs/ycF5pZHD7eMnQtr/+MlDdN4cJUeEwSXkb S3/qVy/3WXerK3FEQvbVUJUdfC8OR0W9aahsW88AUzjwlwhtHV7LAepKZvihFIGt mJx6MPGqHt5+61ZHytIZD6y2QAqd51lYXcaCM6trOx7M/GUosXRNaMEOV2yTcJQr 4QpfwP4KCtjpZaxR2ygmgFHg8smalMa9T1HAkwb1B3jOe3xXXR1FXR2DTUu7Xx7t mG42Y4DRPZvYsJmczuMH+8YCdwuxBqzSsQz81j8RpP9ogV7pSDYR6mmIQsOBDy3L 9N1jT/zN5mhHspFFBo75gNH2xXYxrbsbBt0kR0YdcHyoECvDfISq/70xXqicDCiD XjfvYjgH0Kb5jUjL55gPJGW2EZn3mdGYMuYepkXr3iNlHA0zswc= =xQor -----END PGP SIGNATURE----- --bcgmyc4tcxzttycz-- From nobody Wed Oct 20 13:57:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C68EB17F01E4; Wed, 20 Oct 2021 13:57:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZByK2yFsz4nBD; Wed, 20 Oct 2021 13:57:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ECA3971; Wed, 20 Oct 2021 13:57:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KDvjMs097066; Wed, 20 Oct 2021 13:57:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KDvjsm097065; Wed, 20 Oct 2021 13:57:45 GMT (envelope-from git) Date: Wed, 20 Oct 2021 13:57:45 GMT Message-Id: <202110201357.19KDvjsm097065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 8ec8f56ce25b - stable/13 - cxgbe(4): Separate the sw- and hw-specific parts of resource allocations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ec8f56ce25b0bcb95bba5ae52d284bcbd88617e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=8ec8f56ce25b0bcb95bba5ae52d284bcbd88617e commit 8ec8f56ce25b0bcb95bba5ae52d284bcbd88617e Author: Navdeep Parhar AuthorDate: 2021-04-26 21:03:06 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 13:55:38 +0000 cxgbe(4): Separate the sw- and hw-specific parts of resource allocations The driver uses both software resources (locks, callouts, memory for descriptors and for bookkeeping, sysctls, etc.) and hardware resources (VIs, DMA queues, TCAM entries, etc.) to operate the NIC. This commit splits the single *_ALLOCATED flag used to track all these resources into separate *_SW_ALLOCATED and *_HW_ALLOCATED flags. This is the simplified pseudocode that now applies to most queues (foo can be ctrlq/txq/rxq/ofld_txq/ofld_rxq): /* Idempotent */ alloc_foo { if (!SW_ALLOCATED) init_iq/init_eq/init_fl no-fail sw init alloc_iq_fl/alloc_eq/alloc_wrq may-fail sw alloc add_foo_sysctls, etc. no-fail post-alloc items if (!HW_ALLOCATED) alloc_iq_fl_hwq/alloc_eq_hwq hw resource allocation } /* Idempotent */ free_foo { if (!HW_ALLOCATED) free_iq_fl_hwq/free_eq_hwq release hw resources if (!SW_ALLOCATED) free_iq_fl/free_eq/free_wrq release sw resources } The routines that take the driver to FULL_INIT_DONE and VI_INIT_DONE and back are now all idempotent. The quiesce routines pay attention to the HW_ALLOCATED flag and will not wait on the hardware for pidx/cidx updates and other completions if this flag is not set. Sponsored by: Chelsio Communications (cherry picked from commit 43bbae19483fbde0a91e61acad8a6e71e334c8b8) --- sys/dev/cxgbe/adapter.h | 44 +- sys/dev/cxgbe/t4_filter.c | 9 +- sys/dev/cxgbe/t4_main.c | 376 +++++++---- sys/dev/cxgbe/t4_netmap.c | 11 +- sys/dev/cxgbe/t4_sched.c | 13 +- sys/dev/cxgbe/t4_sge.c | 1466 ++++++++++++++++++++++++----------------- sys/dev/cxgbe/tom/t4_cpl_io.c | 2 +- 7 files changed, 1135 insertions(+), 786 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 7f6e1ceb1550..8809a10269a1 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -231,7 +231,13 @@ struct vi_info { struct mtx tick_mtx; struct callout tick; - struct sysctl_ctx_list ctx; /* from ifconfig up to driver detach */ + struct sysctl_ctx_list ctx; + struct sysctl_oid *rxq_oid; + struct sysctl_oid *txq_oid; + struct sysctl_oid *nm_rxq_oid; + struct sysctl_oid *nm_txq_oid; + struct sysctl_oid *ofld_rxq_oid; + struct sysctl_oid *ofld_txq_oid; uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ }; @@ -345,11 +351,12 @@ CTASSERT(sizeof(struct iq_desc) == IQ_ESIZE); enum { /* iq flags */ - IQ_ALLOCATED = (1 << 0), /* firmware resources allocated */ + IQ_SW_ALLOCATED = (1 << 0), /* sw resources allocated */ IQ_HAS_FL = (1 << 1), /* iq associated with a freelist */ IQ_RX_TIMESTAMP = (1 << 2), /* provide the SGE rx timestamp */ IQ_LRO_ENABLED = (1 << 3), /* iq is an eth rxq with LRO enabled */ IQ_ADJ_CREDIT = (1 << 4), /* hw is off by 1 credit for this iq */ + IQ_HW_ALLOCATED = (1 << 5), /* fw/hw resources allocated */ /* iq state */ IQS_DISABLED = 0, @@ -393,12 +400,13 @@ struct sge_iq { int8_t intr_pktc_idx; /* packet count threshold index */ uint8_t gen; /* generation bit */ uint8_t intr_params; /* interrupt holdoff parameters */ - uint8_t intr_next; /* XXX: holdoff for next interrupt */ + int8_t cong; /* congestion settings */ uint16_t qsize; /* size (# of entries) of the queue */ uint16_t sidx; /* index of the entry with the status page */ uint16_t cidx; /* consumer index */ uint16_t cntxt_id; /* SGE context id for the iq */ uint16_t abs_id; /* absolute SGE id for the iq */ + int16_t intr_idx; /* interrupt used by the queue */ STAILQ_ENTRY(sge_iq) link; @@ -408,13 +416,14 @@ struct sge_iq { }; enum { + /* eq type */ EQ_CTRL = 1, EQ_ETH = 2, EQ_OFLD = 3, /* eq flags */ - EQ_TYPEMASK = 0x3, /* 2 lsbits hold the type (see above) */ - EQ_ALLOCATED = (1 << 2), /* firmware resources allocated */ + EQ_SW_ALLOCATED = (1 << 0), /* sw resources allocated */ + EQ_HW_ALLOCATED = (1 << 1), /* hw/fw resources allocated */ EQ_ENABLED = (1 << 3), /* open for business */ EQ_QFLUSH = (1 << 4), /* if_qflush in progress */ }; @@ -432,10 +441,12 @@ struct sge_eq { unsigned int flags; /* MUST be first */ unsigned int cntxt_id; /* SGE context id for the eq */ unsigned int abs_id; /* absolute SGE id for the eq */ + uint8_t type; /* EQ_CTRL/EQ_ETH/EQ_OFLD */ + uint8_t doorbells; + uint8_t tx_chan; /* tx channel used by the eq */ struct mtx eq_lock; struct tx_desc *desc; /* KVA of descriptor ring */ - uint8_t doorbells; volatile uint32_t *udb; /* KVA of doorbell (lies within BAR2) */ u_int udb_qid; /* relative qid within the doorbell page */ uint16_t sidx; /* index of the entry with the status page */ @@ -443,9 +454,9 @@ struct sge_eq { uint16_t pidx; /* producer idx (desc idx) */ uint16_t equeqidx; /* EQUEQ last requested at this pidx */ uint16_t dbidx; /* pidx of the most recent doorbell */ - uint16_t iqid; /* iq that gets egr_update for the eq */ - uint8_t tx_chan; /* tx channel used by the eq */ + uint16_t iqid; /* cached iq->cntxt_id (see iq below) */ volatile u_int equiq; /* EQUIQ outstanding */ + struct sge_iq *iq; /* iq that receives egr_update for the eq */ bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; @@ -922,7 +933,9 @@ struct adapter { uint16_t iscsicaps; uint16_t fcoecaps; - struct sysctl_ctx_list ctx; /* from adapter_full_init to full_uninit */ + struct sysctl_ctx_list ctx; + struct sysctl_oid *ctrlq_oid; + struct sysctl_oid *fwq_oid; struct mtx sc_lock; char lockname[16]; @@ -1201,10 +1214,8 @@ int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *); void doom_vi(struct adapter *, struct vi_info *); void end_synchronized_op(struct adapter *, int); int update_mac_settings(struct ifnet *, int); -int adapter_full_init(struct adapter *); -int adapter_full_uninit(struct adapter *); -int vi_full_init(struct vi_info *); -int vi_full_uninit(struct vi_info *); +int adapter_init(struct adapter *); +int vi_init(struct vi_info *); void vi_sysctls(struct vi_info *); int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); int alloc_atid(struct adapter *, void *); @@ -1243,11 +1254,9 @@ struct sge_nm_rxq; void cxgbe_nm_attach(struct vi_info *); void cxgbe_nm_detach(struct vi_info *); void service_nm_rxq(struct sge_nm_rxq *); -int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, - struct sysctl_oid *); +int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int); int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); -int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, - struct sysctl_oid *); +int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int); int free_nm_txq(struct vi_info *, struct sge_nm_txq *); #endif @@ -1266,6 +1275,7 @@ int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, bus_addr_t *, void **); int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, void *); +void free_fl_buffers(struct adapter *, struct sge_fl *); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index 3afab0d1d6b9..cddd2c96a620 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -960,11 +960,10 @@ set_filter(struct adapter *sc, struct t4_filter *t) rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setf"); if (rc) return (rc); - if (!(sc->flags & FULL_INIT_DONE) && - ((rc = adapter_full_init(sc)) != 0)) { - end_synchronized_op(sc, 0); - return (rc); - } + + if (!(sc->flags & FULL_INIT_DONE) && ((rc = adapter_init(sc)) != 0)) + goto done; + if (t->fs.hash) { if (__predict_false(ti->hftid_hash_4t == NULL)) { rc = alloc_hftid_hash(&sc->tids, HASH_NOWAIT); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 5f969829c2d1..e5c11402d9ab 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -725,10 +725,15 @@ static int fixup_link_config(struct port_info *); static int apply_link_config(struct port_info *); static int cxgbe_init_synchronized(struct vi_info *); static int cxgbe_uninit_synchronized(struct vi_info *); -static void quiesce_txq(struct adapter *, struct sge_txq *); -static void quiesce_wrq(struct adapter *, struct sge_wrq *); -static void quiesce_iq(struct adapter *, struct sge_iq *); -static void quiesce_fl(struct adapter *, struct sge_fl *); +static int adapter_full_init(struct adapter *); +static void adapter_full_uninit(struct adapter *); +static int vi_full_init(struct vi_info *); +static void vi_full_uninit(struct vi_info *); +static int alloc_extra_vi(struct adapter *, struct port_info *, struct vi_info *); +static void quiesce_txq(struct sge_txq *); +static void quiesce_wrq(struct sge_wrq *); +static void quiesce_iq_fl(struct adapter *, struct sge_iq *, struct sge_fl *); +static void quiesce_vi(struct vi_info *); static int t4_alloc_irq(struct adapter *, struct irq *, int rid, driver_intr_t *, void *, char *); static int t4_free_irq(struct adapter *, struct irq *); @@ -1132,6 +1137,13 @@ t4_attach(device_t dev) refcount_init(&sc->vxlan_refcount, 0); + sc->ctrlq_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, "ctrlq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "control queues"); + sc->fwq_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, "fwq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "firmware event queue"); + rc = t4_map_bars_0_and_4(sc); if (rc != 0) goto done; /* error message displayed already */ @@ -1429,6 +1441,7 @@ t4_attach(device_t dev) for_each_vi(pi, j, vi) { vi->pi = pi; vi->adapter = sc; + vi->first_intr = -1; vi->qsize_rxq = t4_qsize_rxq; vi->qsize_txq = t4_qsize_txq; @@ -1680,9 +1693,7 @@ t4_detach_common(device_t dev) } device_delete_children(dev); - - if (sc->flags & FULL_INIT_DONE) - adapter_full_uninit(sc); + adapter_full_uninit(sc); if ((sc->flags & (IS_VF | FW_OK)) == FW_OK) t4_fw_bye(sc, sc->mbox); @@ -1797,9 +1808,32 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) { struct ifnet *ifp; struct sbuf *sb; + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; struct pfil_head_args pa; struct adapter *sc = vi->adapter; + ctx = device_get_sysctl_ctx(vi->dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(vi->dev)); + vi->rxq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "rxq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "NIC rx queues"); + vi->txq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "txq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "NIC tx queues"); +#ifdef DEV_NETMAP + vi->nm_rxq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "nm_rxq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap rx queues"); + vi->nm_txq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "nm_txq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap tx queues"); +#endif +#ifdef TCP_OFFLOAD + vi->ofld_rxq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "ofld_rxq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE rx queues"); +#endif +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + vi->ofld_txq_oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "ofld_txq", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE/ETHOFLD tx queues"); +#endif + vi->xact_addr_filt = -1; mtx_init(&vi->tick_mtx, "vi tick", NULL, MTX_DEF); callout_init_mtx(&vi->tick, &vi->tick_mtx, 0); @@ -5536,12 +5570,10 @@ cxgbe_init_synchronized(struct vi_info *vi) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return (0); /* already running */ - if (!(sc->flags & FULL_INIT_DONE) && - ((rc = adapter_full_init(sc)) != 0)) + if (!(sc->flags & FULL_INIT_DONE) && ((rc = adapter_init(sc)) != 0)) return (rc); /* error message displayed already */ - if (!(vi->flags & VI_INIT_DONE) && - ((rc = vi_full_init(vi)) != 0)) + if (!(vi->flags & VI_INIT_DONE) && ((rc = vi_init(vi)) != 0)) return (rc); /* error message displayed already */ rc = update_mac_settings(ifp, XGMAC_ALL); @@ -5836,31 +5868,36 @@ write_global_rss_key(struct adapter *sc) #endif } -int +/* + * Idempotent. + */ +static int adapter_full_init(struct adapter *sc) { int rc, i; ASSERT_SYNCHRONIZED_OP(sc); - ADAPTER_LOCK_ASSERT_NOTOWNED(sc); - KASSERT((sc->flags & FULL_INIT_DONE) == 0, - ("%s: FULL_INIT_DONE already", __func__)); + + if (!(sc->flags & ADAP_SYSCTL_CTX)) { + sysctl_ctx_init(&sc->ctx); + sc->flags |= ADAP_SYSCTL_CTX; + } /* * queues that belong to the adapter (not any particular port). */ rc = t4_setup_adapter_queues(sc); if (rc != 0) - goto done; + return (rc); for (i = 0; i < nitems(sc->tq); i++) { + if (sc->tq[i] != NULL) + continue; sc->tq[i] = taskqueue_create("t4 taskq", M_NOWAIT, taskqueue_thread_enqueue, &sc->tq[i]); if (sc->tq[i] == NULL) { - device_printf(sc->dev, - "failed to allocate task queue %d\n", i); - rc = ENOMEM; - goto done; + CH_ERR(sc, "failed to allocate task queue %d\n", i); + return (ENOMEM); } taskqueue_start_threads(&sc->tq[i], 1, PI_NET, "%s tq%d", device_get_nameunit(sc->dev), i); @@ -5875,20 +5912,41 @@ adapter_full_init(struct adapter *sc) callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc, C_HARDCLOCK); #endif - sc->flags |= FULL_INIT_DONE; -done: + return (0); +} + +int +adapter_init(struct adapter *sc) +{ + int rc; + + ASSERT_SYNCHRONIZED_OP(sc); + ADAPTER_LOCK_ASSERT_NOTOWNED(sc); + KASSERT((sc->flags & FULL_INIT_DONE) == 0, + ("%s: FULL_INIT_DONE already", __func__)); + + rc = adapter_full_init(sc); if (rc != 0) adapter_full_uninit(sc); + else + sc->flags |= FULL_INIT_DONE; return (rc); } -int +/* + * Idempotent. + */ +static void adapter_full_uninit(struct adapter *sc) { int i; - ADAPTER_LOCK_ASSERT_NOTOWNED(sc); + /* Do this before freeing the adapter queues. */ + if (sc->flags & ADAP_SYSCTL_CTX) { + sysctl_ctx_free(&sc->ctx); + sc->flags &= ~ADAP_SYSCTL_CTX; + } t4_teardown_adapter_queues(sc); @@ -5898,8 +5956,6 @@ adapter_full_uninit(struct adapter *sc) } sc->flags &= ~FULL_INIT_DONE; - - return (0); } #ifdef RSS @@ -5967,12 +6023,13 @@ hashen_to_hashconfig(int hashen) } #endif -int +/* + * Idempotent. + */ +static int vi_full_init(struct vi_info *vi) { struct adapter *sc = vi->adapter; - struct ifnet *ifp = vi->ifp; - uint16_t *rss; struct sge_rxq *rxq; int rc, i, j; #ifdef RSS @@ -5982,59 +6039,60 @@ vi_full_init(struct vi_info *vi) #endif ASSERT_SYNCHRONIZED_OP(sc); - KASSERT((vi->flags & VI_INIT_DONE) == 0, - ("%s: VI_INIT_DONE already", __func__)); - sysctl_ctx_init(&vi->ctx); - vi->flags |= VI_SYSCTL_CTX; + if (!(vi->flags & VI_SYSCTL_CTX)) { + sysctl_ctx_init(&vi->ctx); + vi->flags |= VI_SYSCTL_CTX; + } /* * Allocate tx/rx/fl queues for this VI. */ rc = t4_setup_vi_queues(vi); if (rc != 0) - goto done; /* error message displayed already */ + return (rc); /* * Setup RSS for this VI. Save a copy of the RSS table for later use. */ if (vi->nrxq > vi->rss_size) { - if_printf(ifp, "nrxq (%d) > hw RSS table size (%d); " + CH_ALERT(vi, "nrxq (%d) > hw RSS table size (%d); " "some queues will never receive traffic.\n", vi->nrxq, vi->rss_size); } else if (vi->rss_size % vi->nrxq) { - if_printf(ifp, "nrxq (%d), hw RSS table size (%d); " + CH_ALERT(vi, "nrxq (%d), hw RSS table size (%d); " "expect uneven traffic distribution.\n", vi->nrxq, vi->rss_size); } #ifdef RSS if (vi->nrxq != nbuckets) { - if_printf(ifp, "nrxq (%d) != kernel RSS buckets (%d);" + CH_ALERT(vi, "nrxq (%d) != kernel RSS buckets (%d);" "performance will be impacted.\n", vi->nrxq, nbuckets); } #endif - rss = malloc(vi->rss_size * sizeof (*rss), M_CXGBE, M_ZERO | M_WAITOK); + if (vi->rss == NULL) + vi->rss = malloc(vi->rss_size * sizeof (*vi->rss), M_CXGBE, + M_ZERO | M_WAITOK); for (i = 0; i < vi->rss_size;) { #ifdef RSS j = rss_get_indirection_to_bucket(i); j %= vi->nrxq; rxq = &sc->sge.rxq[vi->first_rxq + j]; - rss[i++] = rxq->iq.abs_id; + vi->rss[i++] = rxq->iq.abs_id; #else for_each_rxq(vi, j, rxq) { - rss[i++] = rxq->iq.abs_id; + vi->rss[i++] = rxq->iq.abs_id; if (i == vi->rss_size) break; } #endif } - rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, rss, - vi->rss_size); + rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, + vi->rss, vi->rss_size); if (rc != 0) { - free(rss, M_CXGBE); - if_printf(ifp, "rss_config failed: %d\n", rc); - goto done; + CH_ERR(vi, "rss_config failed: %d\n", rc); + return (rc); } #ifdef RSS @@ -6057,40 +6115,52 @@ vi_full_init(struct vi_info *vi) MPASS((extra & hashconfig) == 0); if (extra) { - if_printf(ifp, + CH_ALERT(vi, "global RSS config (0x%x) cannot be accommodated.\n", hashconfig); } if (extra & RSS_HASHTYPE_RSS_IPV4) - if_printf(ifp, "IPv4 2-tuple hashing forced on.\n"); + CH_ALERT(vi, "IPv4 2-tuple hashing forced on.\n"); if (extra & RSS_HASHTYPE_RSS_TCP_IPV4) - if_printf(ifp, "TCP/IPv4 4-tuple hashing forced on.\n"); + CH_ALERT(vi, "TCP/IPv4 4-tuple hashing forced on.\n"); if (extra & RSS_HASHTYPE_RSS_IPV6) - if_printf(ifp, "IPv6 2-tuple hashing forced on.\n"); + CH_ALERT(vi, "IPv6 2-tuple hashing forced on.\n"); if (extra & RSS_HASHTYPE_RSS_TCP_IPV6) - if_printf(ifp, "TCP/IPv6 4-tuple hashing forced on.\n"); + CH_ALERT(vi, "TCP/IPv6 4-tuple hashing forced on.\n"); if (extra & RSS_HASHTYPE_RSS_UDP_IPV4) - if_printf(ifp, "UDP/IPv4 4-tuple hashing forced on.\n"); + CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n"); if (extra & RSS_HASHTYPE_RSS_UDP_IPV6) - if_printf(ifp, "UDP/IPv6 4-tuple hashing forced on.\n"); + CH_ALERT(vi, "UDP/IPv6 4-tuple hashing forced on.\n"); #else vi->hashen = F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN | F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN | F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN | F_FW_RSS_VI_CONFIG_CMD_UDPEN; #endif - rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, rss[0], 0, 0); + rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0], + 0, 0); if (rc != 0) { - free(rss, M_CXGBE); - if_printf(ifp, "rss hash/defaultq config failed: %d\n", rc); - goto done; + CH_ERR(vi, "rss hash/defaultq config failed: %d\n", rc); + return (rc); } - vi->rss = rss; - vi->flags |= VI_INIT_DONE; -done: + return (0); +} + +int +vi_init(struct vi_info *vi) +{ + int rc; + + ASSERT_SYNCHRONIZED_OP(vi->adapter); + KASSERT((vi->flags & VI_INIT_DONE) == 0, + ("%s: VI_INIT_DONE already", __func__)); + + rc = vi_full_init(vi); if (rc != 0) vi_full_uninit(vi); + else + vi->flags |= VI_INIT_DONE; return (rc); } @@ -6098,118 +6168,149 @@ done: /* * Idempotent. */ -int +static void vi_full_uninit(struct vi_info *vi) { - struct port_info *pi = vi->pi; - struct adapter *sc = pi->adapter; - int i; - struct sge_rxq *rxq; - struct sge_txq *txq; -#ifdef TCP_OFFLOAD - struct sge_ofld_rxq *ofld_rxq; -#endif -#if defined(TCP_OFFLOAD) || defined(RATELIMIT) - struct sge_ofld_txq *ofld_txq; -#endif if (vi->flags & VI_INIT_DONE) { - - /* Need to quiesce queues. */ - - /* XXX: Only for the first VI? */ - if (IS_MAIN_VI(vi) && !(sc->flags & IS_VF)) - quiesce_wrq(sc, &sc->sge.ctrlq[pi->port_id]); - - for_each_txq(vi, i, txq) { - quiesce_txq(sc, txq); - } - -#if defined(TCP_OFFLOAD) || defined(RATELIMIT) - for_each_ofld_txq(vi, i, ofld_txq) { - quiesce_wrq(sc, &ofld_txq->wrq); - } -#endif - - for_each_rxq(vi, i, rxq) { - quiesce_iq(sc, &rxq->iq); - quiesce_fl(sc, &rxq->fl); - } - -#ifdef TCP_OFFLOAD - for_each_ofld_rxq(vi, i, ofld_rxq) { - quiesce_iq(sc, &ofld_rxq->iq); - quiesce_fl(sc, &ofld_rxq->fl); - } -#endif + quiesce_vi(vi); free(vi->rss, M_CXGBE); free(vi->nm_rss, M_CXGBE); } + /* Do this before freeing the VI queues. */ + if (vi->flags & VI_SYSCTL_CTX) { + sysctl_ctx_free(&vi->ctx); + vi->flags &= ~VI_SYSCTL_CTX; + } + t4_teardown_vi_queues(vi); vi->flags &= ~VI_INIT_DONE; - - return (0); } static void -quiesce_txq(struct adapter *sc, struct sge_txq *txq) +quiesce_txq(struct sge_txq *txq) { struct sge_eq *eq = &txq->eq; struct sge_qstat *spg = (void *)&eq->desc[eq->sidx]; - (void) sc; /* unused */ - -#ifdef INVARIANTS - TXQ_LOCK(txq); - MPASS((eq->flags & EQ_ENABLED) == 0); - TXQ_UNLOCK(txq); -#endif + MPASS(eq->flags & EQ_SW_ALLOCATED); + MPASS(!(eq->flags & EQ_ENABLED)); /* Wait for the mp_ring to empty. */ while (!mp_ring_is_idle(txq->r)) { mp_ring_check_drainage(txq->r, 4096); pause("rquiesce", 1); } + MPASS(txq->txp.npkt == 0); - /* Then wait for the hardware to finish. */ - while (spg->cidx != htobe16(eq->pidx)) - pause("equiesce", 1); - - /* Finally, wait for the driver to reclaim all descriptors. */ - while (eq->cidx != eq->pidx) - pause("dquiesce", 1); + if (eq->flags & EQ_HW_ALLOCATED) { + /* + * Hardware is alive and working normally. Wait for it to + * finish and then wait for the driver to catch up and reclaim + * all descriptors. + */ + while (spg->cidx != htobe16(eq->pidx)) + pause("equiesce", 1); + while (eq->cidx != eq->pidx) + pause("dquiesce", 1); + } else { + /* + * Hardware is unavailable. Discard all pending tx and reclaim + * descriptors directly. + */ + TXQ_LOCK(txq); + while (eq->cidx != eq->pidx) { + struct mbuf *m, *nextpkt; + struct tx_sdesc *txsd; + + txsd = &txq->sdesc[eq->cidx]; + for (m = txsd->m; m != NULL; m = nextpkt) { + nextpkt = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + } + IDXINCR(eq->cidx, txsd->desc_used, eq->sidx); + } + spg->pidx = spg->cidx = htobe16(eq->cidx); + TXQ_UNLOCK(txq); + } } static void -quiesce_wrq(struct adapter *sc, struct sge_wrq *wrq) +quiesce_wrq(struct sge_wrq *wrq) { /* XXXTX */ } static void -quiesce_iq(struct adapter *sc, struct sge_iq *iq) +quiesce_iq_fl(struct adapter *sc, struct sge_iq *iq, struct sge_fl *fl) { - (void) sc; /* unused */ - /* Synchronize with the interrupt handler */ while (!atomic_cmpset_int(&iq->state, IQS_IDLE, IQS_DISABLED)) pause("iqfree", 1); + + if (fl != NULL) { + MPASS(iq->flags & IQ_HAS_FL); + + mtx_lock(&sc->sfl_lock); + FL_LOCK(fl); + fl->flags |= FL_DOOMED; + FL_UNLOCK(fl); + callout_stop(&sc->sfl_callout); + mtx_unlock(&sc->sfl_lock); + + KASSERT((fl->flags & FL_STARVING) == 0, + ("%s: still starving", __func__)); + + /* Release all buffers if hardware is no longer available. */ + if (!(iq->flags & IQ_HW_ALLOCATED)) + free_fl_buffers(sc, fl); + } } +/* + * Wait for all activity on all the queues of the VI to complete. It is assumed + * that no new work is being enqueued by the hardware or the driver. That part + * should be arranged before calling this function. + */ static void -quiesce_fl(struct adapter *sc, struct sge_fl *fl) +quiesce_vi(struct vi_info *vi) { - mtx_lock(&sc->sfl_lock); - FL_LOCK(fl); - fl->flags |= FL_DOOMED; - FL_UNLOCK(fl); - callout_stop(&sc->sfl_callout); - mtx_unlock(&sc->sfl_lock); + int i; + struct adapter *sc = vi->adapter; + struct sge_rxq *rxq; + struct sge_txq *txq; +#ifdef TCP_OFFLOAD + struct sge_ofld_rxq *ofld_rxq; +#endif +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + struct sge_ofld_txq *ofld_txq; +#endif + + if (!(vi->flags & VI_INIT_DONE)) + return; + + for_each_txq(vi, i, txq) { + quiesce_txq(txq); + } + +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + for_each_ofld_txq(vi, i, ofld_txq) { + quiesce_wrq(&ofld_txq->wrq); + } +#endif - KASSERT((fl->flags & FL_STARVING) == 0, - ("%s: still starving", __func__)); + for_each_rxq(vi, i, rxq) { + quiesce_iq_fl(sc, &rxq->iq, &rxq->fl); + } + +#ifdef TCP_OFFLOAD + for_each_ofld_rxq(vi, i, ofld_rxq) { + quiesce_iq_fl(sc, &ofld_rxq->iq, &ofld_rxq->fl); + } +#endif } static int @@ -11119,16 +11220,11 @@ toe_capability(struct vi_info *vi, bool enable) * and receive CPLs to/from the TOE even if the ifnet for this * port has never been UP'd administratively. */ - if (!(vi->flags & VI_INIT_DONE)) { - rc = vi_full_init(vi); - if (rc) - return (rc); - } - if (!(pi->vi[0].flags & VI_INIT_DONE)) { - rc = vi_full_init(&pi->vi[0]); - if (rc) - return (rc); - } + if (!(vi->flags & VI_INIT_DONE) && ((rc = vi_init(vi)) != 0)) + return (rc); + if (!(pi->vi[0].flags & VI_INIT_DONE) && + ((rc = vi_init(&pi->vi[0])) != 0)) + return (rc); if (isset(&sc->offload_map, pi->port_id)) { /* TOE is enabled on another VI of this port. */ @@ -11239,7 +11335,7 @@ t4_activate_uld(struct adapter *sc, int id) SLIST_FOREACH(ui, &t4_uld_list, link) { if (ui->uld_id == id) { if (!(sc->flags & FULL_INIT_DONE)) { - rc = adapter_full_init(sc); + rc = adapter_init(sc); if (rc != 0) break; } diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 6078dd89829d..8c5b9f500661 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -125,9 +125,10 @@ static int free_nm_txq_hwq(struct vi_info *, struct sge_nm_txq *); int alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, - int idx, struct sysctl_oid *oid) + int idx) { int rc; + struct sysctl_oid *oid; struct sysctl_oid_list *children; struct sysctl_ctx_list *ctx; char name[16]; @@ -161,7 +162,7 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; ctx = &vi->ctx; - children = SYSCTL_CHILDREN(oid); + children = SYSCTL_CHILDREN(vi->nm_rxq_oid); snprintf(name, sizeof(name), "%d", idx); oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, @@ -211,8 +212,7 @@ free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) } int -alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, - struct sysctl_oid *oid) +alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx) { int rc; size_t len; @@ -220,7 +220,8 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, struct adapter *sc = pi->adapter; struct netmap_adapter *na = NA(vi->ifp); char name[16]; - struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); + struct sysctl_oid *oid; + struct sysctl_oid_list *children = SYSCTL_CHILDREN(vi->nm_txq_oid); len = na->num_tx_desc * EQ_ESIZE + sc->params.sge.spg_len; rc = alloc_ring(sc, len, &nm_txq->desc_tag, &nm_txq->desc_map, diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index 99a157eca08c..0cb44e1d4ffb 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -296,8 +296,8 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) int rc, old_idx; uint32_t fw_mnem, fw_class; - if (!(txq->eq.flags & EQ_ALLOCATED)) - return (EAGAIN); + if (!(txq->eq.flags & EQ_HW_ALLOCATED)) + return (ENXIO); mtx_lock(&sc->tc_lock); if (txq->tc_idx == -2) { @@ -565,16 +565,13 @@ int sysctl_tc(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct port_info *pi; - struct adapter *sc; + struct adapter *sc = vi->adapter; struct sge_txq *txq; int qidx = arg2, rc, tc_idx; - MPASS(qidx >= 0 && qidx < vi->ntxq); - pi = vi->pi; - sc = pi->adapter; - txq = &sc->sge.txq[vi->first_txq + qidx]; + MPASS(qidx >= vi->first_txq && qidx < vi->first_txq + vi->ntxq); + txq = &sc->sge.txq[qidx]; tc_idx = txq->tc_idx; rc = sysctl_handle_int(oidp, &tc_idx, 0, req); if (rc != 0 || req->newptr == NULL) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index c09ba29213a1..2f6c7e2e7914 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -234,53 +234,66 @@ static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); static int eth_rx(struct adapter *, struct sge_rxq *, const struct iq_desc *, u_int); -static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); +static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int, + int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, char *); static inline void init_eq(struct adapter *, struct sge_eq *, int, int, uint8_t, - uint16_t, char *); + struct sge_iq *, char *); static int alloc_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *, - int, int); -static int free_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *); + struct sysctl_ctx_list *, struct sysctl_oid *); +static void free_iq_fl(struct adapter *, struct sge_iq *, struct sge_fl *); static void add_iq_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *, struct sge_iq *); static void add_fl_sysctls(struct adapter *, struct sysctl_ctx_list *, struct sysctl_oid *, struct sge_fl *); +static int alloc_iq_fl_hwq(struct vi_info *, struct sge_iq *, struct sge_fl *); +static int free_iq_fl_hwq(struct adapter *, struct sge_iq *, struct sge_fl *); static int alloc_fwq(struct adapter *); -static int free_fwq(struct adapter *); -static int alloc_ctrlq(struct adapter *, struct sge_wrq *, int, - struct sysctl_oid *); -static int alloc_rxq(struct vi_info *, struct sge_rxq *, int, int, - struct sysctl_oid *); -static int free_rxq(struct vi_info *, struct sge_rxq *); +static void free_fwq(struct adapter *); +static int alloc_ctrlq(struct adapter *, int); +static void free_ctrlq(struct adapter *, int); +static int alloc_rxq(struct vi_info *, struct sge_rxq *, int, int, int); +static void free_rxq(struct vi_info *, struct sge_rxq *); +static void add_rxq_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *, + struct sge_rxq *); #ifdef TCP_OFFLOAD static int alloc_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *, int, int, - struct sysctl_oid *); -static int free_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *); + int); +static void free_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *); +static void add_ofld_rxq_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *, + struct sge_ofld_rxq *); #endif static int ctrl_eq_alloc(struct adapter *, struct sge_eq *); static int eth_eq_alloc(struct adapter *, struct vi_info *, struct sge_eq *); #if defined(TCP_OFFLOAD) || defined(RATELIMIT) static int ofld_eq_alloc(struct adapter *, struct vi_info *, struct sge_eq *); #endif -static int alloc_eq(struct adapter *, struct vi_info *, struct sge_eq *); -static int free_eq(struct adapter *, struct sge_eq *); -static int alloc_wrq(struct adapter *, struct vi_info *, struct sge_wrq *, +static int alloc_eq(struct adapter *, struct sge_eq *, struct sysctl_ctx_list *, struct sysctl_oid *); -static int free_wrq(struct adapter *, struct sge_wrq *); -static int alloc_txq(struct vi_info *, struct sge_txq *, int, - struct sysctl_oid *); -static int free_txq(struct vi_info *, struct sge_txq *); +static void free_eq(struct adapter *, struct sge_eq *); +static void add_eq_sysctls(struct adapter *, struct sysctl_ctx_list *, + struct sysctl_oid *, struct sge_eq *); +static int alloc_eq_hwq(struct adapter *, struct vi_info *, struct sge_eq *); +static int free_eq_hwq(struct adapter *, struct vi_info *, struct sge_eq *); +static int alloc_wrq(struct adapter *, struct vi_info *, struct sge_wrq *, + struct sysctl_ctx_list *, struct sysctl_oid *); +static void free_wrq(struct adapter *, struct sge_wrq *); +static void add_wrq_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *, + struct sge_wrq *); *** 2021 LINES SKIPPED *** From nobody Wed Oct 20 14:07:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6325B17F6CF8; Wed, 20 Oct 2021 14:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZC902D0Rz4ryb; Wed, 20 Oct 2021 14:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BAA775F; Wed, 20 Oct 2021 14:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KE70Jh011418; Wed, 20 Oct 2021 14:07:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KE70p7011417; Wed, 20 Oct 2021 14:07:00 GMT (envelope-from git) Date: Wed, 20 Oct 2021 14:07:00 GMT Message-Id: <202110201407.19KE70p7011417@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 0d6f2ab194c7 - stable/13 - cxgbe(4): Add support for NIC suspend/resume and live reset. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0d6f2ab194c79443b8870bc7a82fa4b2e6954f0e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0d6f2ab194c79443b8870bc7a82fa4b2e6954f0e commit 0d6f2ab194c79443b8870bc7a82fa4b2e6954f0e Author: Navdeep Parhar AuthorDate: 2021-04-28 04:33:10 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 13:59:41 +0000 cxgbe(4): Add support for NIC suspend/resume and live reset. Add suspend/resume callbacks to the driver and a live reset built around them. This commit covers the basic NIC and future commits will expand this functionality to other stateful parts of the chip. Suspend and resume operate on the chip (the t?nex nexus device) and affect all its ports. It is not possible to suspend/resume or reset individual ports. All these operations can be performed on a running NIC. A reset will look like a link bounce to the networking stack. Here are some ways to exercise this functionality: /* Manual suspend and resume. */ # devctl suspend t6nex0 # devctl resume t6nex0 /* Manual reset. */ # devctl reset t6nex0 /* Manual reset with driver sysctl. */ # sysctl dev.t6nex.0.reset=1 /* Automatic adapter reset on any fatal error. */ # hw.cxgbe.reset_on_fatal_err=1 Suspend disables the adapter (DMA, interrupts, and the port PHYs) and marks the hardware as unavailable to the driver. All ifnets associated with the adapter are still visible to the kernel but operations that require hardware interaction will fail with ENXIO. All ifnets report link-down while the adapter is suspended. Resume will reattach to the card, reconfigure it as before, and recreate the queues servicing the existing ifnets. The ifnets are able to send and receive traffic as soon as the link comes back up. Reset is roughly the same as a suspend and a resume with at least one of these events in between: D0->D3Hot->D0, FLR, PCIe link retrain. (cherry picked from commit 83b5cda106a2dc0c8ace1718485c2ef05c5aa62b) --- sys/dev/cxgbe/adapter.h | 52 +- sys/dev/cxgbe/t4_clip.c | 2 +- sys/dev/cxgbe/t4_filter.c | 36 +- sys/dev/cxgbe/t4_main.c | 1586 +++++++++++++++++++++++++++++++++++++-------- sys/dev/cxgbe/t4_sched.c | 13 +- sys/dev/cxgbe/t4_tracer.c | 10 + 6 files changed, 1393 insertions(+), 306 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 8809a10269a1..2f4619b1180f 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -155,6 +155,7 @@ enum { IS_VF = (1 << 7), KERN_TLS_ON = (1 << 8), /* HW is configured for KERN_TLS */ CXGBE_BUSY = (1 << 9), + HW_OFF_LIMITS = (1 << 10), /* off limits to all except reset_thread */ /* port flags */ HAS_TRACEQ = (1 << 3), @@ -945,13 +946,26 @@ struct adapter { TAILQ_HEAD(, sge_fl) sfl; struct callout sfl_callout; - struct mtx reg_lock; /* for indirect register access */ + /* + * Driver code that can run when the adapter is suspended must use this + * lock or a synchronized_op and check for HW_OFF_LIMITS before + * accessing hardware. + * + * XXX: could be changed to rwlock. wlock in suspend/resume and for + * indirect register access, rlock everywhere else. + */ + struct mtx reg_lock; struct memwin memwin[NUM_MEMWIN]; /* memory windows */ struct mtx tc_lock; struct task tc_task; + struct task reset_task; + const void *reset_thread; + int num_resets; + int incarnation; + const char *last_op; const void *last_op_thr; int last_op_flags; @@ -1041,24 +1055,34 @@ forwarding_intr_to_fwq(struct adapter *sc) return (sc->intr_count == 1); } +/* Works reliably inside a sync_op or with reg_lock held. */ +static inline bool +hw_off_limits(struct adapter *sc) +{ + return (__predict_false(sc->flags & HW_OFF_LIMITS)); +} + static inline uint32_t t4_read_reg(struct adapter *sc, uint32_t reg) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); return bus_space_read_4(sc->bt, sc->bh, reg); } static inline void t4_write_reg(struct adapter *sc, uint32_t reg, uint32_t val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); bus_space_write_4(sc->bt, sc->bh, reg, val); } static inline uint64_t t4_read_reg64(struct adapter *sc, uint32_t reg) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); #ifdef __LP64__ return bus_space_read_8(sc->bt, sc->bh, reg); #else @@ -1071,7 +1095,8 @@ t4_read_reg64(struct adapter *sc, uint32_t reg) static inline void t4_write_reg64(struct adapter *sc, uint32_t reg, uint64_t val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); #ifdef __LP64__ bus_space_write_8(sc->bt, sc->bh, reg, val); #else @@ -1083,14 +1108,16 @@ t4_write_reg64(struct adapter *sc, uint32_t reg, uint64_t val) static inline void t4_os_pci_read_cfg1(struct adapter *sc, int reg, uint8_t *val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); *val = pci_read_config(sc->dev, reg, 1); } static inline void t4_os_pci_write_cfg1(struct adapter *sc, int reg, uint8_t val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); pci_write_config(sc->dev, reg, val, 1); } @@ -1098,27 +1125,32 @@ static inline void t4_os_pci_read_cfg2(struct adapter *sc, int reg, uint16_t *val) { + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); *val = pci_read_config(sc->dev, reg, 2); } static inline void t4_os_pci_write_cfg2(struct adapter *sc, int reg, uint16_t val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); pci_write_config(sc->dev, reg, val, 2); } static inline void t4_os_pci_read_cfg4(struct adapter *sc, int reg, uint32_t *val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); *val = pci_read_config(sc->dev, reg, 4); } static inline void t4_os_pci_write_cfg4(struct adapter *sc, int reg, uint32_t val) { - + if (hw_off_limits(sc)) + MPASS(curthread == sc->reset_thread); pci_write_config(sc->dev, reg, val, 4); } diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index f737c17eaaae..ad26d212315e 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -171,7 +171,7 @@ update_clip(struct adapter *sc, void *arg __unused) if (begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip")) return; - if (mtx_initialized(&sc->clip_table_lock)) + if (mtx_initialized(&sc->clip_table_lock) && !hw_off_limits(sc)) update_clip_table(sc); end_synchronized_op(sc, LOCK_HELD); diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index cddd2c96a620..3972111b4897 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -522,6 +522,11 @@ set_filter_mode(struct adapter *sc, uint32_t mode) if (rc) return (rc); + if (hw_off_limits(sc)) { + rc = ENXIO; + goto done; + } + if (sc->tids.ftids_in_use > 0 || /* TCAM filters active */ sc->tids.hpftids_in_use > 0 || /* hi-pri TCAM filters active */ sc->tids.tids_in_use > 0) { /* TOE or hashfilters active */ @@ -568,6 +573,11 @@ set_filter_mask(struct adapter *sc, uint32_t mode) if (rc) return (rc); + if (hw_off_limits(sc)) { + rc = ENXIO; + goto done; + } + if (sc->tids.tids_in_use > 0) { /* TOE or hashfilters active */ rc = EBUSY; goto done; @@ -589,20 +599,27 @@ static inline uint64_t get_filter_hits(struct adapter *sc, uint32_t tid) { uint32_t tcb_addr; + uint64_t hits; tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE) + tid * TCB_SIZE; - if (is_t4(sc)) { - uint64_t hits; + mtx_lock(&sc->reg_lock); + if (hw_off_limits(sc)) + hits = 0; + else if (is_t4(sc)) { + uint64_t t; - read_via_memwin(sc, 0, tcb_addr + 16, (uint32_t *)&hits, 8); - return (be64toh(hits)); + read_via_memwin(sc, 0, tcb_addr + 16, (uint32_t *)&t, 8); + hits = be64toh(t); } else { - uint32_t hits; + uint32_t t; - read_via_memwin(sc, 0, tcb_addr + 24, &hits, 4); - return (be32toh(hits)); + read_via_memwin(sc, 0, tcb_addr + 24, &t, 4); + hits = be32toh(t); } + mtx_unlock(&sc->reg_lock); + + return (hits); } int @@ -961,6 +978,11 @@ set_filter(struct adapter *sc, struct t4_filter *t) if (rc) return (rc); + if (hw_off_limits(sc)) { + rc = ENXIO; + goto done; + } + if (!(sc->flags & FULL_INIT_DONE) && ((rc = adapter_init(sc)) != 0)) goto done; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index e5c11402d9ab..1c22b0c8f124 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -100,12 +100,20 @@ static int t4_detach(device_t); static int t4_child_location_str(device_t, device_t, char *, size_t); static int t4_ready(device_t); static int t4_read_port_device(device_t, int, device_t *); +static int t4_suspend(device_t); +static int t4_resume(device_t); +static int t4_reset_prepare(device_t, device_t); +static int t4_reset_post(device_t, device_t); static device_method_t t4_methods[] = { DEVMETHOD(device_probe, t4_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(device_suspend, t4_suspend), + DEVMETHOD(device_resume, t4_resume), DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_reset_prepare, t4_reset_prepare), + DEVMETHOD(bus_reset_post, t4_reset_post), DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -165,8 +173,12 @@ static device_method_t t5_methods[] = { DEVMETHOD(device_probe, t5_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(device_suspend, t4_suspend), + DEVMETHOD(device_resume, t4_resume), DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_reset_prepare, t4_reset_prepare), + DEVMETHOD(bus_reset_post, t4_reset_post), DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -200,8 +212,12 @@ static device_method_t t6_methods[] = { DEVMETHOD(device_probe, t6_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(device_suspend, t4_suspend), + DEVMETHOD(device_resume, t4_resume), DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_reset_prepare, t4_reset_prepare), + DEVMETHOD(bus_reset_post, t4_reset_post), DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -596,6 +612,10 @@ static int t4_panic_on_fatal_err = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RWTUN, &t4_panic_on_fatal_err, 0, "panic on fatal errors"); +static int t4_reset_on_fatal_err = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, reset_on_fatal_err, CTLFLAG_RWTUN, + &t4_reset_on_fatal_err, 0, "reset adapter on fatal errors"); + static int t4_tx_vm_wr = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_vm_wr, CTLFLAG_RWTUN, &t4_tx_vm_wr, 0, "Use VM work requests to transmit packets."); @@ -794,6 +814,7 @@ static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); static int sysctl_cpus(SYSCTL_HANDLER_ARGS); +static int sysctl_reset(SYSCTL_HANDLER_ARGS); #ifdef TCP_OFFLOAD static int sysctl_tls(SYSCTL_HANDLER_ARGS); static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); @@ -829,6 +850,7 @@ static int notify_siblings(device_t, int); static uint64_t vi_get_counter(struct ifnet *, ift_counter); static uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); static void enable_vxlan_rx(struct adapter *); +static void reset_adapter(void *, int); struct { uint16_t device; @@ -1137,6 +1159,8 @@ t4_attach(device_t dev) refcount_init(&sc->vxlan_refcount, 0); + TASK_INIT(&sc->reset_task, 0, reset_adapter, sc); + sc->ctrlq_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, "ctrlq", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "control queues"); @@ -1785,6 +1809,572 @@ t4_detach_common(device_t dev) return (0); } +static inline bool +ok_to_reset(struct adapter *sc) +{ + struct tid_info *t = &sc->tids; + struct port_info *pi; + struct vi_info *vi; + int i, j; + const int caps = IFCAP_TOE | IFCAP_TXTLS | IFCAP_NETMAP | IFCAP_TXRTLMT; + + ASSERT_SYNCHRONIZED_OP(sc); + MPASS(!(sc->flags & IS_VF)); + + for_each_port(sc, i) { + pi = sc->port[i]; + for_each_vi(pi, j, vi) { + if (vi->ifp->if_capenable & caps) + return (false); + } + } + + if (atomic_load_int(&t->tids_in_use) > 0) + return (false); + if (atomic_load_int(&t->stids_in_use) > 0) + return (false); + if (atomic_load_int(&t->atids_in_use) > 0) + return (false); + if (atomic_load_int(&t->ftids_in_use) > 0) + return (false); + if (atomic_load_int(&t->hpftids_in_use) > 0) + return (false); + if (atomic_load_int(&t->etids_in_use) > 0) + return (false); + + return (true); +} + +static int +t4_suspend(device_t dev) +{ + struct adapter *sc = device_get_softc(dev); + struct port_info *pi; + struct vi_info *vi; + struct ifnet *ifp; + struct sge_rxq *rxq; + struct sge_txq *txq; + struct sge_wrq *wrq; +#ifdef TCP_OFFLOAD + struct sge_ofld_rxq *ofld_rxq; +#endif +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + struct sge_ofld_txq *ofld_txq; +#endif + int rc, i, j, k; + + CH_ALERT(sc, "suspend requested\n"); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK, "t4sus"); + if (rc != 0) + return (ENXIO); + + /* XXX: Can the kernel call suspend repeatedly without resume? */ + MPASS(!hw_off_limits(sc)); + + if (!ok_to_reset(sc)) { + /* XXX: should list what resource is preventing suspend. */ + CH_ERR(sc, "not safe to suspend.\n"); + rc = EBUSY; + goto done; + } + + /* No more DMA or interrupts. */ + t4_shutdown_adapter(sc); + + /* Quiesce all activity. */ + for_each_port(sc, i) { + pi = sc->port[i]; + pi->vxlan_tcam_entry = false; + + PORT_LOCK(pi); + if (pi->up_vis > 0) { + /* + * t4_shutdown_adapter has already shut down all the + * PHYs but it also disables interrupts and DMA so there + * won't be a link interrupt. So we update the state + * manually and inform the kernel. + */ + pi->link_cfg.link_ok = false; + t4_os_link_changed(pi); + } + PORT_UNLOCK(pi); + + for_each_vi(pi, j, vi) { + vi->xact_addr_filt = -1; + if (!(vi->flags & VI_INIT_DONE)) + continue; + + ifp = vi->ifp; + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + mtx_lock(&vi->tick_mtx); + vi->flags |= VI_SKIP_STATS; + callout_stop(&vi->tick); + mtx_unlock(&vi->tick_mtx); + callout_drain(&vi->tick); + } + + /* + * Note that the HW is not available. + */ + for_each_txq(vi, k, txq) { + TXQ_LOCK(txq); + txq->eq.flags &= ~(EQ_ENABLED | EQ_HW_ALLOCATED); + TXQ_UNLOCK(txq); + } +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + for_each_ofld_txq(vi, k, ofld_txq) { + ofld_txq->wrq.eq.flags &= ~EQ_HW_ALLOCATED; + } +#endif + for_each_rxq(vi, k, rxq) { + rxq->iq.flags &= ~IQ_HW_ALLOCATED; + } +#if defined(TCP_OFFLOAD) + for_each_ofld_rxq(vi, k, ofld_rxq) { + ofld_rxq->iq.flags &= ~IQ_HW_ALLOCATED; + } +#endif + + quiesce_vi(vi); + } + + if (sc->flags & FULL_INIT_DONE) { + /* Control queue */ + wrq = &sc->sge.ctrlq[i]; + wrq->eq.flags &= ~EQ_HW_ALLOCATED; + quiesce_wrq(wrq); + } + } + if (sc->flags & FULL_INIT_DONE) { + /* Firmware event queue */ + sc->sge.fwq.flags &= ~IQ_HW_ALLOCATED; + quiesce_iq_fl(sc, &sc->sge.fwq, NULL); + } + + /* Mark the adapter totally off limits. */ + mtx_lock(&sc->reg_lock); + sc->flags |= HW_OFF_LIMITS; + sc->flags &= ~(FW_OK | MASTER_PF); + sc->reset_thread = NULL; + mtx_unlock(&sc->reg_lock); + + sc->num_resets++; + CH_ALERT(sc, "suspend completed.\n"); +done: + end_synchronized_op(sc, 0); + return (rc); +} + +struct adapter_pre_reset_state { + u_int flags; + uint16_t nbmcaps; + uint16_t linkcaps; + uint16_t switchcaps; + uint16_t niccaps; + uint16_t toecaps; + uint16_t rdmacaps; + uint16_t cryptocaps; + uint16_t iscsicaps; + uint16_t fcoecaps; + + u_int cfcsum; + char cfg_file[32]; + + struct adapter_params params; + struct t4_virt_res vres; + struct tid_info tids; + struct sge sge; + + int rawf_base; + int nrawf; + +}; + +static void +save_caps_and_params(struct adapter *sc, struct adapter_pre_reset_state *o) +{ + + ASSERT_SYNCHRONIZED_OP(sc); + + o->flags = sc->flags; + + o->nbmcaps = sc->nbmcaps; + o->linkcaps = sc->linkcaps; + o->switchcaps = sc->switchcaps; + o->niccaps = sc->niccaps; + o->toecaps = sc->toecaps; + o->rdmacaps = sc->rdmacaps; + o->cryptocaps = sc->cryptocaps; + o->iscsicaps = sc->iscsicaps; + o->fcoecaps = sc->fcoecaps; + + o->cfcsum = sc->cfcsum; + MPASS(sizeof(o->cfg_file) == sizeof(sc->cfg_file)); + memcpy(o->cfg_file, sc->cfg_file, sizeof(o->cfg_file)); + + o->params = sc->params; + o->vres = sc->vres; + o->tids = sc->tids; + o->sge = sc->sge; + + o->rawf_base = sc->rawf_base; + o->nrawf = sc->nrawf; +} + +static int +compare_caps_and_params(struct adapter *sc, struct adapter_pre_reset_state *o) +{ + int rc = 0; + + ASSERT_SYNCHRONIZED_OP(sc); + + /* Capabilities */ +#define COMPARE_CAPS(c) do { \ + if (o->c##caps != sc->c##caps) { \ + CH_ERR(sc, "%scaps 0x%04x -> 0x%04x.\n", #c, o->c##caps, \ + sc->c##caps); \ + rc = EINVAL; \ + } \ +} while (0) + COMPARE_CAPS(nbm); + COMPARE_CAPS(link); + COMPARE_CAPS(switch); + COMPARE_CAPS(nic); + COMPARE_CAPS(toe); + COMPARE_CAPS(rdma); + COMPARE_CAPS(crypto); + COMPARE_CAPS(iscsi); + COMPARE_CAPS(fcoe); +#undef COMPARE_CAPS + + /* Firmware config file */ + if (o->cfcsum != sc->cfcsum) { + CH_ERR(sc, "config file %s (0x%x) -> %s (0x%x)\n", o->cfg_file, + o->cfcsum, sc->cfg_file, sc->cfcsum); + rc = EINVAL; + } + +#define COMPARE_PARAM(p, name) do { \ + if (o->p != sc->p) { \ + CH_ERR(sc, #name " %d -> %d\n", o->p, sc->p); \ + rc = EINVAL; \ + } \ +} while (0) + COMPARE_PARAM(sge.iq_start, iq_start); + COMPARE_PARAM(sge.eq_start, eq_start); + COMPARE_PARAM(tids.ftid_base, ftid_base); + COMPARE_PARAM(tids.ftid_end, ftid_end); + COMPARE_PARAM(tids.nftids, nftids); + COMPARE_PARAM(vres.l2t.start, l2t_start); + COMPARE_PARAM(vres.l2t.size, l2t_size); + COMPARE_PARAM(sge.iqmap_sz, iqmap_sz); + COMPARE_PARAM(sge.eqmap_sz, eqmap_sz); + COMPARE_PARAM(tids.tid_base, tid_base); + COMPARE_PARAM(tids.hpftid_base, hpftid_base); + COMPARE_PARAM(tids.hpftid_end, hpftid_end); + COMPARE_PARAM(tids.nhpftids, nhpftids); + COMPARE_PARAM(rawf_base, rawf_base); + COMPARE_PARAM(nrawf, nrawf); + COMPARE_PARAM(params.mps_bg_map, mps_bg_map); + COMPARE_PARAM(params.filter2_wr_support, filter2_wr_support); + COMPARE_PARAM(params.ulptx_memwrite_dsgl, ulptx_memwrite_dsgl); + COMPARE_PARAM(params.fr_nsmr_tpte_wr_support, fr_nsmr_tpte_wr_support); + COMPARE_PARAM(params.max_pkts_per_eth_tx_pkts_wr, max_pkts_per_eth_tx_pkts_wr); + COMPARE_PARAM(tids.ntids, ntids); + COMPARE_PARAM(tids.etid_base, etid_base); + COMPARE_PARAM(tids.etid_end, etid_end); + COMPARE_PARAM(tids.netids, netids); + COMPARE_PARAM(params.eo_wr_cred, eo_wr_cred); + COMPARE_PARAM(params.ethoffload, ethoffload); + COMPARE_PARAM(tids.natids, natids); + COMPARE_PARAM(tids.stid_base, stid_base); + COMPARE_PARAM(vres.ddp.start, ddp_start); + COMPARE_PARAM(vres.ddp.size, ddp_size); + COMPARE_PARAM(params.ofldq_wr_cred, ofldq_wr_cred); + COMPARE_PARAM(vres.stag.start, stag_start); + COMPARE_PARAM(vres.stag.size, stag_size); + COMPARE_PARAM(vres.rq.start, rq_start); + COMPARE_PARAM(vres.rq.size, rq_size); + COMPARE_PARAM(vres.pbl.start, pbl_start); + COMPARE_PARAM(vres.pbl.size, pbl_size); + COMPARE_PARAM(vres.qp.start, qp_start); + COMPARE_PARAM(vres.qp.size, qp_size); + COMPARE_PARAM(vres.cq.start, cq_start); + COMPARE_PARAM(vres.cq.size, cq_size); + COMPARE_PARAM(vres.ocq.start, ocq_start); + COMPARE_PARAM(vres.ocq.size, ocq_size); + COMPARE_PARAM(vres.srq.start, srq_start); + COMPARE_PARAM(vres.srq.size, srq_size); + COMPARE_PARAM(params.max_ordird_qp, max_ordird_qp); + COMPARE_PARAM(params.max_ird_adapter, max_ird_adapter); + COMPARE_PARAM(vres.iscsi.start, iscsi_start); + COMPARE_PARAM(vres.iscsi.size, iscsi_size); + COMPARE_PARAM(vres.key.start, key_start); + COMPARE_PARAM(vres.key.size, key_size); +#undef COMPARE_PARAM + + return (rc); +} + +static int +t4_resume(device_t dev) +{ + struct adapter *sc = device_get_softc(dev); + struct adapter_pre_reset_state *old_state = NULL; + struct port_info *pi; + struct vi_info *vi; + struct ifnet *ifp; + struct sge_txq *txq; + int rc, i, j, k; + + CH_ALERT(sc, "resume requested.\n"); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK, "t4res"); + if (rc != 0) + return (ENXIO); + MPASS(hw_off_limits(sc)); + MPASS((sc->flags & FW_OK) == 0); + MPASS((sc->flags & MASTER_PF) == 0); + MPASS(sc->reset_thread == NULL); + sc->reset_thread = curthread; + + /* Register access is expected to work by the time we're here. */ + if (t4_read_reg(sc, A_PL_WHOAMI) == 0xffffffff) { + CH_ERR(sc, "%s: can't read device registers\n", __func__); + rc = ENXIO; + goto done; + } + + /* Restore memory window. */ + setup_memwin(sc); + + /* Go no further if recovery mode has been requested. */ + if (TUNABLE_INT_FETCH("hw.cxgbe.sos", &i) && i != 0) { + CH_ALERT(sc, "recovery mode on resume.\n"); + rc = 0; + mtx_lock(&sc->reg_lock); + sc->flags &= ~HW_OFF_LIMITS; + mtx_unlock(&sc->reg_lock); + goto done; + } + + old_state = malloc(sizeof(*old_state), M_CXGBE, M_ZERO | M_WAITOK); + save_caps_and_params(sc, old_state); + + /* Reestablish contact with firmware and become the primary PF. */ + rc = contact_firmware(sc); + if (rc != 0) + goto done; /* error message displayed already */ + MPASS(sc->flags & FW_OK); + + if (sc->flags & MASTER_PF) { + rc = partition_resources(sc); + if (rc != 0) + goto done; /* error message displayed already */ + t4_intr_clear(sc); + } + + rc = get_params__post_init(sc); + if (rc != 0) + goto done; /* error message displayed already */ + + rc = set_params__post_init(sc); + if (rc != 0) + goto done; /* error message displayed already */ + + rc = compare_caps_and_params(sc, old_state); + if (rc != 0) + goto done; /* error message displayed already */ + + for_each_port(sc, i) { + pi = sc->port[i]; + MPASS(pi != NULL); + MPASS(pi->vi != NULL); + MPASS(pi->vi[0].dev == pi->dev); + + rc = -t4_port_init(sc, sc->mbox, sc->pf, 0, i); + if (rc != 0) { + CH_ERR(sc, + "failed to re-initialize port %d: %d\n", i, rc); + goto done; + } + MPASS(sc->chan_map[pi->tx_chan] == i); + + PORT_LOCK(pi); + fixup_link_config(pi); + build_medialist(pi); + PORT_UNLOCK(pi); + for_each_vi(pi, j, vi) { + if (IS_MAIN_VI(vi)) + continue; + rc = alloc_extra_vi(sc, pi, vi); + if (rc != 0) { + CH_ERR(vi, + "failed to re-allocate extra VI: %d\n", rc); + goto done; + } + } + } + + /* + * Interrupts and queues are about to be enabled and other threads will + * want to access the hardware too. It is safe to do so. Note that + * this thread is still in the middle of a synchronized_op. + */ + mtx_lock(&sc->reg_lock); + sc->flags &= ~HW_OFF_LIMITS; + mtx_unlock(&sc->reg_lock); + + if (sc->flags & FULL_INIT_DONE) { + rc = adapter_full_init(sc); + if (rc != 0) { + CH_ERR(sc, "failed to re-initialize adapter: %d\n", rc); + goto done; + } + + if (sc->vxlan_refcount > 0) + enable_vxlan_rx(sc); + + for_each_port(sc, i) { + pi = sc->port[i]; + for_each_vi(pi, j, vi) { + if (!(vi->flags & VI_INIT_DONE)) + continue; + rc = vi_full_init(vi); + if (rc != 0) { + CH_ERR(vi, "failed to re-initialize " + "interface: %d\n", rc); + goto done; + } + + ifp = vi->ifp; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + continue; + /* + * Note that we do not setup multicast addresses + * in the first pass. This ensures that the + * unicast DMACs for all VIs on all ports get an + * MPS TCAM entry. + */ + rc = update_mac_settings(ifp, XGMAC_ALL & + ~XGMAC_MCADDRS); + if (rc != 0) { + CH_ERR(vi, "failed to re-configure MAC: %d\n", rc); + goto done; + } + rc = -t4_enable_vi(sc, sc->mbox, vi->viid, true, + true); + if (rc != 0) { + CH_ERR(vi, "failed to re-enable VI: %d\n", rc); + goto done; + } + for_each_txq(vi, k, txq) { + TXQ_LOCK(txq); + txq->eq.flags |= EQ_ENABLED; + TXQ_UNLOCK(txq); + } + mtx_lock(&vi->tick_mtx); + vi->flags &= ~VI_SKIP_STATS; + callout_schedule(&vi->tick, hz); + mtx_unlock(&vi->tick_mtx); + } + PORT_LOCK(pi); + if (pi->up_vis > 0) { + t4_update_port_info(pi); + fixup_link_config(pi); + build_medialist(pi); + apply_link_config(pi); + if (pi->link_cfg.link_ok) + t4_os_link_changed(pi); + } + PORT_UNLOCK(pi); + } + + /* Now reprogram the L2 multicast addresses. */ + for_each_port(sc, i) { + pi = sc->port[i]; + for_each_vi(pi, j, vi) { + if (!(vi->flags & VI_INIT_DONE)) + continue; + ifp = vi->ifp; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + continue; + rc = update_mac_settings(ifp, XGMAC_MCADDRS); + if (rc != 0) { + CH_ERR(vi, "failed to re-configure MCAST MACs: %d\n", rc); + rc = 0; /* carry on */ + } + } + } + } +done: + if (rc == 0) { + sc->incarnation++; + CH_ALERT(sc, "resume completed.\n"); + } + end_synchronized_op(sc, 0); + free(old_state, M_CXGBE); + return (rc); +} + +static int +t4_reset_prepare(device_t dev, device_t child) +{ + struct adapter *sc = device_get_softc(dev); + + CH_ALERT(sc, "reset_prepare.\n"); + return (0); +} + +static int +t4_reset_post(device_t dev, device_t child) +{ + struct adapter *sc = device_get_softc(dev); + + CH_ALERT(sc, "reset_post.\n"); + return (0); +} + +static void +reset_adapter(void *arg, int pending) +{ + struct adapter *sc = arg; + int rc; + + CH_ALERT(sc, "reset requested.\n"); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK, "t4rst1"); + if (rc != 0) + return; + + if (hw_off_limits(sc)) { + CH_ERR(sc, "adapter is suspended, use resume (not reset).\n"); + rc = ENXIO; + goto done; + } + + if (!ok_to_reset(sc)) { + /* XXX: should list what resource is preventing reset. */ + CH_ERR(sc, "not safe to reset.\n"); + rc = EBUSY; + goto done; + } + +done: + end_synchronized_op(sc, 0); + if (rc != 0) + return; /* Error logged already. */ + + mtx_lock(&Giant); + rc = BUS_RESET_CHILD(device_get_parent(sc->dev), sc->dev, 0); + mtx_unlock(&Giant); + if (rc != 0) + CH_ERR(sc, "bus_reset_child failed: %d.\n", rc); + else + CH_ALERT(sc, "bus_reset_child succeeded.\n"); +} + static int cxgbe_probe(device_t dev) { @@ -2072,7 +2662,8 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) ifp->if_mtu = mtu; if (vi->flags & VI_INIT_DONE) { t4_update_fl_bufsize(ifp); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (!hw_off_limits(sc) && + ifp->if_drv_flags & IFF_DRV_RUNNING) rc = update_mac_settings(ifp, XGMAC_MTU); } end_synchronized_op(sc, 0); @@ -2083,6 +2674,11 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) if (rc) return (rc); + if (hw_off_limits(sc)) { + rc = ENXIO; + goto fail; + } + if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { flags = vi->if_flags; @@ -2106,7 +2702,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4multi"); if (rc) return (rc); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (!hw_off_limits(sc) && ifp->if_drv_flags & IFF_DRV_RUNNING) rc = update_mac_settings(ifp, XGMAC_MCADDRS); end_synchronized_op(sc, 0); break; @@ -2281,8 +2877,11 @@ fail: rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4i2c"); if (rc) return (rc); - rc = -t4_i2c_rd(sc, sc->mbox, pi->port_id, i2c.dev_addr, - i2c.offset, i2c.len, &i2c.data[0]); + if (hw_off_limits(sc)) *** 1771 LINES SKIPPED *** From nobody Wed Oct 20 14:11:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BC6AB17F7B72; Wed, 20 Oct 2021 14:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZCG350rwz4spk; Wed, 20 Oct 2021 14:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CA1DE9D; Wed, 20 Oct 2021 14:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KEBNdr024005; Wed, 20 Oct 2021 14:11:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KEBNKi024004; Wed, 20 Oct 2021 14:11:23 GMT (envelope-from git) Date: Wed, 20 Oct 2021 14:11:23 GMT Message-Id: <202110201411.19KEBNKi024004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: fed21efcfce4 - stable/13 - cxgbe(4): Fix build warnings with NOINET kernels. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fed21efcfce40fe2cbbc99322662f200f3532505 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fed21efcfce40fe2cbbc99322662f200f3532505 commit fed21efcfce40fe2cbbc99322662f200f3532505 Author: Navdeep Parhar AuthorDate: 2021-05-22 03:42:04 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 14:07:47 +0000 cxgbe(4): Fix build warnings with NOINET kernels. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26334 (cherry picked from commit ffbb373c5a95c37be693330a76a093fbcf546440) --- sys/dev/cxgbe/t4_sge.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 2f6c7e2e7914..44fef6dfc633 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -333,7 +333,9 @@ static void drain_wrq_wr_list(struct adapter *, struct sge_wrq *); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT +#if defined(INET) || defined(INET6) static inline u_int txpkt_eo_len16(u_int, u_int, u_int); +#endif static int ethofld_fw4_ack(struct sge_iq *, const struct rss_header *, struct mbuf *); #endif @@ -1497,12 +1499,14 @@ service_iq(struct sge_iq *iq, int budget) return (0); } +#if defined(INET) || defined(INET6) static inline int sort_before_lro(struct lro_ctrl *lro) { return (lro->lro_mbuf_max != 0); } +#endif static inline uint64_t last_flit_to_ns(struct adapter *sc, uint64_t lf) @@ -2311,6 +2315,7 @@ mbuf_eo_nsegs(struct mbuf *m) return (m->m_pkthdr.PH_loc.eight[1]); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_nsegs(struct mbuf *m, uint8_t nsegs) { @@ -2318,6 +2323,7 @@ set_mbuf_eo_nsegs(struct mbuf *m, uint8_t nsegs) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[1] = nsegs; } +#endif static inline int mbuf_eo_len16(struct mbuf *m) @@ -2331,6 +2337,7 @@ mbuf_eo_len16(struct mbuf *m) return (n); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_len16(struct mbuf *m, uint8_t len16) { @@ -2338,6 +2345,7 @@ set_mbuf_eo_len16(struct mbuf *m, uint8_t len16) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[2] = len16; } +#endif static inline int mbuf_eo_tsclk_tsoff(struct mbuf *m) @@ -2347,6 +2355,7 @@ mbuf_eo_tsclk_tsoff(struct mbuf *m) return (m->m_pkthdr.PH_loc.eight[3]); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_tsoff) { @@ -2354,6 +2363,7 @@ set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_tsoff) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[3] = tsclk_tsoff; } +#endif static inline int needs_eo(struct m_snd_tag *mst) @@ -2434,6 +2444,7 @@ needs_vxlan_tso(struct mbuf *m) (m->m_pkthdr.csum_flags & csum_flags) != CSUM_ENCAP_VXLAN); } +#if defined(INET) || defined(INET6) static inline bool needs_inner_tcp_csum(struct mbuf *m) { @@ -2443,6 +2454,7 @@ needs_inner_tcp_csum(struct mbuf *m) return (m->m_pkthdr.csum_flags & csum_flags); } +#endif static inline bool needs_l3_csum(struct mbuf *m) @@ -6393,6 +6405,7 @@ sysctl_bufsizes(SYSCTL_HANDLER_ARGS) } #ifdef RATELIMIT +#if defined(INET) || defined(INET6) /* * len16 for a txpkt WR with a GL. Includes the firmware work request header. */ @@ -6416,6 +6429,7 @@ txpkt_eo_len16(u_int nsegs, u_int immhdrs, u_int tso) done: return (howmany(n, 16)); } +#endif #define ETID_FLOWC_NPARAMS 6 #define ETID_FLOWC_LEN (roundup2((sizeof(struct fw_flowc_wr) + \ From nobody Wed Oct 20 15:59:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C04021802188; Wed, 20 Oct 2021 15:59:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZFgG4lvSz4T0F; Wed, 20 Oct 2021 15:59:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 10BA0B375; Wed, 20 Oct 2021 15:59:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 262717e270c3 - main - arswitch(4): Add new manpage To: Guangyuan Yang , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110200335.19K3ZdfS070860@gitrepo.freebsd.org> From: John Baldwin Message-ID: <35663cb8-bddb-e108-48f8-9d09a2b2345d@FreeBSD.org> Date: Wed, 20 Oct 2021 08:59:52 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110200335.19K3ZdfS070860@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/19/21 8:35 PM, Guangyuan Yang wrote: > The branch main has been updated by ygy (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=262717e270c3e8a28fa2937db750ba946be8c836 > > commit 262717e270c3e8a28fa2937db750ba946be8c836 > Author: Felix Johnson > AuthorDate: 2021-10-20 03:29:11 +0000 > Commit: Guangyuan Yang > CommitDate: 2021-10-20 03:35:04 +0000 > > arswitch(4): Add new manpage > > PR: 211668 > Reported by: O. Hartmann > Reviewed by: adrian, debdrup, imp > Differential Revision: https://reviews.freebsd.org/D32476 > --- > share/man/man4/arswitch.4 | 91 +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 91 insertions(+) Do you need to add this to the Makefile so it is installed? -- John Baldwin From nobody Wed Oct 20 16:01:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B72D5180236B; Wed, 20 Oct 2021 16:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZFhY4WL5z4TYm; Wed, 20 Oct 2021 16:01:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B02826BE; Wed, 20 Oct 2021 16:01:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KG11uh066974; Wed, 20 Oct 2021 16:01:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KG115r066973; Wed, 20 Oct 2021 16:01:01 GMT (envelope-from git) Date: Wed, 20 Oct 2021 16:01:01 GMT Message-Id: <202110201601.19KG115r066973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 2f022558ce3d - stable/12 - selsocket: handle sopoll() errors correctly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2f022558ce3d00eb53fd235dd87db780acd9bc25 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2f022558ce3d00eb53fd235dd87db780acd9bc25 commit 2f022558ce3d00eb53fd235dd87db780acd9bc25 Author: Brooks Davis AuthorDate: 2021-10-20 16:00:38 +0000 Commit: Brooks Davis CommitDate: 2021-10-20 16:00:38 +0000 selsocket: handle sopoll() errors correctly Without this change, unmounting smbfs filesystems with an INVARIANTS kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb. PR: 253079 Found by: markj Reviewed by: markj, jhb Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D32492 (cherry picked from commit 04c91ac48ad13ce0d1392cedbd69c2c0223d206f) --- sys/kern/sys_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index fcdd5604583e..0840456f582f 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1596,10 +1596,10 @@ selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td) */ for (;;) { selfdalloc(td, NULL); - error = sopoll(so, events, NULL, td); - /* error here is actually the ready events. */ - if (error) - return (0); + if (sopoll(so, events, NULL, td) != 0) { + error = 0; + break; + } error = seltdwait(td, asbt, precision); if (error) break; From nobody Wed Oct 20 17:11:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 79F15180400E; Wed, 20 Oct 2021 17:11:12 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHFX1xdlz4thR; Wed, 20 Oct 2021 17:11:12 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19KHB6GJ005593 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 20 Oct 2021 10:11:06 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19KHB5VO005592; Wed, 20 Oct 2021 10:11:05 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 20 Oct 2021 10:11:05 -0700 From: Gleb Smirnoff To: Emmanuel Vadot Cc: Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> X-Rspamd-Queue-Id: 4HZHFX1xdlz4thR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Emmanuel, On Wed, Oct 20, 2021 at 01:42:37PM +0200, Emmanuel Vadot wrote: E> Stop using POLA for "This is a change that I don't agree with". A change that just changes the system behaviour and nothing else, is a POLA violation. E> In the past weeks we had commits that changed mixer(8) cli in a E> non-backward compatible way and changed the root shell. For both you E> haven't complain so it means that either you don't care or you agree E> with those changes. Mixer and root shell weren't like your change. Mixer is a complete rewrite which has some technical background to justify it. Root shell is also different to what you did. It is not flip of a binary switch. E> I agree that the bell is clearly a user preference and also I could E> have left the review opened for more time (but I've been there and E> usually you have review/feedback the first day and after it's silent). E> I wish there was an easy way for developer (and community member) to E> create a poll for changes like that but we don't have one right now. E> Now based on the number of people who reviewed and the people who sent E> me private message to thanks me for this change I think that more E> people are annoyed by the bell than people who wants it and we want E> sane default that most users agrees on in base FreeBSD. If you don't E> agree with the defaults we have a way to change them. To me this looks like abuse of committer priveleges. I got commit bit, so I can change the defaults. Speaking of the bell itself. It is of course very annoying on some laptops, especially if the laptop is used by someone else, not you. But it is extremely useful when working in a loud server room on a console, reviving a crashed machine, usually in a very stressful environment. Gives feeling of machine being responsive or not being responsive. So it is more a question of server vs desktop default. Okay, let's ignore the biased opinion that FreeBSD is a server OS. But I would assert that vt(4) is a way more used on servers, rather than on laptops. If somebody is using vt(4) instead of X on a laptop, then this person is special. Either really impared, as Shawn suggested, or just a geek who hates GUI. In the latter case, they should tweak the configuration. -- Gleb Smirnoff From nobody Wed Oct 20 17:27:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5E592180C92E; Wed, 20 Oct 2021 17:27:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHbr2974z3GQg; Wed, 20 Oct 2021 17:27:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29C663BAE; Wed, 20 Oct 2021 17:27:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHR4k0080154; Wed, 20 Oct 2021 17:27:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHR4cL080153; Wed, 20 Oct 2021 17:27:04 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:27:04 GMT Message-Id: <202110201727.19KHR4cL080153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: ebf4e2da2c59 - stable/13 - cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ebf4e2da2c598e41656a187c4bf5cd547c6c4a65 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ebf4e2da2c598e41656a187c4bf5cd547c6c4a65 commit ebf4e2da2c598e41656a187c4bf5cd547c6c4a65 Author: Navdeep Parhar AuthorDate: 2021-05-23 21:58:29 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:05:02 +0000 cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. - Process the list of local IPs once instead of once per adapter. Add addresses from all VNETs to the driver's list but leave hardware updates for later when the global VNET/IFADDR list locks have been released. - Add address to the hardware table synchronously when a CLIP entry is requested for an address that's not already in there. - Provide ioctls that allow userspace tools to manage addresses in the CLIP table. - Add a knob (hw.cxgbe.clip_db_auto) that controls whether local IPs are automatically added to the CLIP table or not. Sponsored by: Chelsio Communications (cherry picked from commit 24b98f288d11750f2cdfbfe360be1c92a9c2ee1d) --- sys/dev/cxgbe/adapter.h | 16 +- sys/dev/cxgbe/crypto/t4_kern_tls.c | 4 +- sys/dev/cxgbe/t4_clip.c | 842 ++++++++++++++++++++++++++++--------- sys/dev/cxgbe/t4_clip.h | 15 +- sys/dev/cxgbe/t4_ioctl.h | 10 + sys/dev/cxgbe/t4_main.c | 37 ++ sys/dev/cxgbe/tom/t4_connect.c | 4 +- sys/dev/cxgbe/tom/t4_listen.c | 18 +- sys/dev/cxgbe/tom/t4_tom.c | 2 +- 9 files changed, 735 insertions(+), 213 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 2f4619b1180f..630e9c4ac1b9 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,15 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) +/* + * Same as LIST_HEAD from queue.h. This is to avoid conflict with LinuxKPI's + * LIST_HEAD when building iw_cxgbe. + */ +#define CXGBE_LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + #ifndef SYSCTL_ADD_UQUAD #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #define sysctl_handle_64 sysctl_handle_quad @@ -881,9 +891,11 @@ struct adapter { struct port_info *port[MAX_NPORTS]; uint8_t chan_map[MAX_NCHAN]; /* channel -> port */ - struct mtx clip_table_lock; - TAILQ_HEAD(, clip_entry) clip_table; + CXGBE_LIST_HEAD(, clip_entry) *clip_table; + TAILQ_HEAD(, clip_entry) clip_pending; /* these need hw update. */ + u_long clip_mask; int clip_gen; + struct timeout_task clip_task; void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t4_kern_tls.c index 957d0202fa3f..99d0d33cf128 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t4_kern_tls.c @@ -379,7 +379,7 @@ send_ktls_act_open_req(struct adapter *sc, struct vi_info *vi, isipv6 = (inp->inp_vflag & INP_IPV6) != 0; if (isipv6) { - tlsp->ce = t4_hold_lip(sc, &inp->in6p_laddr, NULL); + tlsp->ce = t4_get_clip_entry(sc, &inp->in6p_laddr, true); if (tlsp->ce == NULL) return (ENOENT); } @@ -2333,7 +2333,7 @@ cxgbe_tls_tag_free(struct m_snd_tag *mst) if (tlsp->tid >= 0) release_tid(sc, tlsp->tid, tlsp->ctrlq); if (tlsp->ce) - t4_release_lip(sc, tlsp->ce); + t4_release_clip_entry(sc, tlsp->ce); if (tlsp->tx_key_addr >= 0) free_keyid(tlsp, tlsp->tx_key_addr); diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index ad26d212315e..18d78a9e830b 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Chelsio Communications, Inc. + * Copyright (c) 2012-2021 Chelsio Communications, Inc. * All rights reserved. * Written by: Navdeep Parhar * @@ -50,112 +50,345 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "t4_clip.h" +/* + * Code to deal with the Compressed Local IPv6 (CLIP) table in the ASIC. + * + * The driver maintains a global CLIP database (clip_db) of IPv6 addresses and a + * per-adapter CLIP table (sc->clip_table) with entries that point to an IPv6 in + * the clip_db. All access is protected by a single global lock (clip_db_lock). + * The correct lock order is clip lock before synchronized op. + * + * By default (hw.cxgbe.clip_db_auto=1) all local IPv6 addresses are added to + * the db. Addresses are also added on-demand when the driver allocates an + * entry for a filter, TOE tid, etc. krn_ref counts the number of times an + * address appears in the system. adp_ref counts the number of adapters that + * have that address in their CLIP table. If both are 0 then the entry is + * evicted from the db. Consumers of the CLIP table entry (filters, TOE tids) + * are tracked in ce->refcount. Driver ioctls let external consumers add/remove + * addresses from the CLIP table. + */ + #if defined(INET6) -static int add_lip(struct adapter *, struct in6_addr *); -static int delete_lip(struct adapter *, struct in6_addr *); -static struct clip_entry *search_lip(struct adapter *, struct in6_addr *); -static void update_clip(struct adapter *, void *); -static void t4_clip_task(void *, int); -static void update_clip_table(struct adapter *); +struct clip_db_entry { + LIST_ENTRY(clip_db_entry) link; /* clip_db hash linkage */ + struct in6_addr lip; + u_int krn_ref; /* # of times this IP6 appears in list of all IP6 */ + u_int adp_ref; /* # of adapters with this IP6 in their CLIP */ + u_int tmp_ref; /* Used only during refresh */ +}; + +struct clip_entry { + LIST_ENTRY(clip_entry) link; /* clip_table hash linkage */ + TAILQ_ENTRY(clip_entry) plink; /* clip_pending linkage */ + struct clip_db_entry *cde; + int16_t clip_idx; /* index in the hw table */ + bool pending; /* in clip_pending list */ + int refcount; +}; -static int in6_ifaddr_gen; static eventhandler_tag ifaddr_evhandler; -static struct timeout_task clip_task; +static struct mtx clip_db_lock; +static LIST_HEAD(, clip_db_entry) *clip_db; +static u_long clip_db_mask; +static int clip_db_gen; +static struct task clip_db_task; + +static int add_lip(struct adapter *, struct in6_addr *, int16_t *); +static int del_lip(struct adapter *, struct in6_addr *); +static void t4_clip_db_task(void *, int); +static void t4_clip_task(void *, int); +static void update_clip_db(void); +static int update_sw_clip_table(struct adapter *); +static int update_hw_clip_table(struct adapter *); +static void update_clip_table(struct adapter *, void *); +static int sysctl_clip_db(SYSCTL_HANDLER_ARGS); +static int sysctl_clip_db_auto(SYSCTL_HANDLER_ARGS); +static struct clip_db_entry *lookup_clip_db_entry(struct in6_addr *, bool); +static struct clip_entry *lookup_clip_entry(struct adapter *, struct in6_addr *, + bool); + +SYSCTL_PROC(_hw_cxgbe, OID_AUTO, clip_db, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_clip_db, "A", + "CLIP database"); + +int t4_clip_db_auto = 1; +SYSCTL_PROC(_hw_cxgbe, OID_AUTO, clip_db_auto, CTLTYPE_INT | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, NULL, 0, sysctl_clip_db_auto, "I", + "Add local IPs to CLIP db automatically (0 = no, 1 = yes)"); + +static inline uint32_t +clip_hashfn(struct in6_addr *addr) +{ + return (fnv_32_buf(addr, sizeof(*addr), FNV1_32_INIT) & clip_db_mask); +} + +static inline struct clip_db_entry * +alloc_clip_db_entry(struct in6_addr *in6) +{ + struct clip_db_entry *cde; + + cde = malloc(sizeof(*cde), M_CXGBE, M_NOWAIT | M_ZERO); + if (__predict_true(cde != NULL)) + memcpy(&cde->lip, in6, sizeof(cde->lip)); + + return (cde); +} + +static inline struct clip_entry * +alloc_clip_entry(struct clip_db_entry *cde) +{ + struct clip_entry *ce; + + mtx_assert(&clip_db_lock, MA_OWNED); + + ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT | M_ZERO); + if (__predict_true(ce != NULL)) { + ce->cde = cde; + cde->adp_ref++; + ce->clip_idx = -1; + } + + return (ce); +} + +/* + * Look up the IP6 address in the CLIP db. If add is set then an entry for the + * IP6 will be added to the db. + */ +static struct clip_db_entry * +lookup_clip_db_entry(struct in6_addr *in6, bool add) +{ + struct clip_db_entry *cde; + const int bucket = clip_hashfn(in6); + + mtx_assert(&clip_db_lock, MA_OWNED); + + LIST_FOREACH(cde, &clip_db[bucket], link) { + if (IN6_ARE_ADDR_EQUAL(&cde->lip, in6)) + return (cde); + } + + /* Not found. Create a new entry if requested. */ + if (add) { + cde = alloc_clip_db_entry(in6); + if (cde != NULL) + LIST_INSERT_HEAD(&clip_db[bucket], cde, link); + } + + return (cde); +} + +/* + * Look up the IP6 address in the CLIP db. If add is set then an entry for the + * IP6 will be added to the db. + */ +static struct clip_entry * +lookup_clip_entry(struct adapter *sc, struct in6_addr *in6, bool add) +{ + struct clip_db_entry *cde; + struct clip_entry *ce; + const int bucket = clip_hashfn(in6); + + mtx_assert(&clip_db_lock, MA_OWNED); + + cde = lookup_clip_db_entry(in6, add); + if (cde == NULL) + return (NULL); + + LIST_FOREACH(ce, &sc->clip_table[bucket], link) { + if (ce->cde == cde) + return (ce); + } + + /* Not found. Create a new entry if requested. */ + if (add) { + ce = alloc_clip_entry(cde); + if (ce != NULL) { + LIST_INSERT_HEAD(&sc->clip_table[bucket], ce, link); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, plink); + ce->pending = true; + } + } + + return (ce); +} static int -add_lip(struct adapter *sc, struct in6_addr *lip) +add_lip(struct adapter *sc, struct in6_addr *lip, int16_t *idx) { - struct fw_clip_cmd c; + struct fw_clip_cmd c; + int rc; ASSERT_SYNCHRONIZED_OP(sc); - mtx_assert(&sc->clip_table_lock, MA_OWNED); - memset(&c, 0, sizeof(c)); + memset(&c, 0, sizeof(c)); c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE); - c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_ALLOC | FW_LEN16(c)); - c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; - c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; + c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_ALLOC | FW_LEN16(c)); + c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; + c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; - return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); + rc = -t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c); + if (rc == 0 && idx != NULL) + *idx = G_FW_CLIP_CMD_INDEX(ntohl(c.alloc_to_len16)); + return (rc); } static int -delete_lip(struct adapter *sc, struct in6_addr *lip) +del_lip(struct adapter *sc, struct in6_addr *lip) { struct fw_clip_cmd c; ASSERT_SYNCHRONIZED_OP(sc); - mtx_assert(&sc->clip_table_lock, MA_OWNED); memset(&c, 0, sizeof(c)); c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_READ); - c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_FREE | FW_LEN16(c)); - c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; - c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; + c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_FREE | FW_LEN16(c)); + c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; + c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); } +#endif -static struct clip_entry * -search_lip(struct adapter *sc, struct in6_addr *lip) +struct clip_entry * +t4_get_clip_entry(struct adapter *sc, struct in6_addr *in6, bool add) { +#ifdef INET6 struct clip_entry *ce; + bool schedule = false; - mtx_assert(&sc->clip_table_lock, MA_OWNED); - - TAILQ_FOREACH(ce, &sc->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - return (ce); + mtx_lock(&clip_db_lock); + ce = lookup_clip_entry(sc, in6, add); + if (ce != NULL) { + MPASS(ce->cde->adp_ref > 0); + if (++ce->refcount == 1 && ce->pending && ce->clip_idx != -1) { + /* + * Valid entry that was waiting to be deleted. It is in + * use now so take it off the pending list. + */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; + } + if (ce->clip_idx == -1 && update_hw_clip_table(sc) != 0) + schedule = true; } + mtx_unlock(&clip_db_lock); + if (schedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, 0); + return (ce); +#else return (NULL); -} #endif +} -struct clip_entry * -t4_hold_lip(struct adapter *sc, struct in6_addr *lip, struct clip_entry *ce) +void +t4_hold_clip_entry(struct adapter *sc, struct clip_entry *ce) { - #ifdef INET6 - mtx_lock(&sc->clip_table_lock); - if (ce == NULL) - ce = search_lip(sc, lip); - if (ce != NULL) - ce->refcount++; - mtx_unlock(&sc->clip_table_lock); + MPASS(ce != NULL); + MPASS(ce->cde->adp_ref > 0); - return (ce); -#else - return (NULL); + mtx_lock(&clip_db_lock); + MPASS(ce->refcount > 0); /* Caller should already have a reference */ + ce->refcount++; + mtx_unlock(&clip_db_lock); #endif } +#ifdef INET6 +static void +release_clip_entry_locked(struct adapter *sc, struct clip_entry *ce) +{ + struct clip_db_entry *cde; + + mtx_assert(&clip_db_lock, MA_OWNED); + MPASS(ce->refcount > 0); + cde = ce->cde; + MPASS(cde->adp_ref > 0); + if (--ce->refcount == 0 && cde->krn_ref == 0) { + if (ce->clip_idx == -1) { + /* Was never written to the hardware. */ + MPASS(ce->pending); + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } else { + /* + * Valid entry is now unused, add to the pending list + * for deletion. Its refcount was 1 on entry so it + * can't already be pending. + */ + MPASS(!ce->pending); + TAILQ_INSERT_HEAD(&sc->clip_pending, ce, plink); + ce->pending = true; + } + } +} +#endif + void -t4_release_lip(struct adapter *sc, struct clip_entry *ce) +t4_release_clip_entry(struct adapter *sc, struct clip_entry *ce) { +#ifdef INET6 + MPASS(ce != NULL); + + mtx_lock(&clip_db_lock); + release_clip_entry_locked(sc, ce); + /* + * This isn't a manual release via the ioctl. No need to update the + * hw right now even if the release resulted in the entry being queued + * for deletion. + */ + mtx_unlock(&clip_db_lock); +#endif +} +int +t4_release_clip_addr(struct adapter *sc, struct in6_addr *in6) +{ + int rc = ENOTSUP; #ifdef INET6 - mtx_lock(&sc->clip_table_lock); - KASSERT(search_lip(sc, &ce->lip) == ce, - ("%s: CLIP entry %p p not in CLIP table.", __func__, ce)); - KASSERT(ce->refcount > 0, - ("%s: CLIP entry %p has refcount 0", __func__, ce)); - --ce->refcount; - mtx_unlock(&sc->clip_table_lock); + struct clip_entry *ce; + bool schedule = false; + + mtx_lock(&clip_db_lock); + ce = lookup_clip_entry(sc, in6, false); + if (ce == NULL) + rc = ENOENT; + else if (ce->refcount == 0) + rc = EIO; + else { + release_clip_entry_locked(sc, ce); + if (update_hw_clip_table(sc) != 0) + schedule = true; + rc = 0; + } + mtx_unlock(&clip_db_lock); + if (schedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, 0); #endif + return (rc); } #ifdef INET6 void t4_init_clip_table(struct adapter *sc) { - - mtx_init(&sc->clip_table_lock, "CLIP table lock", NULL, MTX_DEF); - TAILQ_INIT(&sc->clip_table); + TAILQ_INIT(&sc->clip_pending); + TIMEOUT_TASK_INIT(taskqueue_thread, &sc->clip_task, 0, t4_clip_task, sc); sc->clip_gen = -1; + sc->clip_table = hashinit(CLIP_HASH_SIZE, M_CXGBE, &sc->clip_mask); + /* Both the hashes must use the same bucket for the same key. */ + if (sc->clip_table != NULL) + MPASS(sc->clip_mask == clip_db_mask); /* * Don't bother forcing an update of the clip table when the * adapter is initialized. Before an interface can be used it @@ -164,194 +397,344 @@ t4_init_clip_table(struct adapter *sc) */ } +/* + * Returns true if any additions or deletions were made to the CLIP DB. + */ static void -update_clip(struct adapter *sc, void *arg __unused) +update_clip_db(void) { + VNET_ITERATOR_DECL(vnet_iter); + struct rm_priotracker in6_ifa_tracker; + struct in6_addr *in6, tin6; + struct in6_ifaddr *ia; + struct clip_db_entry *cde, *cde_tmp; + int i, addel; - if (begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip")) - return; + VNET_LIST_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); + mtx_lock(&clip_db_lock); + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + if (ia->ia_ifp->if_flags & IFF_LOOPBACK) + continue; + in6 = &ia->ia_addr.sin6_addr; + KASSERT(!IN6_IS_ADDR_MULTICAST(in6), + ("%s: mcast address in in6_ifaddr list", __func__)); + if (IN6_IS_ADDR_LOOPBACK(in6)) + continue; - if (mtx_initialized(&sc->clip_table_lock) && !hw_off_limits(sc)) - update_clip_table(sc); + if (IN6_IS_SCOPE_EMBED(in6)) { + tin6 = *in6; + in6 = &tin6; + in6_clearscope(in6); + } + cde = lookup_clip_db_entry(in6, true); + if (cde == NULL) + continue; + cde->tmp_ref++; + } + CURVNET_RESTORE(); + } + + addel = 0; + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH_SAFE(cde, &clip_db[i], link, cde_tmp) { + if (cde->krn_ref == 0 && cde->tmp_ref > 0) { + addel++; /* IP6 addr added. */ + } else if (cde->krn_ref > 0 && cde->tmp_ref == 0) { + if (cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + continue; + } + addel++; /* IP6 addr deleted. */ + } + cde->krn_ref = cde->tmp_ref; + cde->tmp_ref = 0; + } + } + if (addel > 0) + clip_db_gen++; + mtx_unlock(&clip_db_lock); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + VNET_LIST_RUNLOCK(); - end_synchronized_op(sc, LOCK_HELD); } +/* + * Update the CLIP db and then update the CLIP tables on all the adapters. + */ static void -t4_clip_task(void *arg, int count) +t4_clip_db_task(void *arg, int count) { - - t4_iterate(update_clip, NULL); + update_clip_db(); + t4_iterate(update_clip_table, NULL); } -static void -update_clip_table(struct adapter *sc) +/* + * Refresh the sw CLIP table for this adapter from the global CLIP db. Entries + * that need to be added or deleted from the hardware CLIP table are placed on a + * pending list but the hardware is not touched. The pending list is something + * reasonable even if this fails so it's ok to apply that to the hardware. + */ +static int +update_sw_clip_table(struct adapter *sc) { - struct rm_priotracker in6_ifa_tracker; - struct in6_ifaddr *ia; - struct in6_addr *lip, tlip; - TAILQ_HEAD(, clip_entry) stale; + struct clip_db_entry *cde; struct clip_entry *ce, *ce_temp; - struct vi_info *vi; - int rc, gen, i, j; - uintptr_t last_vnet; - - ASSERT_SYNCHRONIZED_OP(sc); + int i; + bool found; - IN6_IFADDR_RLOCK(&in6_ifa_tracker); - mtx_lock(&sc->clip_table_lock); - - gen = atomic_load_acq_int(&in6_ifaddr_gen); - if (gen == sc->clip_gen) - goto done; - - TAILQ_INIT(&stale); - TAILQ_CONCAT(&stale, &sc->clip_table, link); + mtx_assert(&clip_db_lock, MA_OWNED); /* - * last_vnet optimizes the common cases where all if_vnet = NULL (no - * VIMAGE) or all if_vnet = vnet0. + * We are about to rebuild the pending list from scratch. Deletions are + * placed before additions because that's how we want to submit them to + * the hardware. */ - last_vnet = (uintptr_t)(-1); - for_each_port(sc, i) - for_each_vi(sc->port[i], j, vi) { - if (IS_DOOMED(vi)) - continue; - - if (last_vnet == (uintptr_t)vi->ifp->if_vnet) - continue; + TAILQ_INIT(&sc->clip_pending); - /* XXX: races with if_vmove */ - CURVNET_SET(vi->ifp->if_vnet); - CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { - lip = &ia->ia_addr.sin6_addr; - - KASSERT(!IN6_IS_ADDR_MULTICAST(lip), - ("%s: mcast address in in6_ifaddr list", __func__)); - - if (IN6_IS_ADDR_LOOPBACK(lip)) + /* + * Walk the sw CLIP table first. We want to reset every entry's pending + * status as we're rebuilding the pending list. + */ + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH_SAFE(ce, &sc->clip_table[i], link, ce_temp) { + cde = ce->cde; + MPASS(cde->adp_ref > 0); + if (ce->refcount != 0 || cde->krn_ref != 0) { + /* + * Entry should stay in the CLIP. + */ + + if (ce->clip_idx != -1) { + ce->pending = false; + } else { + /* Was never added, carry forward. */ + MPASS(ce->pending); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, + plink); + } continue; - if (IN6_IS_SCOPE_EMBED(lip)) { - /* Remove the embedded scope */ - tlip = *lip; - lip = &tlip; - in6_clearscope(lip); } - /* - * XXX: how to weed out the link local address for the - * loopback interface? It's fe80::1 usually (always?). - */ /* - * If it's in the main list then we already know it's - * not stale. + * Entry should be removed from the CLIP. */ - TAILQ_FOREACH(ce, &sc->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - goto next; - } - /* - * If it's in the stale list we should move it to the - * main list. - */ - TAILQ_FOREACH(ce, &stale, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { - TAILQ_REMOVE(&stale, ce, link); - TAILQ_INSERT_TAIL(&sc->clip_table, ce, - link); - goto next; + if (ce->clip_idx != -1) { + ce->pending = true; + TAILQ_INSERT_HEAD(&sc->clip_pending, ce, plink); + } else { + /* Was never added, free right now. */ + MPASS(ce->pending); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); } } + } + } + + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH(cde, &clip_db[i], link) { + if (cde->krn_ref == 0) + continue; - /* A new IP6 address; add it to the CLIP table */ - ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); - memcpy(&ce->lip, lip, sizeof(ce->lip)); - ce->refcount = 0; - rc = add_lip(sc, lip); - if (rc == 0) - TAILQ_INSERT_TAIL(&sc->clip_table, ce, link); - else { - char ip[INET6_ADDRSTRLEN]; - - inet_ntop(AF_INET6, &ce->lip, &ip[0], - sizeof(ip)); - if (sc->flags & KERN_TLS_ON || - sc->active_ulds != 0) { - log(LOG_ERR, - "%s: could not add %s (%d)\n", - __func__, ip, rc); + found = false; + LIST_FOREACH(ce, &sc->clip_table[i], link) { + if (ce->cde == cde) { + found = true; + break; } - free(ce, M_CXGBE); } -next: - continue; + if (found) + continue; + ce = alloc_clip_entry(cde); + if (ce == NULL) + return (ENOMEM); + LIST_INSERT_HEAD(&sc->clip_table[i], ce, link); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, plink); + ce->pending = true; } - CURVNET_RESTORE(); - last_vnet = (uintptr_t)vi->ifp->if_vnet; } - /* - * Remove stale addresses (those no longer in V_in6_ifaddrhead) that are - * no longer referenced by the driver. - */ - TAILQ_FOREACH_SAFE(ce, &stale, link, ce_temp) { - if (ce->refcount == 0) { - rc = delete_lip(sc, &ce->lip); - if (rc == 0) { - TAILQ_REMOVE(&stale, ce, link); + sc->clip_gen = clip_db_gen; + return (0); +} + +static int +update_hw_clip_table(struct adapter *sc) +{ + struct clip_db_entry *cde; + struct clip_entry *ce; + int rc; + char ip[INET6_ADDRSTRLEN]; + + mtx_assert(&clip_db_lock, MA_OWNED); + rc = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip"); + if (rc != 0) + return (rc); + if (hw_off_limits(sc)) + goto done; /* with rc = 0, we don't want to reschedule. */ + while (!TAILQ_EMPTY(&sc->clip_pending)) { + ce = TAILQ_FIRST(&sc->clip_pending); + MPASS(ce->pending); + cde = ce->cde; + MPASS(cde->adp_ref > 0); + + if (ce->clip_idx == -1) { + /* + * Entry was queued for addition to the HW CLIP. + */ + + if (ce->refcount == 0 && cde->krn_ref == 0) { + /* No need to add to HW CLIP. */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } } else { - char ip[INET6_ADDRSTRLEN]; + /* Add to the HW CLIP. */ + rc = add_lip(sc, &cde->lip, &ce->clip_idx); + if (rc == FW_ENOMEM) { + /* CLIP full, no point in retrying. */ + rc = 0; + goto done; + } + if (rc != 0) { + inet_ntop(AF_INET6, &cde->lip, &ip[0], + sizeof(ip)); + CH_ERR(sc, "add_lip(%s) failed: %d\n", + ip, rc); + goto done; + } + MPASS(ce->clip_idx != -1); + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; + } + } else { + /* + * Entry was queued for deletion from the HW CLIP. + */ - inet_ntop(AF_INET6, &ce->lip, &ip[0], - sizeof(ip)); - log(LOG_ERR, "%s: could not delete %s (%d)\n", - __func__, ip, rc); + if (ce->refcount == 0 && cde->krn_ref == 0) { + /* + * Delete from the HW CLIP. Delete should never + * fail so we always log an error. But if the + * failure is that the entry wasn't found in the + * CLIP then we carry on as if it was deleted. + */ + rc = del_lip(sc, &cde->lip); + if (rc != 0) + CH_ERR(sc, "del_lip(%s) failed: %d\n", + ip, rc); + if (rc == FW_EPROTO) + rc = 0; + if (rc != 0) + goto done; + + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } else { + /* No need to delete from HW CLIP. */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; } } } - /* The ones that are still referenced need to stay in the CLIP table */ - TAILQ_CONCAT(&sc->clip_table, &stale, link); - - sc->clip_gen = gen; done: - mtx_unlock(&sc->clip_table_lock); - IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + end_synchronized_op(sc, LOCK_HELD); + return (rc); +} + +static void +update_clip_table(struct adapter *sc, void *arg __unused) +{ + bool reschedule; + + if (sc->clip_table == NULL) + return; + + reschedule = false; + mtx_lock(&clip_db_lock); + if (sc->clip_gen != clip_db_gen && update_sw_clip_table(sc) != 0) + reschedule = true; + if (!TAILQ_EMPTY(&sc->clip_pending) && update_hw_clip_table(sc) != 0) + reschedule = true; + mtx_unlock(&clip_db_lock); + if (reschedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, + -hz / 4); +} + +/* + * Update the CLIP table of the specified adapter. + */ +static void +t4_clip_task(void *sc, int count) +{ + update_clip_table(sc, NULL); } void t4_destroy_clip_table(struct adapter *sc) { struct clip_entry *ce, *ce_temp; - - if (mtx_initialized(&sc->clip_table_lock)) { - mtx_lock(&sc->clip_table_lock); - TAILQ_FOREACH_SAFE(ce, &sc->clip_table, link, ce_temp) { - KASSERT(ce->refcount == 0, - ("%s: CLIP entry %p still in use (%d)", __func__, - ce, ce->refcount)); - TAILQ_REMOVE(&sc->clip_table, ce, link); + int i; + + mtx_lock(&clip_db_lock); + if (sc->clip_table == NULL) + goto done; /* CLIP was never initialized. */ + for (i = 0; i <= sc->clip_mask; i++) { + LIST_FOREACH_SAFE(ce, &sc->clip_table[i], link, ce_temp) { + MPASS(ce->refcount == 0); + MPASS(ce->cde->adp_ref > 0); #if 0 - delete_lip(sc, &ce->lip); + del_lip(sc, &ce->lip); #endif + LIST_REMOVE(ce, link); + if (--ce->cde->adp_ref == 0 && ce->cde->krn_ref == 0) { + LIST_REMOVE(ce->cde, link); + free(ce->cde, M_CXGBE); + } free(ce, M_CXGBE); } - mtx_unlock(&sc->clip_table_lock); - mtx_destroy(&sc->clip_table_lock); } + hashdestroy(&sc->clip_table, M_CXGBE, sc->clip_mask); + sc->clip_table = NULL; +done: + mtx_unlock(&clip_db_lock); } static void t4_ifaddr_event(void *arg __unused, struct ifnet *ifp, struct ifaddr *ifa, int event) { + struct in6_addr *in6; + if (t4_clip_db_auto == 0) + return; /* Automatic updates not allowed. */ if (ifa->ifa_addr->sa_family != AF_INET6) return; + if (ifp->if_flags & IFF_LOOPBACK) + return; + in6 = &((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr; + if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_MULTICAST(in6)) + return; - atomic_add_rel_int(&in6_ifaddr_gen, 1); - taskqueue_enqueue_timeout(taskqueue_thread, &clip_task, -hz / 4); + taskqueue_enqueue(taskqueue_thread, &clip_db_task); } *** 337 LINES SKIPPED *** From nobody Wed Oct 20 17:27:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B2795180C934; Wed, 20 Oct 2021 17:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHbs39Qdz3GVq; Wed, 20 Oct 2021 17:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 449A13ACA; Wed, 20 Oct 2021 17:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHR5Wm080178; Wed, 20 Oct 2021 17:27:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHR5cP080177; Wed, 20 Oct 2021 17:27:05 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:27:05 GMT Message-Id: <202110201727.19KHR5cP080177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: be259947759b - stable/13 - cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: be259947759be3c677e022ec314625812e7cb837 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=be259947759be3c677e022ec314625812e7cb837 commit be259947759be3c677e022ec314625812e7cb837 Author: Navdeep Parhar AuthorDate: 2021-05-23 23:28:31 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:12:37 +0000 cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table. Sponsored by: Chelsio Communications (cherry picked from commit ac02945f7e2b5ab84fe510fc052c35350e31220d) --- usr.sbin/cxgbetool/cxgbetool.8 | 30 ++++++++++++++- usr.sbin/cxgbetool/cxgbetool.c | 84 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/usr.sbin/cxgbetool/cxgbetool.8 b/usr.sbin/cxgbetool/cxgbetool.8 index 56980e42795f..02dc1a176eb0 100644 --- a/usr.sbin/cxgbetool/cxgbetool.8 +++ b/usr.sbin/cxgbetool/cxgbetool.8 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 21, 2018 +.Dd May 23, 2021 .Dt CXGBETOOL 8 .Os .Sh NAME @@ -46,6 +46,10 @@ .It .Nm Ar nexus Cm clearstats Ar port_id .It +.Nm Ar nexus Cm clip Bro Cm hold | release Brc Ar ipv6-address +.It +.Nm Ar nexus Cm clip Cm list +.It .Nm Ar nexus Cm context Bro Cm ingress | egress | fl | cong Brc Ar cntxt_id .It .Nm Ar nexus Cm hashfilter mode @@ -119,6 +123,30 @@ identifies a port within this range. .Pp .Bl -item -compact .It +.Cm clip hold Ar ipv6-address +.El +Install a reference on the given +.Ar ipv6-address +in the CLIP (Compressed Local IPv6) table. +The address is added to the CLIP table if it is not present there already. +.Pp +.Bl -item -compact +.It +.Cm clip list +.El +List the contents of the CLIP table. +.Pp +.Bl -item -compact +.It +.Cm clip release Ar ipv6-address +.El +Release a reference on the given +.Ar ipv6-address +in the CLIP table. +A reference on the address must have been acquired previously. +.Pp +.Bl -item -compact +.It .Cm context ingress Ar ingress_cntxt_id .It .Cm context cong Ar ingress_cntxt_id diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c index 139a0bd8e564..77f092123de9 100644 --- a/usr.sbin/cxgbetool/cxgbetool.c +++ b/usr.sbin/cxgbetool/cxgbetool.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -58,7 +59,8 @@ __FBSDID("$FreeBSD$"); #define max(x, y) ((x) > (y) ? (x) : (y)) static const char *progname, *nexus; -static int chip_id; /* 4 for T4, 5 for T5 */ +static int chip_id; /* 4 for T4, 5 for T5, and so on. */ +static int inst; /* instance of nexus device */ struct reg_info { const char *name; @@ -91,6 +93,8 @@ usage(FILE *fp) fprintf(fp, "Usage: %s [operation]\n", progname); fprintf(fp, "\tclearstats clear port statistics\n" + "\tclip hold|release hold/release an address\n" + "\tclip list list the CLIP table\n" "\tcontext show an SGE context\n" "\tdumpstate dump chip state\n" "\tfilter [ ] ... set a filter\n" @@ -3506,6 +3510,69 @@ load_offload_policy(int argc, const char *argv[]) return (rc); } +static int +display_clip(void) +{ + size_t clip_buf_size = 4096; + char *buf, name[32]; + int rc; + + buf = malloc(clip_buf_size); + if (buf == NULL) { + warn("%s", __func__); + return (errno); + } + + snprintf(name, sizeof(name), "dev.t%unex.%u.misc.clip", chip_id, inst); + rc = sysctlbyname(name, buf, &clip_buf_size, NULL, 0); + if (rc != 0) { + warn("sysctl %s", name); + free(buf); + return (errno); + } + + printf("%s\n", buf); + free(buf); + return (0); +} + +static int +clip_cmd(int argc, const char *argv[]) +{ + int rc, af = AF_INET6, add; + struct t4_clip_addr ca = {0}; + + if (argc == 1 && !strcmp(argv[0], "list")) { + rc = display_clip(); + return (rc); + } + + if (argc != 2) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + if (!strcmp(argv[0], "hold")) { + add = 1; + } else if (!strcmp(argv[0], "rel") || !strcmp(argv[0], "release")) { + add = 0; + } else { + warnx("first argument must be \"hold\" or \"release\""); + return (EINVAL); + } + + rc = parse_ipaddr(argv[0], argv, &af, &ca.addr[0], &ca.mask[0], 1); + if (rc != 0) + return (rc); + + if (add) + rc = doit(CHELSIO_T4_HOLD_CLIP_ADDR, &ca); + else + rc = doit(CHELSIO_T4_RELEASE_CLIP_ADDR, &ca); + + return (rc); +} + static int run_cmd(int argc, const char *argv[]) { @@ -3556,6 +3623,8 @@ run_cmd(int argc, const char *argv[]) rc = load_offload_policy(argc, argv); else if (!strcmp(cmd, "hashfilter")) rc = filter_cmd(argc, argv, 1); + else if (!strcmp(cmd, "clip")) + rc = clip_cmd(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); @@ -3609,6 +3678,16 @@ run_cmd_loop(void) return (rc); } +static void +parse_nexus_name(const char *s) +{ + char junk; + + if (sscanf(s, "t%unex%u%c", &chip_id, &inst, &junk) != 2) + errx(EINVAL, "invalid nexus \"%s\"", s); + nexus = s; +} + int main(int argc, const char *argv[]) { @@ -3628,8 +3707,7 @@ main(int argc, const char *argv[]) exit(EINVAL); } - nexus = argv[1]; - chip_id = nexus[1] - '0'; + parse_nexus_name(argv[1]); /* progname and nexus */ argc -= 2; From nobody Wed Oct 20 17:27:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 19147180C850; Wed, 20 Oct 2021 17:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHbt53mLz3GHl; Wed, 20 Oct 2021 17:27:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C0B93ACB; Wed, 20 Oct 2021 17:27:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHR6lM080207; Wed, 20 Oct 2021 17:27:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHR6Ue080206; Wed, 20 Oct 2021 17:27:06 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:27:06 GMT Message-Id: <202110201727.19KHR6Ue080206@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: b58fc654a9b4 - stable/13 - cxgbe(4): Use correct argument in call to hashdestroy. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b58fc654a9b4ec60bd6ec0116fd68b4237389a12 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=b58fc654a9b4ec60bd6ec0116fd68b4237389a12 commit b58fc654a9b4ec60bd6ec0116fd68b4237389a12 Author: Navdeep Parhar AuthorDate: 2021-05-27 04:32:13 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:16:18 +0000 cxgbe(4): Use correct argument in call to hashdestroy. This fixes a panic on driver module unload. Fixes: 24b98f288d11 cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. Sponsored by: Chelsio Communications (cherry picked from commit 740d722def71905dd74a622acce1561701ccbec6) --- sys/dev/cxgbe/t4_clip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index 18d78a9e830b..98734d6d11ce 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -712,7 +712,7 @@ t4_destroy_clip_table(struct adapter *sc) free(ce, M_CXGBE); } } - hashdestroy(&sc->clip_table, M_CXGBE, sc->clip_mask); + hashdestroy(sc->clip_table, M_CXGBE, sc->clip_mask); sc->clip_table = NULL; done: mtx_unlock(&clip_db_lock); @@ -856,7 +856,7 @@ t4_clip_modunload(void) { EVENTHANDLER_DEREGISTER(ifaddr_event_ext, ifaddr_evhandler); taskqueue_drain(taskqueue_thread, &clip_db_task); - hashdestroy(&clip_db, M_CXGBE, clip_db_mask); + hashdestroy(clip_db, M_CXGBE, clip_db_mask); mtx_destroy(&clip_db_lock); } #endif From nobody Wed Oct 20 17:27:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9C35A180CA3C; Wed, 20 Oct 2021 17:27:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHbw0gfnz3GF8; Wed, 20 Oct 2021 17:27:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 907323C0E; Wed, 20 Oct 2021 17:27:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHR7wM080233; Wed, 20 Oct 2021 17:27:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHR741080232; Wed, 20 Oct 2021 17:27:07 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:27:07 GMT Message-Id: <202110201727.19KHR741080232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 29d5f2c0ee06 - stable/13 - cxgbe(4): Empty the clib_db before trying to destroy it. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 29d5f2c0ee0610c3ddbdadb9fbf0fe2621484529 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=29d5f2c0ee0610c3ddbdadb9fbf0fe2621484529 commit 29d5f2c0ee0610c3ddbdadb9fbf0fe2621484529 Author: Navdeep Parhar AuthorDate: 2021-06-04 19:01:14 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:16:58 +0000 cxgbe(4): Empty the clib_db before trying to destroy it. This fixes a panic on driver unload. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit bb877c0620347eb86f25f4382c42d58685c348d4) --- sys/dev/cxgbe/t4_clip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index 98734d6d11ce..5f4fbd0f07a6 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -854,8 +854,21 @@ t4_clip_modload(void) void t4_clip_modunload(void) { + struct clip_db_entry *cde; + int i; + EVENTHANDLER_DEREGISTER(ifaddr_event_ext, ifaddr_evhandler); taskqueue_drain(taskqueue_thread, &clip_db_task); + mtx_lock(&clip_db_lock); + for (i = 0; i <= clip_db_mask; i++) { + while ((cde = LIST_FIRST(&clip_db[i])) != NULL) { + MPASS(cde->tmp_ref == 0); + MPASS(cde->adp_ref == 0); + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } + mtx_unlock(&clip_db_lock); hashdestroy(clip_db, M_CXGBE, clip_db_mask); mtx_destroy(&clip_db_lock); } From nobody Wed Oct 20 17:29:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 95640180E29D; Wed, 20 Oct 2021 17:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHf83Srlz3J5R; Wed, 20 Oct 2021 17:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5311B3BBD; Wed, 20 Oct 2021 17:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHT4H7080487; Wed, 20 Oct 2021 17:29:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHT4UE080486; Wed, 20 Oct 2021 17:29:04 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:29:04 GMT Message-Id: <202110201729.19KHT4UE080486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 1b3f407f7d43 - stable/13 - cxgbe(4): Fix an incorrect assert. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b3f407f7d437c272d0cb2d84260b5622733a110 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=1b3f407f7d437c272d0cb2d84260b5622733a110 commit 1b3f407f7d437c272d0cb2d84260b5622733a110 Author: Navdeep Parhar AuthorDate: 2021-05-27 02:18:42 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:27:28 +0000 cxgbe(4): Fix an incorrect assert. CTRL and OFLD tx queues do not have automatic tx credit flush enabled so it is okay for the cidx not to be the same as the pidx when the queue is destroyed. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 5ef87bf8b687575bee010967e23cd2c552b43ad9) --- sys/dev/cxgbe/t4_sge.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 44fef6dfc633..9d990253d7a0 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4317,7 +4317,8 @@ static void free_eq(struct adapter *sc, struct sge_eq *eq) { MPASS(eq->flags & EQ_SW_ALLOCATED); - MPASS(eq->pidx == eq->cidx); + if (eq->type == EQ_ETH) + MPASS(eq->pidx == eq->cidx); free_ring(sc, eq->desc_tag, eq->desc_map, eq->ba, eq->desc); mtx_destroy(&eq->eq_lock); @@ -4470,6 +4471,8 @@ free_wrq(struct adapter *sc, struct sge_wrq *wrq) { free_eq(sc, &wrq->eq); MPASS(wrq->nwr_pending == 0); + MPASS(TAILQ_EMPTY(&wrq->incomplete_wrs)); + MPASS(STAILQ_EMPTY(&wrq->wr_list)); bzero(wrq, sizeof(*wrq)); } From nobody Wed Oct 20 17:39:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 54A711812234; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtD1vj5z3LTc; Wed, 20 Oct 2021 17:39:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2280E3CA8; Wed, 20 Oct 2021 17:39:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdWqW094371; Wed, 20 Oct 2021 17:39:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdWVO094370; Wed, 20 Oct 2021 17:39:32 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:32 GMT Message-Id: <202110201739.19KHdWVO094370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: df667b59d76f - stable/13 - cxgb(4): Report proper TSO limits. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df667b59d76fefc9fafa3a02ed162c58e6aa5199 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=df667b59d76fefc9fafa3a02ed162c58e6aa5199 commit df667b59d76fefc9fafa3a02ed162c58e6aa5199 Author: Navdeep Parhar AuthorDate: 2021-06-04 20:30:28 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:29:45 +0000 cxgb(4): Report proper TSO limits. Sponsored by: Chelsio Communications (cherry picked from commit f13d72fd0b743a1fd97dd31f4abf19e8814c420b) --- sys/dev/cxgb/cxgb_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index ab835b0c1853..5c0bdd569fab 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -1042,6 +1042,9 @@ cxgb_port_attach(device_t dev) ifp->if_capenable = CXGB_CAP_ENABLE; ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_UDP_IPV6 | CSUM_TCP_IPV6; + ifp->if_hw_tsomax = IP_MAXPACKET; + ifp->if_hw_tsomaxsegcount = 36; + ifp->if_hw_tsomaxsegsize = 65536; /* * Disable TSO on 4-port - it isn't supported by the firmware. From nobody Wed Oct 20 17:39:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 197CA1812166; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtF559Lz3LnW; Wed, 20 Oct 2021 17:39:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D4B53C25; Wed, 20 Oct 2021 17:39:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdX9M094399; Wed, 20 Oct 2021 17:39:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdXZH094398; Wed, 20 Oct 2021 17:39:33 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:33 GMT Message-Id: <202110201739.19KHdXZH094398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 20cbc6676b87 - stable/13 - cxgbe(4): Update firmwares to 1.25.6.0. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 20cbc6676b87a00813b73676d9bcb390a41ce479 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=20cbc6676b87a00813b73676d9bcb390a41ce479 commit 20cbc6676b87a00813b73676d9bcb390a41ce479 Author: Navdeep Parhar AuthorDate: 2021-05-25 20:47:06 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:30:56 +0000 cxgbe(4): Update firmwares to 1.25.6.0. Changes since 1.25.0.0 are listed here. This list comes from the Release Notes for the "Chelsio Unified Wire v3.14.0.3 for Linux" release dated 2021-05-21. Fixes ----- BASE: - Fixed Back to back T6 100G-CR4 link coming up with NO FEC sometimes. - [T5] Try to bring up link in 1G speed if link doesn't come up on 10G. - Fixed a bug to not allow BaseR fec in 100G speed. - Fixed linkup issues on BT adapter in 1G and 100M speed. - Fixed an issue to allow driver to send VI_ENABLE multiple times (once with rx disable and then later rx enable). - Fixed rate limiting not working on class number 16 to 30. - Fixed backward compatibility issue in port type interpretation with vpd version 0x80. ETH: - Fixed a case when firmware failed to deliver NIC WR completion to host. - No rate limit support for WR ETH_TX_PKTS2 due to performance reasons. OFLD - Fixed a connection hang in SO adapters when tp_plen_max (set by driver) is more than the window size. - Added fw_filter_vnic_mode to firmware API file (t4fw_interface.h) - Use correct rx channel in coprocessor crypto completion (CPL_FW6_PLD). This was causing out of order completion to host. FOiSCSI - Fixed a crash due to unaligned access of ipv6 address. - Fixed a crash during lun reset. Enhancements ------------ ETH: - Rate limiting support added for encapsulated (vxlan, nvgre, geneve) NIC TCP packets. OFLD: - More than 128 SGLs supported in FW_RI_FR_NSMR_WR. Now, more than 16GB (upto 64GB) of PBLs can be written with single FW_RI_FR_NSMR_WR. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit e0fa04e257c1af4c793a70a124ba41e592570c14) --- sys/conf/files | 6 +++--- sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin | Bin 569856 -> 0 bytes sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin | Bin 0 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 23 +++++++++++++---------- sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin | Bin 673792 -> 0 bytes sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin | Bin 0 -> 675840 bytes sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin | Bin 731648 -> 0 bytes sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin | Bin 0 -> 730112 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 11 files changed, 19 insertions(+), 16 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 40bba75d4fbc..30f1a0940a8e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1523,7 +1523,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1557,7 +1557,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1591,7 +1591,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin deleted file mode 100644 index 075478fdf040..000000000000 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin new file mode 100644 index 000000000000..45e805198f59 Binary files /dev/null and b/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index 30a2e1760052..0f877cb5a045 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -4839,7 +4839,9 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_TCB_CACHE_FLUSH = 0x2D, FW_PARAMS_PARAM_DEV_FILTER = 0x2E, FW_PARAMS_PARAM_DEV_CLIP2_CMD = 0x2F, + FW_PARAMS_PARAM_DEV_DEV_512SGL_MR = 0x30, FW_PARAMS_PARAM_DEV_KTLS_HW = 0x31, + FW_PARAMS_PARAM_DEV_VI_ENABLE_INGRESS_AFTER_LINKUP = 0x32, }; /* @@ -4874,11 +4876,12 @@ enum fw_params_param_dev_diag { enum fw_params_param_dev_filter{ FW_PARAM_DEV_FILTER_VNIC_MODE = 0x00, FW_PARAM_DEV_FILTER_MODE_MASK = 0x01, +}; - /* VNIC modes */ - FW_VNIC_MODE_PF_VF = 0, - FW_VNIC_MODE_OUTER_VLAN = 1, - FW_VNIC_MODE_ENCAP_EN = 2, +enum fw_filter_vnic_mode { + FW_VNIC_MODE_PF_VF = 0, + FW_VNIC_MODE_OUTER_VLAN = 1, + FW_VNIC_MODE_ENCAP_EN = 2, }; enum fw_params_param_dev_ktls_hw { @@ -9989,18 +9992,18 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 25, - T4FW_VERSION_MICRO = 0, - T4FW_VERSION_BUILD = 40, + T4FW_VERSION_MICRO = 6, + T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 25, - T5FW_VERSION_MICRO = 0, - T5FW_VERSION_BUILD = 40, + T5FW_VERSION_MICRO = 6, + T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 25, - T6FW_VERSION_MICRO = 0, - T6FW_VERSION_BUILD = 40, + T6FW_VERSION_MICRO = 6, + T6FW_VERSION_BUILD = 0, }; enum { diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin deleted file mode 100644 index 1d115d65a1ba..000000000000 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin new file mode 100644 index 000000000000..6c2d1374c87a Binary files /dev/null and b/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin deleted file mode 100644 index acddb1cf8bfd..000000000000 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin new file mode 100644 index 000000000000..1cf05565ffff Binary files /dev/null and b/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index f5bc4830771b..48ac2766a560 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.0.40 +T4FW_VER= 1.25.6.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 89106cb4a497..3b54df8b222b 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.25.0.40 +T5FW_VER= 1.25.6.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index 071db2bab2dc..e7b39839b5e4 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.25.0.40 +T6FW_VER= 1.25.6.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From nobody Wed Oct 20 17:39:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A396B1812411; Wed, 20 Oct 2021 17:39:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtG6C9Sz3Lst; Wed, 20 Oct 2021 17:39:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ED5A3AF9; Wed, 20 Oct 2021 17:39:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdYO0094426; Wed, 20 Oct 2021 17:39:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdYiY094425; Wed, 20 Oct 2021 17:39:34 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:34 GMT Message-Id: <202110201739.19KHdYiY094425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: a27e3c20f6e4 - stable/13 - cxgbe(4): Check if the firmware supports 512 SGL per FR MR. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a27e3c20f6e4ce7b396c3f0dd1481313f6f629a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=a27e3c20f6e4ce7b396c3f0dd1481313f6f629a7 commit a27e3c20f6e4ce7b396c3f0dd1481313f6f629a7 Author: Navdeep Parhar AuthorDate: 2021-06-01 19:14:17 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:31:35 +0000 cxgbe(4): Check if the firmware supports 512 SGL per FR MR. Firmwares >= 1.25.6.0 support 512 SGL entries in a single memory registration request. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit db15dbf8801120241b7bfb6461341f2cb421ef8e) --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/t4_main.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 6264a7d6ec07..b803a7106a0c 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -405,6 +405,7 @@ struct adapter_params { bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ + bool dev_512sgl_mr; /* FW support for 512 SGL per FR MR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ unsigned int max_pkts_per_eth_tx_pkts_wr; }; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 2d33ba0ab95b..a9579ca874ec 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5222,6 +5222,14 @@ get_params__post_init(struct adapter *sc) else sc->params.fr_nsmr_tpte_wr_support = false; + /* Support for 512 SGL entries per FR MR. */ + param[0] = FW_PARAM_DEV(DEV_512SGL_MR); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.dev_512sgl_mr = val[0] != 0; + else + sc->params.dev_512sgl_mr = false; + param[0] = FW_PARAM_PFVF(MAX_PKTS_PER_ETH_TX_PKTS_WR); rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); if (rc == 0) From nobody Wed Oct 20 17:39:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 70E7A18122D0; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtJ6hhJz3LZY; Wed, 20 Oct 2021 17:39:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B45AE3EA4; Wed, 20 Oct 2021 17:39:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdZPv094450; Wed, 20 Oct 2021 17:39:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdZf9094449; Wed, 20 Oct 2021 17:39:35 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:35 GMT Message-Id: <202110201739.19KHdZf9094449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 0c65e339d8c7 - stable/13 - cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c65e339d8c74020024c276f8e9532e549085725 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0c65e339d8c74020024c276f8e9532e549085725 commit 0c65e339d8c74020024c276f8e9532e549085725 Author: Navdeep Parhar AuthorDate: 2021-06-01 19:57:53 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:32:18 +0000 cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration. Use the correct SGL limit within iw_cxgbe, firmwares >= 1.25.6.0 support upto 512 entries per MR. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit 211972cfb816f8da8b8a4c524b44dde4638c3288) --- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 8 ++++++++ sys/dev/cxgbe/iw_cxgbe/mem.c | 3 +-- sys/dev/cxgbe/iw_cxgbe/provider.c | 3 +-- sys/dev/cxgbe/iw_cxgbe/qp.c | 2 +- sys/dev/cxgbe/iw_cxgbe/t4.h | 7 ++----- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 1a717d6352c8..59ca38a96004 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -178,6 +178,14 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev) return (int)(rdev->adap->vres.stag.size >> 5); } +static inline int t4_max_fr_depth(struct c4iw_rdev *rdev, bool use_dsgl) +{ + if (rdev->adap->params.ulptx_memwrite_dsgl && use_dsgl) + return rdev->adap->params.dev_512sgl_mr ? T4_MAX_FR_FW_DSGL_DEPTH : T4_MAX_FR_DSGL_DEPTH; + else + return T4_MAX_FR_IMMD_DEPTH; +} + #define C4IW_WR_TO (60*HZ) struct c4iw_wr_wait { diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index 3f016c0cc0c1..dab812d58eec 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -624,8 +624,7 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, rhp = php->rhp; if (mr_type != IB_MR_TYPE_MEM_REG || - max_num_sg > t4_max_fr_depth( - rhp->rdev.adap->params.ulptx_memwrite_dsgl && use_dsgl)) + max_num_sg > t4_max_fr_depth(&rhp->rdev, use_dsgl)) return ERR_PTR(-EINVAL); mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); diff --git a/sys/dev/cxgbe/iw_cxgbe/provider.c b/sys/dev/cxgbe/iw_cxgbe/provider.c index 53106073d101..02a32fa4c1fc 100644 --- a/sys/dev/cxgbe/iw_cxgbe/provider.c +++ b/sys/dev/cxgbe/iw_cxgbe/provider.c @@ -348,8 +348,7 @@ c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *props, props->max_mr = c4iw_num_stags(&dev->rdev); props->max_pd = T4_MAX_NUM_PD; props->local_ca_ack_delay = 0; - props->max_fast_reg_page_list_len = - t4_max_fr_depth(sc->params.ulptx_memwrite_dsgl && use_dsgl); + props->max_fast_reg_page_list_len = t4_max_fr_depth(&dev->rdev, use_dsgl); return (0); } diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index eb314a6034c8..c1006109762c 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -714,7 +714,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, int pbllen = roundup(mhp->mpl_len * sizeof(u64), 32); int rem; - if (mhp->mpl_len > t4_max_fr_depth(use_dsgl && dsgl_supported)) + if (mhp->mpl_len > t4_max_fr_depth(&mhp->rhp->rdev, use_dsgl)) return -EINVAL; if (wr->mr->page_size > C4IW_MAX_PAGE_SIZE) return -EINVAL; diff --git a/sys/dev/cxgbe/iw_cxgbe/t4.h b/sys/dev/cxgbe/iw_cxgbe/t4.h index 70385b4ff6b6..88e7d6418615 100644 --- a/sys/dev/cxgbe/iw_cxgbe/t4.h +++ b/sys/dev/cxgbe/iw_cxgbe/t4.h @@ -103,11 +103,8 @@ struct t4_status_page { #define T4_MAX_FR_IMMD_DEPTH (T4_MAX_FR_IMMD / sizeof(u64)) #define T4_MAX_FR_DSGL 1024 #define T4_MAX_FR_DSGL_DEPTH (T4_MAX_FR_DSGL / sizeof(u64)) - -static inline int t4_max_fr_depth(int use_dsgl) -{ - return use_dsgl ? T4_MAX_FR_DSGL_DEPTH : T4_MAX_FR_IMMD_DEPTH; -} +#define T4_MAX_FR_FW_DSGL 4096 +#define T4_MAX_FR_FW_DSGL_DEPTH (T4_MAX_FR_FW_DSGL / sizeof(u64)) #define T4_RQ_NUM_SLOTS 2 #define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS) From nobody Wed Oct 20 17:39:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BD2E91812432; Wed, 20 Oct 2021 17:39:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtK47cHz3Lns; Wed, 20 Oct 2021 17:39:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAA2B39F5; Wed, 20 Oct 2021 17:39:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdaxt094474; Wed, 20 Oct 2021 17:39:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHda6v094473; Wed, 20 Oct 2021 17:39:36 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:36 GMT Message-Id: <202110201739.19KHda6v094473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: fa9e240fb06e - stable/13 - cxgbe(4): Get the number of usable traffic classes from the firmware. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa9e240fb06ef28b1dccef8d2ceb54cd908cbb9f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fa9e240fb06ef28b1dccef8d2ceb54cd908cbb9f commit fa9e240fb06ef28b1dccef8d2ceb54cd908cbb9f Author: Navdeep Parhar AuthorDate: 2021-06-22 05:07:56 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:33:02 +0000 cxgbe(4): Get the number of usable traffic classes from the firmware. Recent firmwares are able to utilize the traffic classes of tx channels that were previously unused. This effectively doubles the number of traffic classes available per port for 2 port cards. Stop using the raw per-channel value in the driver and ask the firmware for the number of usable traffic classes instead. Sponsored by: Chelsio Communications (cherry picked from commit 6beb67c7e0ad4c3f8277ed1122ef5efcde0a269c) --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/t4_main.c | 12 ++++++++++-- sys/dev/cxgbe/t4_sched.c | 28 ++++++++++++++-------------- sys/dev/cxgbe/tom/t4_cpl_io.c | 4 ++-- sys/dev/cxgbe/tom/t4_tom.c | 11 +++++------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index b803a7106a0c..c132cb779204 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -408,6 +408,7 @@ struct adapter_params { bool dev_512sgl_mr; /* FW support for 512 SGL per FR MR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ unsigned int max_pkts_per_eth_tx_pkts_wr; + uint8_t nsched_cls; /* # of usable sched classes per port */ }; #define CHELSIO_T4 0x4 diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index a9579ca874ec..09b4534b1b73 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5237,6 +5237,14 @@ get_params__post_init(struct adapter *sc) else sc->params.max_pkts_per_eth_tx_pkts_wr = 15; + param[0] = FW_PARAM_DEV(NUM_TM_CLASS); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) { + MPASS(val[0] > 0 && val[0] < 256); /* nsched_cls is 8b */ + sc->params.nsched_cls = val[0]; + } else + sc->params.nsched_cls = sc->chip_params->nsched_cls; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | @@ -7846,7 +7854,7 @@ cxgbe_sysctls(struct port_info *pi) SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "burstsize", CTLFLAG_RW, &pi->sched_params->burstsize, 0, "burstsize for per-flow cl-rl (0 means up to the driver)"); - for (i = 0; i < sc->chip_params->nsched_cls; i++) { + for (i = 0; i < sc->params.nsched_cls; i++) { struct tx_cl_rl_params *tc = &pi->sched_params->cl_rl[i]; snprintf(name, sizeof(name), "%d", i); @@ -11670,7 +11678,7 @@ error: if ((s->offload != 0 && s->offload != 1) || s->cong_algo < -1 || s->cong_algo > CONG_ALG_HIGHSPEED || s->sched_class < -1 || - s->sched_class >= sc->chip_params->nsched_cls) { + s->sched_class >= sc->params.nsched_cls) { rc = EINVAL; goto error; } diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index b320ff4a7c68..827add3c27ec 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -171,7 +171,7 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, */ if (p->cl < 0) return (EINVAL); - if (!in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) + if (!in_range(p->cl, 0, sc->params.nsched_cls - 1)) return (ERANGE); } @@ -243,7 +243,7 @@ update_tx_sched(void *context, int pending) struct port_info *pi; struct tx_cl_rl_params *tc; struct adapter *sc = context; - const int n = sc->chip_params->nsched_cls; + const int n = sc->params.nsched_cls; mtx_lock(&sc->tc_lock); for_each_port(sc, i) { @@ -373,7 +373,7 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) txq->tc_idx = old_idx; } done: - MPASS(txq->tc_idx >= -1 && txq->tc_idx < sc->chip_params->nsched_cls); + MPASS(txq->tc_idx >= -1 && txq->tc_idx < sc->params.nsched_cls); mtx_unlock(&sc->tc_lock); return (rc); } @@ -402,7 +402,7 @@ t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) MPASS(vi->ntxq > 0); if (!in_range(p->queue, 0, vi->ntxq - 1) || - !in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) + !in_range(p->cl, 0, sc->params.nsched_cls - 1)) return (EINVAL); if (p->queue < 0) { @@ -431,7 +431,7 @@ int t4_init_tx_sched(struct adapter *sc) { int i, j; - const int n = sc->chip_params->nsched_cls; + const int n = sc->params.nsched_cls; struct port_info *pi; struct tx_cl_rl_params *tc; @@ -507,7 +507,7 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, update = false; mtx_lock(&sc->tc_lock); - for (i = 0; i < sc->chip_params->nsched_cls; i++, tc++) { + for (i = 0; i < sc->params.nsched_cls; i++, tc++) { if (fa < 0 && tc->refcount == 0 && !(tc->flags & CLRL_USER)) fa = i; /* first available */ @@ -526,7 +526,7 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, } } /* Not found */ - MPASS(i == sc->chip_params->nsched_cls); + MPASS(i == sc->params.nsched_cls); if (fa != -1) { tc = &pi->sched_params->cl_rl[fa]; tc->refcount = 1; @@ -557,7 +557,7 @@ t4_release_cl_rl(struct adapter *sc, int port_id, int tc_idx) struct tx_cl_rl_params *tc; MPASS(port_id >= 0 && port_id < sc->params.nports); - MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); + MPASS(tc_idx >= 0 && tc_idx < sc->params.nsched_cls); mtx_lock(&sc->tc_lock); tc = &sc->port[port_id]->sched_params->cl_rl[tc_idx]; @@ -584,7 +584,7 @@ sysctl_tc(SYSCTL_HANDLER_ARGS) if (sc->flags & IS_VF) return (EPERM); - if (!in_range(tc_idx, 0, sc->chip_params->nsched_cls - 1)) + if (!in_range(tc_idx, 0, sc->params.nsched_cls - 1)) return (EINVAL); return (bind_txq_to_traffic_class(sc, txq, tc_idx)); @@ -610,7 +610,7 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) MPASS(port_id < sc->params.nports); MPASS(sc->port[port_id] != NULL); i = arg2 & 0xffff; - MPASS(i < sc->chip_params->nsched_cls); + MPASS(i < sc->params.nsched_cls); mtx_lock(&sc->tc_lock); tc = sc->port[port_id]->sched_params->cl_rl[i]; @@ -772,7 +772,7 @@ cxgbe_rate_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); if (rc != 0) return (rc); - MPASS(schedcl >= 0 && schedcl < sc->chip_params->nsched_cls); + MPASS(schedcl >= 0 && schedcl < sc->params.nsched_cls); cst = malloc(sizeof(*cst), M_CXGBE, M_ZERO | M_NOWAIT); if (cst == NULL) { @@ -823,7 +823,7 @@ cxgbe_rate_tag_modify(struct m_snd_tag *mst, struct adapter *sc = cst->adapter; /* XXX: is schedcl -1 ok here? */ - MPASS(cst->schedcl >= 0 && cst->schedcl < sc->chip_params->nsched_cls); + MPASS(cst->schedcl >= 0 && cst->schedcl < sc->params.nsched_cls); mtx_lock(&cst->lock); MPASS(cst->flags & EO_SND_TAG_REF); @@ -831,7 +831,7 @@ cxgbe_rate_tag_modify(struct m_snd_tag *mst, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); if (rc != 0) return (rc); - MPASS(schedcl >= 0 && schedcl < sc->chip_params->nsched_cls); + MPASS(schedcl >= 0 && schedcl < sc->params.nsched_cls); t4_release_cl_rl(sc, cst->port_id, cst->schedcl); cst->schedcl = schedcl; cst->max_rate = params->rate_limit.max_rate; @@ -919,7 +919,7 @@ cxgbe_ratelimit_query(struct ifnet *ifp, struct if_ratelimit_query_results *q) * the card's cclk. */ q->max_flows = sc->tids.netids; - q->number_of_rates = sc->chip_params->nsched_cls; + q->number_of_rates = sc->params.nsched_cls; q->min_segment_burst = 4; /* matches PKTSCHED_BURST in the firmware. */ #if 1 diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index b0b6b6877de6..9168547494f1 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -102,7 +102,7 @@ send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) nparams++; if (toep->params.tc_idx != -1) { MPASS(toep->params.tc_idx >= 0 && - toep->params.tc_idx < sc->chip_params->nsched_cls); + toep->params.tc_idx < sc->params.nsched_cls); nparams++; } @@ -189,7 +189,7 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb *toep, u_int Bps) rc = t4_reserve_cl_rl_kbps(sc, port_id, kbps, &tc_idx); if (rc != 0) return (rc); - MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); + MPASS(tc_idx >= 0 && tc_idx < sc->params.nsched_cls); } if (toep->params.tc_idx != tc_idx) { diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index cccaa6b1cc0d..d4a995a5559a 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -167,7 +167,7 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) struct adapter *sc = pi->adapter; struct tx_cl_rl_params *tc; - if (cp->tc_idx >= 0 && cp->tc_idx < sc->chip_params->nsched_cls) { + if (cp->tc_idx >= 0 && cp->tc_idx < sc->params.nsched_cls) { tc = &pi->sched_params->cl_rl[cp->tc_idx]; mtx_lock(&sc->tc_lock); if (tc->flags & CLRL_ERR) { @@ -1153,11 +1153,10 @@ init_conn_params(struct vi_info *vi , struct offload_settings *s, } /* Tx traffic scheduling class. */ - if (s->sched_class >= 0 && - s->sched_class < sc->chip_params->nsched_cls) { - cp->tc_idx = s->sched_class; - } else - cp->tc_idx = -1; + if (s->sched_class >= 0 && s->sched_class < sc->params.nsched_cls) + cp->tc_idx = s->sched_class; + else + cp->tc_idx = -1; /* Nagle's algorithm. */ if (s->nagle >= 0) From nobody Wed Oct 20 17:39:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 54F6518122E3; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtL40nMz3Lqb; Wed, 20 Oct 2021 17:39:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E40903F0E; Wed, 20 Oct 2021 17:39:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHdbEg094498; Wed, 20 Oct 2021 17:39:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdbt9094497; Wed, 20 Oct 2021 17:39:37 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:37 GMT Message-Id: <202110201739.19KHdbt9094497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: f7b50d986cb5 - stable/13 - cxgbe(4): Do not configure traffic classes automatically on attach. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f7b50d986cb5a34757b1f636d90b543b6556ed95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=f7b50d986cb5a34757b1f636d90b543b6556ed95 commit f7b50d986cb5a34757b1f636d90b543b6556ed95 Author: Navdeep Parhar AuthorDate: 2021-06-24 20:05:57 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:35:14 +0000 cxgbe(4): Do not configure traffic classes automatically on attach. The driver used to configure all available classes with some default parameters on attach and the rest of t4_sched.c was written with the assumption that all traffic classes are always valid in the hardware. But this resulted in a lot of informational messages being logged in the firmware's circular log, crowding out other more useful messages. This change leaves the tx scheduler alone during attach to reduce the spam in the devlog. The state of every class is now tracked separately from its flags and there is support for an 'uninitialized' state. Sponsored by: Chelsio Communications (cherry picked from commit ec8004dd419d8c8acfc9025dd050f141c949d53a) --- sys/dev/cxgbe/adapter.h | 16 ++++-- sys/dev/cxgbe/t4_main.c | 4 +- sys/dev/cxgbe/t4_sched.c | 135 +++++++++++++++++++++++++++------------------ sys/dev/cxgbe/tom/t4_tom.c | 9 ++- 4 files changed, 101 insertions(+), 63 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 630e9c4ac1b9..a394e8f11017 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -258,14 +258,22 @@ struct tx_ch_rl_params { uint32_t maxrate; }; +/* CLRL state */ +enum clrl_state { + CS_UNINITIALIZED = 0, + CS_PARAMS_SET, /* sw parameters have been set. */ + CS_HW_UPDATE_REQUESTED, /* async HW update requested. */ + CS_HW_UPDATE_IN_PROGRESS, /* sync hw update in progress. */ + CS_HW_CONFIGURED /* configured in the hardware. */ +}; + +/* CLRL flags */ enum { - CLRL_USER = (1 << 0), /* allocated manually. */ - CLRL_SYNC = (1 << 1), /* sync hw update in progress. */ - CLRL_ASYNC = (1 << 2), /* async hw update requested. */ - CLRL_ERR = (1 << 3), /* last hw setup ended in error. */ + CF_USER = (1 << 0), /* was configured by driver ioctl. */ }; struct tx_cl_rl_params { + enum clrl_state state; int refcount; uint8_t flags; enum fw_sched_params_rate ratemode; /* %port REL or ABS value */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 09b4534b1b73..2fa54909aa5a 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7784,7 +7784,7 @@ cxgbe_sysctls(struct port_info *pi) struct adapter *sc = pi->adapter; int i; char name[16]; - static char *tc_flags = {"\20\1USER\2SYNC\3ASYNC\4ERR"}; + static char *tc_flags = {"\20\1USER"}; ctx = device_get_sysctl_ctx(pi->dev); @@ -7861,6 +7861,8 @@ cxgbe_sysctls(struct port_info *pi) children2 = SYSCTL_CHILDREN(SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "traffic class")); + SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "state", + CTLFLAG_RD, &tc->state, 0, "current state"); SYSCTL_ADD_PROC(ctx, children2, OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, tc_flags, (uintptr_t)&tc->flags, sysctl_bitfield_8b, "A", "flags"); diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index 827add3c27ec..b19e62474bbb 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -185,17 +185,19 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (p->level == SCHED_CLASS_LEVEL_CL_RL) { tc = &pi->sched_params->cl_rl[p->cl]; mtx_lock(&sc->tc_lock); - if (tc->refcount > 0 || tc->flags & (CLRL_SYNC | CLRL_ASYNC)) + if (tc->refcount > 0 || tc->state == CS_HW_UPDATE_IN_PROGRESS) rc = EBUSY; else { - tc->flags |= CLRL_SYNC | CLRL_USER; + old = *tc; + + tc->flags |= CF_USER; + tc->state = CS_HW_UPDATE_IN_PROGRESS; tc->ratemode = fw_ratemode; tc->rateunit = fw_rateunit; tc->mode = fw_mode; tc->maxrate = p->maxrate; tc->pktsize = p->pktsize; rc = 0; - old= *tc; } mtx_unlock(&sc->tc_lock); if (rc != 0) @@ -207,6 +209,9 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (rc != 0) { if (p->level == SCHED_CLASS_LEVEL_CL_RL) { mtx_lock(&sc->tc_lock); + MPASS(tc->refcount == 0); + MPASS(tc->flags & CF_USER); + MPASS(tc->state == CS_HW_UPDATE_IN_PROGRESS); *tc = old; mtx_unlock(&sc->tc_lock); } @@ -221,15 +226,23 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (p->level == SCHED_CLASS_LEVEL_CL_RL) { mtx_lock(&sc->tc_lock); - MPASS(tc->flags & CLRL_SYNC); - MPASS(tc->flags & CLRL_USER); MPASS(tc->refcount == 0); + MPASS(tc->flags & CF_USER); + MPASS(tc->state == CS_HW_UPDATE_IN_PROGRESS); - tc->flags &= ~CLRL_SYNC; if (rc == 0) - tc->flags &= ~CLRL_ERR; - else - tc->flags |= CLRL_ERR; + tc->state = CS_HW_CONFIGURED; + else { + /* parameters failed so we don't park at params_set */ + tc->state = CS_UNINITIALIZED; + tc->flags &= ~CF_USER; + CH_ERR(pi, "failed to configure traffic class %d: %d. " + "params: mode %d, rateunit %d, ratemode %d, " + "channel %d, minrate %d, maxrate %d, pktsize %d, " + "burstsize %d\n", p->cl, rc, fw_mode, fw_rateunit, + fw_ratemode, p->channel, p->minrate, p->maxrate, + p->pktsize, 0); + } mtx_unlock(&sc->tc_lock); } @@ -251,7 +264,7 @@ update_tx_sched(void *context, int pending) tc = &pi->sched_params->cl_rl[0]; for (j = 0; j < n; j++, tc++) { MPASS(mtx_owned(&sc->tc_lock)); - if ((tc->flags & CLRL_ASYNC) == 0) + if (tc->state != CS_HW_UPDATE_REQUESTED) continue; mtx_unlock(&sc->tc_lock); @@ -267,12 +280,22 @@ update_tx_sched(void *context, int pending) end_synchronized_op(sc, 0); mtx_lock(&sc->tc_lock); - MPASS(tc->flags & CLRL_ASYNC); - tc->flags &= ~CLRL_ASYNC; - if (rc == 0) - tc->flags &= ~CLRL_ERR; + MPASS(tc->state == CS_HW_UPDATE_REQUESTED); + if (rc == 0) { + tc->state = CS_HW_CONFIGURED; + continue; + } + /* parameters failed so we try to avoid params_set */ + if (tc->refcount > 0) + tc->state = CS_PARAMS_SET; else - tc->flags |= CLRL_ERR; + tc->state = CS_UNINITIALIZED; + CH_ERR(pi, "failed to configure traffic class %d: %d. " + "params: mode %d, rateunit %d, ratemode %d, " + "channel %d, minrate %d, maxrate %d, pktsize %d, " + "burstsize %d\n", j, rc, tc->mode, tc->rateunit, + tc->ratemode, pi->tx_chan, 0, tc->maxrate, + tc->pktsize, tc->burstsize); } } mtx_unlock(&sc->tc_lock); @@ -320,7 +343,7 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) * Bind to a different class at index idx. */ tc = &tc0[idx]; - if (tc->flags & CLRL_ERR) { + if (tc->state != CS_HW_CONFIGURED) { rc = ENXIO; goto done; } else { @@ -338,14 +361,15 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) mtx_unlock(&sc->tc_lock); rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4btxq"); - if (rc != 0) - return (rc); - fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | - V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | - V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); - fw_class = idx < 0 ? 0xffffffff : idx; - rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_mnem, &fw_class); - end_synchronized_op(sc, 0); + if (rc == 0) { + fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | + V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + fw_class = idx < 0 ? 0xffffffff : idx; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_mnem, + &fw_class); + end_synchronized_op(sc, 0); + } mtx_lock(&sc->tc_lock); MPASS(txq->tc_idx == -2); @@ -430,29 +454,16 @@ t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) int t4_init_tx_sched(struct adapter *sc) { - int i, j; + int i; const int n = sc->params.nsched_cls; struct port_info *pi; - struct tx_cl_rl_params *tc; mtx_init(&sc->tc_lock, "tx_sched lock", NULL, MTX_DEF); TASK_INIT(&sc->tc_task, 0, update_tx_sched, sc); for_each_port(sc, i) { pi = sc->port[i]; pi->sched_params = malloc(sizeof(*pi->sched_params) + - n * sizeof(*tc), M_CXGBE, M_ZERO | M_WAITOK); - tc = &pi->sched_params->cl_rl[0]; - for (j = 0; j < n; j++, tc++) { - tc->refcount = 0; - tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; - tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; - tc->mode = FW_SCHED_PARAMS_MODE_CLASS; - tc->maxrate = 1000 * 1000; /* 1 Gbps. Arbitrary */ - - if (t4_sched_params_cl_rl_kbps(sc, pi->tx_chan, j, - tc->mode, tc->maxrate, tc->pktsize, 1) != 0) - tc->flags = CLRL_ERR; - } + n * sizeof(struct tx_cl_rl_params), M_CXGBE, M_ZERO | M_WAITOK); } return (0); @@ -487,7 +498,7 @@ int t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, int *tc_idx) { - int rc = 0, fa = -1, i, pktsize, burstsize; + int rc = 0, fa, fa2, i, pktsize, burstsize; bool update; struct tx_cl_rl_params *tc; struct port_info *pi; @@ -506,30 +517,47 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, tc = &pi->sched_params->cl_rl[0]; update = false; + fa = fa2 = -1; mtx_lock(&sc->tc_lock); for (i = 0; i < sc->params.nsched_cls; i++, tc++) { - if (fa < 0 && tc->refcount == 0 && !(tc->flags & CLRL_USER)) - fa = i; /* first available */ - - if (tc->ratemode == FW_SCHED_PARAMS_RATE_ABS && + if (tc->state >= CS_PARAMS_SET && + tc->ratemode == FW_SCHED_PARAMS_RATE_ABS && tc->rateunit == FW_SCHED_PARAMS_UNIT_BITRATE && tc->mode == FW_SCHED_PARAMS_MODE_FLOW && tc->maxrate == maxrate && tc->pktsize == pktsize && tc->burstsize == burstsize) { tc->refcount++; *tc_idx = i; - if ((tc->flags & (CLRL_ERR | CLRL_ASYNC | CLRL_SYNC)) == - CLRL_ERR) { + if (tc->state == CS_PARAMS_SET) { + tc->state = CS_HW_UPDATE_REQUESTED; update = true; } goto done; } + + if (fa < 0 && tc->state == CS_UNINITIALIZED) { + MPASS(tc->refcount == 0); + fa = i; /* first available, never used. */ + } + if (fa2 < 0 && tc->refcount == 0 && !(tc->flags & CF_USER)) { + fa2 = i; /* first available, used previously. */ + } } /* Not found */ MPASS(i == sc->params.nsched_cls); - if (fa != -1) { + if (fa == -1) + fa = fa2; + if (fa == -1) { + *tc_idx = -1; + rc = ENOSPC; + } else { + MPASS(fa >= 0 && fa < sc->params.nsched_cls); tc = &pi->sched_params->cl_rl[fa]; + MPASS(!(tc->flags & CF_USER)); + MPASS(tc->refcount == 0); + tc->refcount = 1; + tc->state = CS_HW_UPDATE_REQUESTED; tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; tc->mode = FW_SCHED_PARAMS_MODE_FLOW; @@ -538,16 +566,11 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, tc->burstsize = burstsize; *tc_idx = fa; update = true; - } else { - *tc_idx = -1; - rc = ENOSPC; } done: mtx_unlock(&sc->tc_lock); - if (update) { - tc->flags |= CLRL_ASYNC; + if (update) t4_update_tx_sched(sc); - } return (rc); } @@ -616,6 +639,11 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) tc = sc->port[port_id]->sched_params->cl_rl[i]; mtx_unlock(&sc->tc_lock); + if (tc.state < CS_PARAMS_SET) { + sbuf_printf(sb, "uninitialized"); + goto done; + } + switch (tc.rateunit) { case SCHED_CLASS_RATEUNIT_BITS: switch (tc.ratemode) { @@ -649,6 +677,7 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) switch (tc.mode) { case SCHED_CLASS_MODE_CLASS: + /* Note that pktsize and burstsize are not used in this mode. */ sbuf_printf(sb, " aggregate"); break; case SCHED_CLASS_MODE_FLOW: diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index d4a995a5559a..fe0ebfbd832b 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -170,11 +170,10 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) if (cp->tc_idx >= 0 && cp->tc_idx < sc->params.nsched_cls) { tc = &pi->sched_params->cl_rl[cp->tc_idx]; mtx_lock(&sc->tc_lock); - if (tc->flags & CLRL_ERR) { - log(LOG_ERR, - "%s: failed to associate traffic class %u with tid %u\n", - device_get_nameunit(vi->dev), cp->tc_idx, - toep->tid); + if (tc->state != CS_HW_CONFIGURED) { + CH_ERR(vi, "tid %d cannot be bound to traffic class %d " + "because it is not configured (its state is %d)\n", + toep->tid, cp->tc_idx, tc->state); cp->tc_idx = -1; } else { tc->refcount++; From nobody Wed Oct 20 17:39:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20D1E1812783; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtP0gHrz3LpG; Wed, 20 Oct 2021 17:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8088E3F0F; Wed, 20 Oct 2021 17:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHde17094552; Wed, 20 Oct 2021 17:39:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHdeT1094551; Wed, 20 Oct 2021 17:39:40 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:40 GMT Message-Id: <202110201739.19KHdeT1094551@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: bcb2da3a6212 - stable/13 - cxgbe(4): Update firmwares to 1.26.2.0. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bcb2da3a621273eeaf36342e0f786191f78ea3de Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=bcb2da3a621273eeaf36342e0f786191f78ea3de commit bcb2da3a621273eeaf36342e0f786191f78ea3de Author: Navdeep Parhar AuthorDate: 2021-09-27 23:45:56 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:36:34 +0000 cxgbe(4): Update firmwares to 1.26.2.0. The firmwares and the following changelog are from the "Chelsio Unified Wire v3.15.0.0 for Linux." Version : 1.26.2.0 Date : 09/24/2021 ==================== FIXES ----- BASE: - Added support for SFP+ RJ45 (0x1C). - Fixing backward compatibility issue with older drivers when multiple speeds are passed to firmware. OFLD: - Do not touch tp_plen_max if driver is supplying tp_plen_max. This fixes a connection reset issue in iscsi. ENHANCEMENTS ------------ BASE: - Firmware header modified to add firmware binary signature. Sponsored by: Chelsio Communications (cherry picked from commit 45d6fbaec23eee457197a14517e715c947114d99) --- sys/conf/files | 6 +++--- .../{t4fw-1.26.0.0.bin => t4fw-1.26.2.0.bin} | Bin 570368 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 12 ++++++++---- .../{t5fw-1.26.0.0.bin => t5fw-1.26.2.0.bin} | Bin 675840 -> 676352 bytes .../{t6fw-1.26.0.0.bin => t6fw-1.26.2.0.bin} | Bin 729088 -> 729088 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 889e0289dfa8..2d3ae104753d 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1523,7 +1523,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1557,7 +1557,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1591,7 +1591,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin similarity index 57% rename from sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin index 04e96d16c57a..a8f611628dcc 100644 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index acb7a6481d9c..876fd61b4b21 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -9952,7 +9952,10 @@ struct fw_hdr { __u32 reserved3; __be32 magic; /* runtime or bootstrap fw */ __be32 flags; - __be32 reserved6[23]; + __be32 reserved6[4]; + __u8 reserved7[3]; + __u8 dsign_len; + __u8 dsign[72]; /* fw binary digital signature */ }; enum fw_hdr_chip { @@ -9992,17 +9995,17 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 26, - T4FW_VERSION_MICRO = 0, + T4FW_VERSION_MICRO = 2, T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 26, - T5FW_VERSION_MICRO = 0, + T5FW_VERSION_MICRO = 2, T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 26, - T6FW_VERSION_MICRO = 0, + T6FW_VERSION_MICRO = 2, T6FW_VERSION_BUILD = 0, }; @@ -10052,6 +10055,7 @@ enum { enum fw_hdr_flags { FW_HDR_FLAGS_RESET_HALT = 0x00000001, + FW_HDR_FLAGS_SIGNED_FW = 0x00000002, }; /* diff --git a/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin similarity index 55% rename from sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin index f72bd502ea1f..b11d6d0bf49f 100644 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin similarity index 61% rename from sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin index ee4341d5074f..f43d9953a7a4 100644 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index a202c5d2a6a0..e525edf96ce2 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.26.0.0 +T4FW_VER= 1.26.2.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 371df89f233b..74e89e4174b5 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.26.0.0 +T5FW_VER= 1.26.2.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index 074c3991bc37..2ea01e7b776a 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.26.0.0 +T6FW_VER= 1.26.2.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From nobody Wed Oct 20 17:39:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3E58E1812786; Wed, 20 Oct 2021 17:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZHtN48Q6z3Llb; Wed, 20 Oct 2021 17:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 428D93EA5; Wed, 20 Oct 2021 17:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHddUS094524; Wed, 20 Oct 2021 17:39:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHddHA094523; Wed, 20 Oct 2021 17:39:39 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:39:39 GMT Message-Id: <202110201739.19KHddHA094523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: c1f66d325a56 - stable/13 - cxgbe(4): Update firmwares to 1.26.0.0. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c1f66d325a56c94b8aa384073c561a88dc9e25f9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=c1f66d325a56c94b8aa384073c561a88dc9e25f9 commit c1f66d325a56c94b8aa384073c561a88dc9e25f9 Author: Navdeep Parhar AuthorDate: 2021-06-24 20:21:51 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:35:56 +0000 cxgbe(4): Update firmwares to 1.26.0.0. Changes since 1.25.6.0 are listed here. This list comes from the Release Notes for "Chelsio Unified Wire 3.14.0.4 for Linux" dated 2021-07-08. Fixes ----- BASE: - Wait 5ms before and after the i2c command that clears the mod_select. This fixes incorrect port module type read from i2c. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit 3c900106ea7aab69690945ad885b4df1095c1504) --- sys/conf/files | 6 +++--- .../{t4fw-1.25.6.0.bin => t4fw-1.26.0.0.bin} | Bin 570368 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 12 ++++++------ .../{t5fw-1.25.6.0.bin => t5fw-1.26.0.0.bin} | Bin 675840 -> 675840 bytes .../{t6fw-1.25.6.0.bin => t6fw-1.26.0.0.bin} | Bin 730112 -> 729088 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 30f1a0940a8e..889e0289dfa8 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1523,7 +1523,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1557,7 +1557,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1591,7 +1591,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin similarity index 77% rename from sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin index 45e805198f59..04e96d16c57a 100644 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index 0f877cb5a045..acb7a6481d9c 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -9991,18 +9991,18 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, - T4FW_VERSION_MINOR = 25, - T4FW_VERSION_MICRO = 6, + T4FW_VERSION_MINOR = 26, + T4FW_VERSION_MICRO = 0, T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, - T5FW_VERSION_MINOR = 25, - T5FW_VERSION_MICRO = 6, + T5FW_VERSION_MINOR = 26, + T5FW_VERSION_MICRO = 0, T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, - T6FW_VERSION_MINOR = 25, - T6FW_VERSION_MICRO = 6, + T6FW_VERSION_MINOR = 26, + T6FW_VERSION_MICRO = 0, T6FW_VERSION_BUILD = 0, }; diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin similarity index 72% rename from sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin index 6c2d1374c87a..f72bd502ea1f 100644 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin similarity index 61% rename from sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin index 1cf05565ffff..ee4341d5074f 100644 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index 48ac2766a560..a202c5d2a6a0 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.6.0 +T4FW_VER= 1.26.0.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 3b54df8b222b..371df89f233b 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.25.6.0 +T5FW_VER= 1.26.0.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index e7b39839b5e4..074c3991bc37 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.25.6.0 +T6FW_VER= 1.26.0.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From nobody Wed Oct 20 17:47:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1679C181671A; Wed, 20 Oct 2021 17:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ3r0716z3R7j; Wed, 20 Oct 2021 17:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D811E4183; Wed, 20 Oct 2021 17:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHlpBn007700; Wed, 20 Oct 2021 17:47:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHlp5i007699; Wed, 20 Oct 2021 17:47:51 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:47:51 GMT Message-Id: <202110201747.19KHlp5i007699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 0ab62c8abacb - stable/13 - cxgbe(4): Skip a few more T5/T6 registers during a regdump. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ab62c8abacb2e0d5336a247b4ba966ea48597ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab62c8abacb2e0d5336a247b4ba966ea48597ee commit 0ab62c8abacb2e0d5336a247b4ba966ea48597ee Author: Navdeep Parhar AuthorDate: 2021-07-13 23:38:55 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:42:55 +0000 cxgbe(4): Skip a few more T5/T6 registers during a regdump. These registers have read side effects and a read at just the right (wrong?) time can trash some internal hw state. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit f13920b39b8b500a17fc276629d70828f9f2d4b1) --- sys/dev/cxgbe/common/t4_hw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index bb08c55c87b2..f06b21120061 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -1373,7 +1373,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0xdfc0, 0xdfe0, 0xe000, 0x1106c, 0x11074, 0x11088, - 0x1109c, 0x1117c, + 0x1109c, 0x11110, + 0x11118, 0x1117c, 0x11190, 0x11204, 0x19040, 0x1906c, 0x19078, 0x19080, @@ -2082,7 +2083,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x1190, 0x1194, 0x11a0, 0x11a4, 0x11b0, 0x11c4, - 0x11fc, 0x1274, + 0x11fc, 0x123c, + 0x1254, 0x1274, 0x1280, 0x133c, 0x1800, 0x18fc, 0x3000, 0x302c, From nobody Wed Oct 20 17:47:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 825D1181671B; Wed, 20 Oct 2021 17:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ3s2f75z3gxh; Wed, 20 Oct 2021 17:47:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14E783D68; Wed, 20 Oct 2021 17:47:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHlrF4007724; Wed, 20 Oct 2021 17:47:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHlqur007723; Wed, 20 Oct 2021 17:47:52 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:47:52 GMT Message-Id: <202110201747.19KHlqur007723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: d257477bd0bd - stable/13 - cxgbetool(8): Update the register definitions used to decode regdump. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d257477bd0bdf45a79626017d54366a7f4acc60d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=d257477bd0bdf45a79626017d54366a7f4acc60d commit d257477bd0bdf45a79626017d54366a7f4acc60d Author: Navdeep Parhar AuthorDate: 2021-07-14 00:51:13 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:43:21 +0000 cxgbetool(8): Update the register definitions used to decode regdump. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications (cherry picked from commit 35e62b00c3342cffee042093b72a52f3f19e5263) --- usr.sbin/cxgbetool/reg_defs_t5.c | 304 +------------ usr.sbin/cxgbetool/reg_defs_t6.c | 955 +-------------------------------------- 2 files changed, 25 insertions(+), 1234 deletions(-) diff --git a/usr.sbin/cxgbetool/reg_defs_t5.c b/usr.sbin/cxgbetool/reg_defs_t5.c index ff84f00f297a..f5f64da7ebd2 100644 --- a/usr.sbin/cxgbetool/reg_defs_t5.c +++ b/usr.sbin/cxgbetool/reg_defs_t5.c @@ -1,6 +1,6 @@ /* This file is automatically generated --- changes will be lost */ -/* Generation Date : Mon Dec 7 19:40:45 IST 2015 */ -/* Directory name: t5_reg.txt, Changeset: 6934:86d3c0167c2c */ +/* Generation Date : Tue Jan 28 03:02:12 IST 2020 */ +/* Directory name: t5_reg.txt, Changeset: 6941:9063655afd44 */ __FBSDID("$FreeBSD$"); struct reg_info t5_sge_regs[] = { @@ -43607,21 +43607,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x33100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43748,21 +43733,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x33400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43889,21 +43859,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x33500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -44030,21 +43985,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x33900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -44171,21 +44111,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x33200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -47754,21 +47679,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x37100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -47895,21 +47805,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x37400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48036,21 +47931,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x37500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48177,21 +48057,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x37900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48318,21 +48183,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x37200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -51901,21 +51751,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x3b100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52042,21 +51877,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x3b400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52183,21 +52003,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x3b500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52324,21 +52129,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x3b900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52465,21 +52255,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x3b200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -56048,21 +55823,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x3f100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56189,21 +55949,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x3f400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56330,21 +56075,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x3f500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56471,21 +56201,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x3f900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56612,21 +56327,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x3f200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, diff --git a/usr.sbin/cxgbetool/reg_defs_t6.c b/usr.sbin/cxgbetool/reg_defs_t6.c index f8a353b446de..23a3d6d44a5a 100644 --- a/usr.sbin/cxgbetool/reg_defs_t6.c +++ b/usr.sbin/cxgbetool/reg_defs_t6.c @@ -1,6 +1,6 @@ /* This file is automatically generated --- changes will be lost */ -/* Generation Date : Wed Jan 27 10:58:12 IST 2016 */ -/* Directory name: t6_reg.txt, Changeset: 4191:ce3ccd95c109 */ +/* Generation Date : Tue Jan 28 03:02:08 IST 2020 */ +/* Directory name: t6_reg.txt, Changeset: 4272:a648ba4d5c0c */ __FBSDID("$FreeBSD$"); struct reg_info t6_sge_regs[] = { @@ -760,6 +760,21 @@ struct reg_info t6_sge_regs[] = { { "SGE_PC0_RSP_BIST_ERROR_CNT", 0x11a4, 0 }, { "SGE_PC1_RSP_BIST_CMD", 0x11b0, 0 }, { "SGE_PC1_RSP_BIST_ERROR_CNT", 0x11b4, 0 }, + { "SGE_DBQ_TIMER_THRESH0", 0x11b8, 0 }, + { "TxTimeTh3", 24, 6 }, + { "TxTimeTh2", 16, 6 }, + { "TxTimeTh1", 8, 6 }, + { "TxTimeTh0", 0, 6 }, + { "SGE_DBQ_TIMER_THRESH1", 0x11bc, 0 }, + { "TxTimeTh7", 24, 6 }, + { "TxTimeTh6", 16, 6 }, + { "TxTimeTh5", 8, 6 }, + { "TxTimeTh4", 0, 6 }, + { "SGE_DBQ_TIMER_CONFIG", 0x11c0, 0 }, + { "SGE_DBQ_TIMER_DBG", 0x11c4, 0 }, + { "dbq_timer_cmd", 31, 1 }, + { "dbq_timer_index", 24, 6 }, + { "dbq_timer_qcnt", 0, 17 }, { "SGE_CTXT_CMD", 0x11fc, 0 }, { "Busy", 31, 1 }, { "Opcode", 28, 2 }, @@ -39712,6 +39727,12 @@ struct reg_info t6_le_regs[] = { { "LE_DB_DBGI_RSP_DATA", 0x19dc0, 0 }, { "LE_DB_DBGI_RSP_DATA", 0x19dc4, 0 }, { "LE_DB_DBGI_RSP_DATA", 0x19dc8, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dcc, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd0, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd4, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd8, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19ddc, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19de0, 0 }, { "LE_DB_TCAM_TID_BASE", 0x19df0, 0 }, { "LE_DB_CLCAM_TID_BASE", 0x19df4, 0 }, { "LE_DB_HASH_TID_BASE", 0x19df8, 0 }, @@ -42611,37 +42632,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x33100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -42820,37 +42810,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x33400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43029,37 +42988,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x33500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43238,37 +43166,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x33900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43447,37 +43344,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x33200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -43801,68 +43667,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKA_DFE_TAP_CONTROL", 0x332c0, 0 }, { "MAC_PORT_RX_LINKA_DFE_TAP", 0x332c4, 0 }, - { "MAC_PORT_RX_LINKA_DFE_TAP_ENABLE", 0x32a00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKA_DFE_H1", 0x32a04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKA_DFE_H2", 0x32a08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKA_DFE_H3", 0x32a0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H4", 0x32a10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H5", 0x32a14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H6_AND_H7", 0x32a18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H8_AND_H9", 0x32a1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H10_AND_H11", 0x32a20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H12_13", 0x32a24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H14_15", 0x32a28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32a2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKA_RECEIVER_INTERNAL_STATUS_2", 0x332e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -44245,68 +44049,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKB_DFE_TAP_CONTROL", 0x333c0, 0 }, { "MAC_PORT_RX_LINKB_DFE_TAP", 0x333c4, 0 }, - { "MAC_PORT_RX_LINKB_DFE_TAP_ENABLE", 0x32b00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKB_DFE_H1", 0x32b04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKB_DFE_H2", 0x32b08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKB_DFE_H3", 0x32b0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H4", 0x32b10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H5", 0x32b14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H6_AND_H7", 0x32b18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H8_AND_H9", 0x32b1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H10_AND_H11", 0x32b20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H12_13", 0x32b24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H14_15", 0x32b28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32b2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKB_RECEIVER_INTERNAL_STATUS_2", 0x333e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -44689,68 +44431,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKC_DFE_TAP_CONTROL", 0x336c0, 0 }, { "MAC_PORT_RX_LINKC_DFE_TAP", 0x336c4, 0 }, - { "MAC_PORT_RX_LINKC_DFE_TAP_ENABLE", 0x32e00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKC_DFE_H1", 0x32e04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKC_DFE_H2", 0x32e08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKC_DFE_H3", 0x32e0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H4", 0x32e10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H5", 0x32e14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H6_AND_H7", 0x32e18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H8_AND_H9", 0x32e1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H10_AND_H11", 0x32e20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H12_13", 0x32e24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H14_15", 0x32e28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32e2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKC_RECEIVER_INTERNAL_STATUS_2", 0x336e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -45133,68 +44813,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKD_DFE_TAP_CONTROL", 0x337c0, 0 }, { "MAC_PORT_RX_LINKD_DFE_TAP", 0x337c4, 0 }, - { "MAC_PORT_RX_LINKD_DFE_TAP_ENABLE", 0x32f00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKD_DFE_H1", 0x32f04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKD_DFE_H2", 0x32f08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKD_DFE_H3", 0x32f0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H4", 0x32f10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H5", 0x32f14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H6_AND_H7", 0x32f18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H8_AND_H9", 0x32f1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H10_AND_H11", 0x32f20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H12_13", 0x32f24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H14_15", 0x32f28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32f2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKD_RECEIVER_INTERNAL_STATUS_2", 0x337e4, 0 }, { "STNDBYSTAT", 15, 1 }, *** 605 LINES SKIPPED *** From nobody Wed Oct 20 17:50:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 63F6817F1A11; Wed, 20 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ6w2MRyz3jkM; Wed, 20 Oct 2021 17:50:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31C8D3F9A; Wed, 20 Oct 2021 17:50:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHoWsn016233; Wed, 20 Oct 2021 17:50:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHoW5K016232; Wed, 20 Oct 2021 17:50:32 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:50:32 GMT Message-Id: <202110201750.19KHoW5K016232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 5561c4ffb261 - stable/13 - cxgbe(4): Initialize abs_id for ctrl and ofld queues. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5561c4ffb26128406f51a764e3956ba60e9695c2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=5561c4ffb26128406f51a764e3956ba60e9695c2 commit 5561c4ffb26128406f51a764e3956ba60e9695c2 Author: Navdeep Parhar AuthorDate: 2021-07-19 22:47:07 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:47:58 +0000 cxgbe(4): Initialize abs_id for ctrl and ofld queues. Sponsored by: Chelsio Communications (cherry picked from commit 76c890229628109e46f01c5037b773b59247a1f8) --- sys/dev/cxgbe/t4_sge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 9d990253d7a0..3134542b1b87 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4190,6 +4190,7 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) } eq->cntxt_id = G_FW_EQ_CTRL_CMD_EQID(be32toh(c.cmpliqid_eqid)); + eq->abs_id = G_FW_EQ_CTRL_CMD_PHYSEQID(be32toh(c.physeqid_pkd)); cntxt_id = eq->cntxt_id - sc->sge.eq_start; if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__, @@ -4279,6 +4280,7 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, struct sge_eq *eq) } eq->cntxt_id = G_FW_EQ_OFLD_CMD_EQID(be32toh(c.eqid_pkd)); + eq->abs_id = G_FW_EQ_OFLD_CMD_PHYSEQID(be32toh(c.physeqid_pkd)); cntxt_id = eq->cntxt_id - sc->sge.eq_start; if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__, From nobody Wed Oct 20 17:50:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A72F217F192C; Wed, 20 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ6x3nQTz3jdn; Wed, 20 Oct 2021 17:50:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51101411A; Wed, 20 Oct 2021 17:50:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHoXDt016257; Wed, 20 Oct 2021 17:50:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHoXGS016256; Wed, 20 Oct 2021 17:50:33 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:50:33 GMT Message-Id: <202110201750.19KHoXGS016256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: d8034cee46f3 - stable/13 - cxgbe(4): Display HMA information in meminfo. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d8034cee46f3d547ad3fcd1e93024d27479b6e38 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=d8034cee46f3d547ad3fcd1e93024d27479b6e38 commit d8034cee46f3d547ad3fcd1e93024d27479b6e38 Author: Navdeep Parhar AuthorDate: 2021-09-07 20:39:44 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:48:22 +0000 cxgbe(4): Display HMA information in meminfo. This should have been added with initial T6 support many years ago. Sponsored by: Chelsio Communications (cherry picked from commit 83a611e09238ead5a765c0ea2c02699fe8175756) --- sys/dev/cxgbe/common/common.h | 2 +- sys/dev/cxgbe/t4_main.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index c132cb779204..07d8ab2b40f0 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -49,7 +49,7 @@ enum { T5_REGMAP_SIZE = (332 * 1024), }; -enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 }; +enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1, MEM_HMA }; enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 2fa54909aa5a..853bc2b5d58a 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -9591,7 +9591,9 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) struct sbuf *sb; int rc, i, n; uint32_t lo, hi, used, alloc; - static const char *memory[] = {"EDC0:", "EDC1:", "MC:", "MC0:", "MC1:"}; + static const char *memory[] = { + "EDC0:", "EDC1:", "MC:", "MC0:", "MC1:", "HMA:" + }; static const char *region[] = { "DBQ contexts:", "IMSG contexts:", "FLM cache:", "TCBs:", "Pstructs:", "Timers:", "Rx FL:", "Tx FL:", "Pstruct FL:", @@ -9644,19 +9646,25 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) if (lo & F_EXT_MEM_ENABLE) { hi = t4_read_reg(sc, A_MA_EXT_MEMORY_BAR); avail[i].base = G_EXT_MEM_BASE(hi) << 20; - avail[i].limit = avail[i].base + - (G_EXT_MEM_SIZE(hi) << 20); + avail[i].limit = avail[i].base + (G_EXT_MEM_SIZE(hi) << 20); avail[i].idx = is_t5(sc) ? 3 : 2; /* Call it MC0 for T5 */ i++; } if (is_t5(sc) && lo & F_EXT_MEM1_ENABLE) { hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); avail[i].base = G_EXT_MEM1_BASE(hi) << 20; - avail[i].limit = avail[i].base + - (G_EXT_MEM1_SIZE(hi) << 20); + avail[i].limit = avail[i].base + (G_EXT_MEM1_SIZE(hi) << 20); avail[i].idx = 4; i++; } + if (is_t6(sc) && lo & F_HMA_MUX) { + hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); + avail[i].base = G_EXT_MEM1_BASE(hi) << 20; + avail[i].limit = avail[i].base + (G_EXT_MEM1_SIZE(hi) << 20); + avail[i].idx = 5; + i++; + } + MPASS(i <= nitems(avail)); if (!i) /* no memory available */ goto done; qsort(avail, i, sizeof(struct mem_desc), mem_desc_cmp); From nobody Wed Oct 20 17:50:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7CCAA17F1B01; Wed, 20 Oct 2021 17:50:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ6y5jgxz3jmw; Wed, 20 Oct 2021 17:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7605F3D69; Wed, 20 Oct 2021 17:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHoYbV016493; Wed, 20 Oct 2021 17:50:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHoYXj016471; Wed, 20 Oct 2021 17:50:34 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:50:34 GMT Message-Id: <202110201750.19KHoYXj016471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 38271e72919a - stable/13 - cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38271e72919a5ce1f38efc018eb270ab5a1c24af Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=38271e72919a5ce1f38efc018eb270ab5a1c24af commit 38271e72919a5ce1f38efc018eb270ab5a1c24af Author: Navdeep Parhar AuthorDate: 2021-09-07 23:28:11 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:48:51 +0000 cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo. Sponsored by: Chelsio Communications (cherry picked from commit 92de737996660b70376a8b72b80037f89d876056) --- sys/dev/cxgbe/t4_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 853bc2b5d58a..eebba8afcb8c 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -9719,23 +9719,24 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) #undef ulp_region md->base = 0; - md->idx = nitems(region); - if (!is_t4(sc)) { + if (is_t4(sc)) + md->idx = nitems(region); + else { uint32_t size = 0; uint32_t sge_ctrl = t4_read_reg(sc, A_SGE_CONTROL2); uint32_t fifo_size = t4_read_reg(sc, A_SGE_DBVFIFO_SIZE); if (is_t5(sc)) { if (sge_ctrl & F_VFIFO_ENABLE) - size = G_DBVFIFO_SIZE(fifo_size); + size = fifo_size << 2; } else - size = G_T6_DBVFIFO_SIZE(fifo_size); + size = G_T6_DBVFIFO_SIZE(fifo_size) << 6; if (size) { - md->base = G_BASEADDR(t4_read_reg(sc, - A_SGE_DBVFIFO_BADDR)); - md->limit = md->base + (size << 2) - 1; - } + md->base = t4_read_reg(sc, A_SGE_DBVFIFO_BADDR); + md->limit = md->base + size - 1; + } else + md->idx = nitems(region); } md++; From nobody Wed Oct 20 17:52:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A5BF617F2D93; Wed, 20 Oct 2021 17:52: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZJ9C4Fmbz3lGS; Wed, 20 Oct 2021 17:52:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 723463CF4; Wed, 20 Oct 2021 17:52:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KHqVYl020631; Wed, 20 Oct 2021 17:52:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KHqVGE020630; Wed, 20 Oct 2021 17:52:31 GMT (envelope-from git) Date: Wed, 20 Oct 2021 17:52:31 GMT Message-Id: <202110201752.19KHqVGE020630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: e058d44fda32 - stable/13 - cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution. Sponsored by: Chelsio Communications List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e058d44fda32582ae7445e400f7c385953435064 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=e058d44fda32582ae7445e400f7c385953435064 commit e058d44fda32582ae7445e400f7c385953435064 Author: Navdeep Parhar AuthorDate: 2021-09-09 03:46:42 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 17:50:42 +0000 cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution. Sponsored by: Chelsio Communications (cherry picked from commit 53c17de2b472c5c4982d5a020268ad3098241498) --- sys/dev/cxgbe/tom/t4_tom_l2t.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tom_l2t.c b/sys/dev/cxgbe/tom/t4_tom_l2t.c index 682c99840dcd..1d094c30d25e 100644 --- a/sys/dev/cxgbe/tom/t4_tom_l2t.c +++ b/sys/dev/cxgbe/tom/t4_tom_l2t.c @@ -271,8 +271,7 @@ again: switch (e->state) { case L2T_STATE_STALE: /* entry is stale, kick off revalidation */ - if (resolve_entry(sc, e) != EWOULDBLOCK) - goto again; /* entry updated, re-examine state */ + resolve_entry(sc, e); /* Fall through */ From nobody Wed Oct 20 18:30:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 87A8418049B2; Wed, 20 Oct 2021 18: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZK0t1dk9z4Rss; Wed, 20 Oct 2021 18:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D6D84B16; Wed, 20 Oct 2021 18:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KIUL2Y070460; Wed, 20 Oct 2021 18:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KIUL1l070453; Wed, 20 Oct 2021 18:30:21 GMT (envelope-from git) Date: Wed, 20 Oct 2021 18:30:21 GMT Message-Id: <202110201830.19KIUL1l070453@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: 80bca63cf48d - main - tmpfs: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80bca63cf48d0f4f1c6cfc1dace1369947eaaa47 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=80bca63cf48d0f4f1c6cfc1dace1369947eaaa47 commit 80bca63cf48d0f4f1c6cfc1dace1369947eaaa47 Author: Konstantin Belousov AuthorDate: 2021-10-20 01:54:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-20 18:29:49 +0000 tmpfs: remove write-only variables Reviewed by: imp, mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32577 --- sys/fs/tmpfs/tmpfs_subr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 1b7521cf0b0d..9810c1776314 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -454,7 +454,6 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, const char *target, dev_t rdev, struct tmpfs_node **node) { struct tmpfs_node *nnode; - vm_object_t obj; char *symlink; char symlink_smr; @@ -566,7 +565,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, break; case VREG: - obj = nnode->tn_reg.tn_aobj = + nnode->tn_reg.tn_aobj = vm_pager_allocate(tmpfs_pager_type, NULL, 0, VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); @@ -1785,7 +1784,6 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr) int tmpfs_reg_punch_hole(struct vnode *vp, off_t *offset, off_t *length) { - struct tmpfs_mount *tmp; struct tmpfs_node *node; vm_object_t object; vm_pindex_t pistart, pi, piend; @@ -1799,7 +1797,6 @@ tmpfs_reg_punch_hole(struct vnode *vp, off_t *offset, off_t *length) KASSERT(node->tn_type == VREG, ("%s: node is not regular file", __func__)); object = node->tn_reg.tn_aobj; - tmp = VFS_TO_TMPFS(vp->v_mount); off = *offset; len = omin(node->tn_size - off, *length); startofs = off & PAGE_MASK; From nobody Wed Oct 20 18:30:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 999F91804845; Wed, 20 Oct 2021 18:30: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZK0v2YGNz4SB9; Wed, 20 Oct 2021 18:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31B02492A; Wed, 20 Oct 2021 18:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KIUNuu070555; Wed, 20 Oct 2021 18:30:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KIUNLT070554; Wed, 20 Oct 2021 18:30:23 GMT (envelope-from git) Date: Wed, 20 Oct 2021 18:30:23 GMT Message-Id: <202110201830.19KIUNLT070554@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: 2bd6d910b243 - main - msdosfs_rename: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bd6d910b24343f7678be7482a78fd7d596e6753 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2bd6d910b24343f7678be7482a78fd7d596e6753 commit 2bd6d910b24343f7678be7482a78fd7d596e6753 Author: Konstantin Belousov AuthorDate: 2021-10-20 01:55:50 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-20 18:29:49 +0000 msdosfs_rename: remove write-only variables Reviewed by: imp, mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32577 --- sys/fs/msdosfs/msdosfs_vnops.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 44026c270f1c..a431190d7089 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -941,14 +941,12 @@ msdosfs_rename(struct vop_rename_args *ap) struct componentname *fcnp, *tcnp; struct denode *fdip, *fip, *tdip, *tip, *nip; u_char toname[12], oldname[11]; - u_long from_diroffset, to_diroffset; + u_long to_diroffset; bool checkpath_locked, doingdirectory, newparent; - u_char to_count; int error; u_long cn, pcl, blkoff; daddr_t bn, wait_scn, scn; struct msdosfsmount *pmp; - struct mount *mp; struct direntry *dotdotp; struct buf *bp; @@ -968,7 +966,6 @@ msdosfs_rename(struct vop_rename_args *ap) /* * Check for cross-device rename. */ - mp = fvp->v_mount; if (fvp->v_mount != tdvp->v_mount || (tvp != NULL && fvp->v_mount != tvp->v_mount)) { error = EXDEV; @@ -1031,7 +1028,6 @@ relock: } vrele(fvp); fvp = DETOV(nip); - from_diroffset = fdip->de_fndoffset; error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff); if (error != 0 && error != EJUSTRETURN) { @@ -1077,7 +1073,6 @@ relock: * Remember direntry place to use for destination */ to_diroffset = tdip->de_fndoffset; - to_count = tdip->de_fndcnt; /* * Be sure we are not renaming ".", "..", or an alias of ".". This From nobody Wed Oct 20 18:30:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EA1AB18049BB; Wed, 20 Oct 2021 18:30: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZK0w5YxJz4S0q; Wed, 20 Oct 2021 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F30448BE; Wed, 20 Oct 2021 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KIUOnY070579; Wed, 20 Oct 2021 18:30:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KIUOhJ070578; Wed, 20 Oct 2021 18:30:24 GMT (envelope-from git) Date: Wed, 20 Oct 2021 18:30:24 GMT Message-Id: <202110201830.19KIUOhJ070578@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: 2ff7c2cc4f28 - main - sys/bus.h: silence warnings about write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ff7c2cc4f28ab05caccb2936ba0d74c6734dd39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ff7c2cc4f28ab05caccb2936ba0d74c6734dd39 commit 2ff7c2cc4f28ab05caccb2936ba0d74c6734dd39 Author: Konstantin Belousov AuthorDate: 2021-10-20 13:23:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-20 18:29:49 +0000 sys/bus.h: silence warnings about write-only variables in the generated functions for bus accessors. These are the most noising instances for drivers when non-debug kernel is compiled with clang 13. Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32578 --- sys/sys/bus.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/bus.h b/sys/sys/bus.h index bf51bdbef387..8544aa32cff8 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -805,7 +805,7 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ static __inline type varp ## _get_ ## var(device_t dev) \ { \ uintptr_t v; \ - int e; \ + int e __diagused; \ e = BUS_READ_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, &v); \ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ @@ -817,7 +817,7 @@ static __inline type varp ## _get_ ## var(device_t dev) \ static __inline void varp ## _set_ ## var(device_t dev, type t) \ { \ uintptr_t v = (uintptr_t) t; \ - int e; \ + int e __diagused; \ e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, v); \ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ From nobody Wed Oct 20 19:01:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3281317F3979; Wed, 20 Oct 2021 19:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZKjJ0sckz4djR; Wed, 20 Oct 2021 19:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1ECA4E70; Wed, 20 Oct 2021 19:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KJ1tUZ015623; Wed, 20 Oct 2021 19:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KJ1t2l015622; Wed, 20 Oct 2021 19:01:55 GMT (envelope-from git) Date: Wed, 20 Oct 2021 19:01:55 GMT Message-Id: <202110201901.19KJ1t2l015622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: f83288645cd9 - main - powerpc64le: stand fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f83288645cd9726c24ca67292fbc3abb4eb65a36 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=f83288645cd9726c24ca67292fbc3abb4eb65a36 commit f83288645cd9726c24ca67292fbc3abb4eb65a36 Author: Leandro Lupori AuthorDate: 2021-10-20 18:48:33 +0000 Commit: Leandro Lupori CommitDate: 2021-10-20 18:48:33 +0000 powerpc64le: stand fixes Fix boot1 and loader on PowerPC64 little-endian (LE). Due to endian issues, boot1 couldn't find the UFS boot partition and loader wasn't able to load the kernel. Most of the issues happened because boot1 and loader were BE binaries trying to access LE UFS partitions and because loader expects the kernel ELF image to use the same endian as itself. To fix these issues, boot1 and loader are now built as LE binaries on PPC64LE. To support this, the functions that call OpenFirmware were enhanced to correctly perform endian conversion on its input and output arguments and to change the CPU into BE mode before making the calls, as OpenFirmware always runs in BE. Besides that, some other small fixes were needed. Submitted by: bdragon (initial version) Reviewed by: alfredo, jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32160 --- stand/common/load_elf.c | 18 -- stand/defs.mk | 8 +- stand/libofw/openfirm.c | 344 +++++++++++++++-------------------- stand/libofw/openfirm.h | 7 +- stand/powerpc/Makefile | 6 +- stand/powerpc/boot1.chrp/boot1.c | 102 ++++++++++- stand/powerpc/ofw/Makefile | 14 +- stand/powerpc/ofw/cas.c | 14 +- stand/powerpc/ofw/ldscript.powerpcle | 142 +++++++++++++++ stand/powerpc/ofw/main.c | 37 +++- stand/powerpc/ofw/ofwfdt.c | 7 +- stand/powerpc/ofw/trampolineLE.S | 71 ++++++++ 12 files changed, 525 insertions(+), 245 deletions(-) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index c163b50c9737..a213b34970f0 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -750,13 +750,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) } #endif size = shdr[i].sh_size; -#if defined(__powerpc__) - #if __ELF_WORD_SIZE == 64 - size = htobe64(size); - #else - size = htobe32(size); - #endif -#endif archsw.arch_copyin(&size, lastaddr, sizeof(size)); lastaddr += sizeof(size); @@ -802,17 +795,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) printf("]"); #endif -#if defined(__powerpc__) - /* On PowerPC we always need to provide BE data to the kernel */ - #if __ELF_WORD_SIZE == 64 - ssym = htobe64((uint64_t)ssym); - esym = htobe64((uint64_t)esym); - #else - ssym = htobe32((uint32_t)ssym); - esym = htobe32((uint32_t)esym); - #endif -#endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); diff --git a/stand/defs.mk b/stand/defs.mk index aee4636985ac..765fd046a879 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -120,10 +120,12 @@ CFLAGS+= -DLOADER_DISK_SUPPORT # Machine specific flags for all builds here -# Ensure PowerPC64 and PowerPC64LE boot loaders are compiled as 32 bit -# and in big endian. -.if ${MACHINE_ARCH:Mpowerpc64*} != "" +# Ensure PowerPC64 and PowerPC64LE boot loaders are compiled as 32 bit. +# PowerPC64LE boot loaders are 32-bit little-endian. +.if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc -mbig-endian +.elif ${MACHINE_ARCH} == "powerpc64le" +CFLAGS+= -m32 -mcpu=powerpc -mlittle-endian .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is diff --git a/stand/libofw/openfirm.c b/stand/libofw/openfirm.c index 0b4198d281fd..b2b89581ae70 100644 --- a/stand/libofw/openfirm.c +++ b/stand/libofw/openfirm.c @@ -58,6 +58,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include @@ -71,6 +73,13 @@ ihandle_t mmu; ihandle_t memory; int real_mode = 0; +#define IN(x) htobe32((cell_t)x) +#define OUT(x) be32toh(x) +#define SETUP(a, b, c, d) \ + a.name = IN( (b) ); \ + a.nargs = IN( (c) ); \ + a.nreturns = IN( (d) ); + /* Initialiser */ void @@ -117,16 +126,13 @@ OF_test(char *name) cell_t nreturns; cell_t service; cell_t missing; - } args = { - (cell_t)"test", - 1, - 1, - }; + } args = {}; + SETUP(args, "test", 1, 1); - args.service = (cell_t)name; + args.service = IN(name); if (openfirmware(&args) == -1) return (-1); - return (args.missing); + return (OUT(args.missing)); } /* Return firmware millisecond count. */ @@ -138,14 +144,11 @@ OF_milliseconds() cell_t nargs; cell_t nreturns; cell_t ms; - } args = { - (cell_t)"milliseconds", - 0, - 1, - }; + } args = {}; + SETUP(args, "milliseconds", 0, 1); openfirmware(&args); - return (args.ms); + return (OUT(args.ms)); } /* @@ -162,11 +165,8 @@ OF_peer(phandle_t node) cell_t nreturns; cell_t node; cell_t next; - } args = { - (cell_t)"peer", - 1, - 1, - }; + } args = {}; + SETUP(args, "peer", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -184,11 +184,8 @@ OF_child(phandle_t node) cell_t nreturns; cell_t node; cell_t child; - } args = { - (cell_t)"child", - 1, - 1, - }; + } args = {}; + SETUP(args, "child", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -206,11 +203,8 @@ OF_parent(phandle_t node) cell_t nreturns; cell_t node; cell_t parent; - } args = { - (cell_t)"parent", - 1, - 1, - }; + } args = {}; + SETUP(args, "parent", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -228,11 +222,8 @@ OF_instance_to_package(ihandle_t instance) cell_t nreturns; cell_t instance; cell_t package; - } args = { - (cell_t)"instance-to-package", - 1, - 1, - }; + } args = {}; + SETUP(args, "instance-to-package", 1, 1); args.instance = instance; if (openfirmware(&args) == -1) @@ -251,17 +242,14 @@ OF_getproplen(phandle_t package, const char *propname) cell_t package; cell_t propname; cell_t proplen; - } args = { - (cell_t)"getproplen", - 2, - 1, - }; + } args = {}; + SETUP(args, "getproplen", 2, 1); args.package = package; - args.propname = (cell_t)propname; + args.propname = IN(propname); if (openfirmware(&args) == -1) return (-1); - return (args.proplen); + return (OUT(args.proplen)); } /* Get the value of a property of a package. */ @@ -277,19 +265,31 @@ OF_getprop(phandle_t package, const char *propname, void *buf, int buflen) cell_t buf; cell_t buflen; cell_t size; - } args = { - (cell_t)"getprop", - 4, - 1, - }; + } args = {}; + SETUP(args, "getprop", 4, 1); args.package = package; - args.propname = (cell_t)propname; - args.buf = (cell_t)buf; - args.buflen = buflen; + args.propname = IN(propname); + args.buf = IN(buf); + args.buflen = IN(buflen); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); +} + +/* Decode a binary property from a package. */ +int +OF_getencprop(phandle_t package, const char *propname, cell_t *buf, int buflen) +{ + int retval, i; + retval = OF_getprop(package, propname, buf, buflen); + if (retval == -1) + return (retval); + + for (i = 0; i < buflen/4; i++) + buf[i] = be32toh((uint32_t)buf[i]); + + return (retval); } /* Get the next property of a package. */ @@ -304,18 +304,15 @@ OF_nextprop(phandle_t package, const char *previous, char *buf) cell_t previous; cell_t buf; cell_t flag; - } args = { - (cell_t)"nextprop", - 3, - 1, - }; + } args = {}; + SETUP(args, "nextprop", 3, 1); args.package = package; - args.previous = (cell_t)previous; - args.buf = (cell_t)buf; + args.previous = IN(previous); + args.buf = IN(buf); if (openfirmware(&args) == -1) return (-1); - return (args.flag); + return (OUT(args.flag)); } /* Set the value of a property of a package. */ @@ -332,19 +329,16 @@ OF_setprop(phandle_t package, const char *propname, void *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"setprop", - 4, - 1, - }; + } args = {}; + SETUP(args, "setprop", 4, 1); args.package = package; - args.propname = (cell_t)propname; - args.buf = (cell_t)buf; - args.len = len; + args.propname = IN(propname); + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Convert a device specifier to a fully qualified pathname. */ @@ -359,18 +353,15 @@ OF_canon(const char *device, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"canon", - 3, - 1, - }; - - args.device = (cell_t)device; - args.buf = (cell_t)buf; - args.len = len; + } args = {}; + SETUP(args, "canon", 3, 1); + + args.device = IN(device); + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Return a package handle for the specified device. */ @@ -383,13 +374,10 @@ OF_finddevice(const char *device) cell_t nreturns; cell_t device; cell_t package; - } args = { - (cell_t)"finddevice", - 1, - 1, - }; + } args = {}; + SETUP(args, "finddevice", 1, 1); - args.device = (cell_t)device; + args.device = IN(device); if (openfirmware(&args) == -1) return (-1); return (args.package); @@ -407,18 +395,15 @@ OF_instance_to_path(ihandle_t instance, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"instance-to-path", - 3, - 1, - }; + } args = {}; + SETUP(args, "instance-to-path", 3, 1); args.instance = instance; - args.buf = (cell_t)buf; - args.len = len; + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Return the fully qualified pathname corresponding to a package. */ @@ -433,18 +418,15 @@ OF_package_to_path(phandle_t package, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"package-to-path", - 3, - 1, - }; + } args = {}; + SETUP(args, "package-to-path", 3, 1); args.package = package; - args.buf = (cell_t)buf; - args.len = len; + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Call the method in the scope of a given instance. */ @@ -459,30 +441,26 @@ OF_call_method(char *method, ihandle_t instance, int nargs, int nreturns, ...) cell_t method; cell_t instance; cell_t args_n_results[12]; - } args = { - (cell_t)"call-method", - 2, - 1, - }; + } args = {}; + SETUP(args, "call-method", nargs + 2, nreturns + 1); cell_t *cp; int n; if (nargs > 6) return (-1); - args.nargs = nargs + 2; - args.nreturns = nreturns + 1; - args.method = (cell_t)method; + args.method = IN(method); args.instance = instance; va_start(ap, nreturns); for (cp = (cell_t *)(args.args_n_results + (n = nargs)); --n >= 0;) - *--cp = va_arg(ap, cell_t); + *--cp = IN(va_arg(ap, cell_t)); if (openfirmware(&args) == -1) return (-1); if (args.args_n_results[nargs]) - return (args.args_n_results[nargs]); - for (cp = (cell_t *)(args.args_n_results + nargs + (n = args.nreturns)); - --n > 0;) - *va_arg(ap, cell_t *) = *--cp; + return (OUT(args.args_n_results[nargs])); + /* XXX what if ihandles or phandles are returned */ + for (cp = (cell_t *)(args.args_n_results + nargs + + (n = be32toh(args.nreturns))); --n > 0;) + *va_arg(ap, cell_t *) = OUT(*--cp); va_end(ap); return (0); } @@ -501,13 +479,10 @@ OF_open(char *device) cell_t nreturns; cell_t device; cell_t instance; - } args = { - (cell_t)"open", - 1, - 1, - }; + } args = {}; + SETUP(args, "open", 1, 1); - args.device = (cell_t)device; + args.device = IN(device); if (openfirmware(&args) == -1 || args.instance == 0) { return (-1); } @@ -523,10 +498,8 @@ OF_close(ihandle_t instance) cell_t nargs; cell_t nreturns; cell_t instance; - } args = { - (cell_t)"close", - 1, - }; + } args = {}; + SETUP(args, "close", 1, 0); args.instance = instance; openfirmware(&args); @@ -544,19 +517,16 @@ OF_read(ihandle_t instance, void *addr, int len) cell_t addr; cell_t len; cell_t actual; - } args = { - (cell_t)"read", - 3, - 1, - }; + } args = {}; + SETUP(args, "read", 3, 1); args.instance = instance; - args.addr = (cell_t)addr; - args.len = len; + args.addr = IN(addr); + args.len = IN(len); #if defined(OPENFIRM_DEBUG) printf("OF_read: called with instance=%08x, addr=%p, len=%d\n", - args.instance, args.addr, args.len); + instance, addr, len); #endif if (openfirmware(&args) == -1) @@ -564,10 +534,10 @@ OF_read(ihandle_t instance, void *addr, int len) #if defined(OPENFIRM_DEBUG) printf("OF_read: returning instance=%d, addr=%p, len=%d, actual=%d\n", - args.instance, args.addr, args.len, args.actual); + args.instance, OUT(args.addr), OUT(args.len), OUT(args.actual)); #endif - return (args.actual); + return (OUT(args.actual)); } /* Write to an instance. */ @@ -582,18 +552,15 @@ OF_write(ihandle_t instance, void *addr, int len) cell_t addr; cell_t len; cell_t actual; - } args = { - (cell_t)"write", - 3, - 1, - }; + } args = {}; + SETUP(args, "write", 3, 1); args.instance = instance; - args.addr = (cell_t)addr; - args.len = len; + args.addr = IN(addr); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.actual); + return (OUT(args.actual)); } /* Seek to a position. */ @@ -608,18 +575,15 @@ OF_seek(ihandle_t instance, uint64_t pos) cell_t poshi; cell_t poslo; cell_t status; - } args = { - (cell_t)"seek", - 3, - 1, - }; + } args = {}; + SETUP(args, "seek", 3, 1); args.instance = instance; - args.poshi = pos >> 32; - args.poslo = pos; + args.poshi = IN(((uint64_t)pos >> 32)); + args.poslo = IN(pos); if (openfirmware(&args) == -1) return (-1); - return (args.status); + return (OUT(args.status)); } /* Blocks. */ @@ -633,16 +597,13 @@ OF_blocks(ihandle_t instance) cell_t instance; cell_t result; cell_t blocks; - } args = { - (cell_t)"#blocks", - 2, - 1, - }; + } args = {}; + SETUP(args, "#blocks", 2, 1); args.instance = instance; if (openfirmware(&args) == -1) return ((unsigned int)-1); - return (args.blocks); + return (OUT(args.blocks)); } /* Block size. */ @@ -656,16 +617,13 @@ OF_block_size(ihandle_t instance) cell_t instance; cell_t result; cell_t size; - } args = { - (cell_t)"block-size", - 2, - 1, - }; + } args = {}; + SETUP(args, "block-size", 2, 1); args.instance = instance; if (openfirmware(&args) == -1) return (512); - return (args.size); + return (OUT(args.size)); } /* @@ -684,18 +642,15 @@ OF_claim(void *virt, u_int size, u_int align) cell_t size; cell_t align; cell_t baseaddr; - } args = { - (cell_t)"claim", - 3, - 1, - }; - - args.virt = (cell_t)virt; - args.size = size; - args.align = align; + } args = {}; + SETUP(args, "claim", 3, 1); + + args.virt = IN(virt); + args.size = IN(size); + args.align = IN(align); if (openfirmware(&args) == -1) return ((void *)-1); - return ((void *)args.baseaddr); + return ((void *)OUT(args.baseaddr)); } /* Release an area of memory. */ @@ -708,13 +663,11 @@ OF_release(void *virt, u_int size) cell_t nreturns; cell_t virt; cell_t size; - } args = { - (cell_t)"release", - 2, - }; + } args = {}; + SETUP(args, "release", 2, 0); - args.virt = (cell_t)virt; - args.size = size; + args.virt = IN(virt); + args.size = IN(size); openfirmware(&args); } @@ -731,12 +684,10 @@ OF_boot(char *bootspec) cell_t nargs; cell_t nreturns; cell_t bootspec; - } args = { - (cell_t)"boot", - 1, - }; + } args = {}; + SETUP(args, "boot", 1, 0); - args.bootspec = (cell_t)bootspec; + args.bootspec = IN(bootspec); openfirmware(&args); for (;;) /* just in case */ ; @@ -750,9 +701,8 @@ OF_enter() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"enter", - }; + } args = {}; + SETUP(args, "enter", 0, 0); openfirmware(&args); /* We may come back. */ @@ -766,9 +716,8 @@ OF_exit() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"exit", - }; + } args = {}; + SETUP(args, "exit", 0, 0); openfirmware(&args); for (;;) /* just in case */ @@ -782,9 +731,8 @@ OF_quiesce() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"quiesce", - }; + } args = {}; + SETUP(args, "quiesce", 0, 0); openfirmware(&args); } @@ -803,16 +751,14 @@ OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len) cell_t entry; cell_t arg; cell_t len; - } args = { - (cell_t)"chain", - 5, - }; - - args.virt = (cell_t)virt; - args.size = size; - args.entry = (cell_t)entry; - args.arg = (cell_t)arg; - args.len = len; + } args = {}; + SETUP(args, "chain", 5, 0); + + args.virt = IN(virt); + args.size = IN(size); + args.entry = IN(entry); + args.arg = IN(arg); + args.len = IN(len); openfirmware(&args); } #else diff --git a/stand/libofw/openfirm.h b/stand/libofw/openfirm.h index b83cf4b0b27f..0981dbf093eb 100644 --- a/stand/libofw/openfirm.h +++ b/stand/libofw/openfirm.h @@ -65,9 +65,9 @@ #include #include -typedef unsigned int ihandle_t; -typedef unsigned int phandle_t; -typedef unsigned long int cell_t; +typedef uint32_t ihandle_t; +typedef uint32_t phandle_t; +typedef uint32_t cell_t; extern int (*openfirmware)(void *); extern phandle_t chosen; @@ -91,6 +91,7 @@ phandle_t OF_parent(phandle_t); phandle_t OF_instance_to_package(ihandle_t); int OF_getproplen(phandle_t, const char *); int OF_getprop(phandle_t, const char *, void *, int); +int OF_getencprop(phandle_t, const char *, cell_t *, int); int OF_nextprop(phandle_t, const char *, char *); int OF_setprop(phandle_t, const char *, void *, int); int OF_canon(const char *, char *, int); diff --git a/stand/powerpc/Makefile b/stand/powerpc/Makefile index 888fe0e97028..a16d3933ff7e 100644 --- a/stand/powerpc/Makefile +++ b/stand/powerpc/Makefile @@ -4,7 +4,11 @@ NO_OBJ=t .include -SUBDIR.yes= boot1.chrp ofw uboot +SUBDIR.yes= boot1.chrp ofw + +.if "${MACHINE_ARCH}" != "powerpc64le" +SUBDIR.${MK_FDT}+= uboot +.endif .if "${MACHINE_ARCH}" == "powerpc64" SUBDIR.${MK_FDT}+= kboot diff --git a/stand/powerpc/boot1.chrp/boot1.c b/stand/powerpc/boot1.chrp/boot1.c index 4d152efe1a70..ed7c55d11d6f 100644 --- a/stand/powerpc/boot1.chrp/boot1.c +++ b/stand/powerpc/boot1.chrp/boot1.c @@ -20,6 +20,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -82,11 +83,11 @@ static char *__ultoa(char *buf, u_long val, int base); */ typedef uint32_t ofwcell_t; typedef uint32_t u_ofwh_t; -typedef int (*ofwfp_t)(void *); +typedef int (*ofwfp_t)(ofwcell_t *); ofwfp_t ofw; /* the prom Open Firmware entry */ ofwh_t chosenh; -void ofw_init(void *, int, int (*)(void *), char *, int); +void ofw_init(void *, int, ofwfp_t, char *, int); static ofwh_t ofw_finddevice(const char *); static ofwh_t ofw_open(const char *); static int ofw_close(ofwh_t); @@ -101,6 +102,16 @@ static void ofw_exit(void) __dead2; ofwh_t bootdevh; ofwh_t stdinh, stdouth; +/* + * Note about the entry point: + * + * For some odd reason, the first page of the load appears to have trouble + * when entering in LE. The first five instructions decode weirdly. + * I suspect it is some cache weirdness between the ELF headers and .text. + * + * Ensure we have a gap between the start of .text and the entry as a + * workaround. + */ __asm(" \n\ .data \n\ .align 4 \n\ @@ -108,6 +119,8 @@ stack: \n\ .space 16384 \n\ \n\ .text \n\ + /* SLOF cache hack */ \n\ + .space 4096 \n\ .globl _start \n\ _start: \n\ lis %r1,stack@ha \n\ @@ -117,18 +130,95 @@ _start: \n\ b ofw_init \n\ "); +ofwfp_t realofw; + +#if BYTE_ORDER == LITTLE_ENDIAN +/* + * Minimal endianness-swap trampoline for LE. + */ +__attribute__((naked)) int +ofwtramp(void *buf, ofwfp_t cb) +{ +__asm(" \n\ + mflr %r0 \n\ + stw %r0, 4(%r1) \n\ + stwu %r1, -16(%r1) \n\ + stw %r30, 8(%r1) \n\ + /* Save current MSR for restoration post-call. */ \n\ + mfmsr %r30 \n\ + mr %r5, %r30 \n\ + /* Remove LE bit from MSR. */ \n\ + clrrwi %r5, %r5, 1 \n\ + mtsrr0 %r4 \n\ + mtsrr1 %r5 \n\ + bcl 20, 31, .+4 /* LOAD_LR_NIA */ \n\ +1: \n\ + mflr %r4 \n\ + addi %r4, %r4, (2f - 1b) \n\ + mtlr %r4 \n\ + /* Switch to BE and transfer control to OF entry */ \n\ + rfid \n\ +2: \n\ + /* Control is returned here, but in BE. */ \n\ + .long 0x05009f42 /* LOAD_LR_NIA */\n\ + /* 0: */\n\ + .long 0xa603db7f /* mtsrr1 %r30 */\n\ + .long 0xa602c87f /* mflr %r30 */\n\ + .long 0x1400de3b /* addi %r30, %r30, (1f - 0b) */\n\ + .long 0xa603da7f /* mtsrr0 %r30 */\n\ + .long 0x2400004c /* rfid */\n\ + /* 1: */\n\ +1: \n\ + /* Back to normal. Tidy up for return. */ \n\ + lwz %r30, 8(%r1) \n\ + lwz %r0, 20(%r1) \n\ + addi %r1, %r1, 16 \n\ + mtlr %r0 \n\ + blr \n\ +"); +} + +/* + * Little-endian OFW entrypoint replacement. + * + * We are doing all the byteswapping in one place here to save space. + * This means instance handles will be byteswapped as well. + */ +int +call_ofw(ofwcell_t* buf) +{ + int ret, i, ncells; + + ncells = 3 + buf[1] + buf[2]; + for (i = 0; i < ncells; i++) + buf[i] = htobe32(buf[i]); + + ret = (ofwtramp(buf, realofw)); + for (i = 0; i < ncells; i++) + buf[i] = be32toh(buf[i]); + return (ret); +} +#endif + void -ofw_init(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) +ofw_init(void *vpd, int res, ofwfp_t openfirm, char *arg, int argl) { char *av[16]; char *p; int ac; - ofw = openfirm; +#if BYTE_ORDER == LITTLE_ENDIAN + realofw = openfirm; + ofw = call_ofw; +#else + realofw = ofw = openfirm; +#endif chosenh = ofw_finddevice("/chosen"); ofw_getprop(chosenh, "stdin", &stdinh, sizeof(stdinh)); + stdinh = be32toh(stdinh); ofw_getprop(chosenh, "stdout", &stdouth, sizeof(stdouth)); + stdouth = be32toh(stdouth); ofw_getprop(chosenh, "bootargs", bootargs, sizeof(bootargs)); ofw_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath)); @@ -537,8 +627,8 @@ load(const char *fname) __syncicache(p, ph.p_memsz); } ofw_close(bootdev); - (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, - ofw,NULL,0); + (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, + realofw, NULL, 0); } static int diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index 7c2e97ebb382..03844301f094 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -28,11 +28,15 @@ CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/teken SRCS+= ofwfdt.c .endif -.if ${MACHINE_ARCH} == "powerpc64" +.if ${MACHINE_ARCH:Mpowerpc64*} != "" SRCS+= cas.c CFLAGS+= -DCAS .endif +.if ${MACHINE_ARCH} == "powerpc64le" +SRCS+= trampolineLE.S +.endif + HELP_FILES= ${FDTSRC}/help.fdt # Always add MI sources @@ -44,7 +48,13 @@ HELP_FILES= ${FDTSRC}/help.fdt RELOC?= 0x1C00000 CFLAGS+= -DRELOC=${RELOC} -g -LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc +LDFLAGS= -nostdlib -static + +.if ${MACHINE_ARCH} == "powerpc64le" +LDFLAGS+= -T ${.CURDIR}/ldscript.powerpcle +.else +LDFLAGS+= -T ${.CURDIR}/ldscript.powerpc +.endif # Open Firmware standalone support library LIBOFW= ${BOOTOBJ}/libofw/libofw.a diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c index 6292e04794a8..0a12f31d1a1a 100644 --- a/stand/powerpc/ofw/cas.c *** 372 LINES SKIPPED *** From nobody Wed Oct 20 23:31:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 95C9D17F402C; Wed, 20 Oct 2021 23:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZRhJ3tWMz4n3Z; Wed, 20 Oct 2021 23:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66045108D7; Wed, 20 Oct 2021 23:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19KNVSA9074531; Wed, 20 Oct 2021 23:31:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19KNVSbL074530; Wed, 20 Oct 2021 23:31:28 GMT (envelope-from git) Date: Wed, 20 Oct 2021 23:31:28 GMT Message-Id: <202110202331.19KNVSbL074530@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: 5c5340108e9c - main - net: Allow binding of unspecified address without address existance List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c5340108e9c2e384ca646720e17d037c69acc4c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5c5340108e9c2e384ca646720e17d037c69acc4c commit 5c5340108e9c2e384ca646720e17d037c69acc4c Author: Roy Marples AuthorDate: 2021-10-20 15:47:29 +0000 Commit: Ed Maste CommitDate: 2021-10-20 23:25:51 +0000 net: Allow binding of unspecified address without address existance Previously in_pcbbind_setup returned EADDRNOTAVAIL for empty V_in_ifaddrhead (i.e., no IPv4 addresses configured) and in6_pcbbind did the same for empty V_in6_ifaddrhead (no IPv6 addresses). An equivalent test has existed since 4.4-Lite. It was presumably done to avoid extra work (assuming the address isn't going to be found later). In normal system operation *_ifaddrhead will not be empty: they will at least have the loopback address(es). In practice no work will be avoided. Further, this case caused net/dhcpd to fail when run early in boot before assignment of any addresses. It should be possible to bind the unspecified address even if no addresses have been configured yet, so just remove the tests. The now-removed "XXX broken" comments were added in 59562606b9d3, which converted the ifaddr lists to TAILQs. As far as I (emaste) can tell the brokenness is the issue described above, not some aspect of the TAILQ conversion. PR: 253166 Reviewed by: ae, bz, donner, emaste, glebius MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D32563 --- sys/netinet/in_pcb.c | 2 -- sys/netinet6/in6_pcb.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 1a7639c0137b..b8b5c6fbdcd5 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -932,8 +932,6 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, INP_LOCK_ASSERT(inp); INP_HASH_LOCK_ASSERT(pcbinfo); - if (CK_STAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ - return (EADDRNOTAVAIL); laddr.s_addr = *laddrp; if (nam != NULL && laddr.s_addr != INADDR_ANY) return (EINVAL); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 9a5d69e16a1c..ad4cda9d48ab 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -173,8 +173,6 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); - if (CK_STAILQ_EMPTY(&V_in6_ifaddrhead)) /* XXX broken! */ - return (EADDRNOTAVAIL); if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) return (EINVAL); if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT|SO_REUSEPORT_LB)) == 0) From nobody Thu Oct 21 00:05:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D35AD1802DB2; Thu, 21 Oct 2021 00:05: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSS45Q1vz3CXd; Thu, 21 Oct 2021 00:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AF9A1134B; Thu, 21 Oct 2021 00:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L05uuf015032; Thu, 21 Oct 2021 00:05:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L05uVB015031; Thu, 21 Oct 2021 00:05:56 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:05:56 GMT Message-Id: <202110210005.19L05uVB015031@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: 9ce201f2ee3c - main - ping: fix parsing of options including '4' and '6' List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ce201f2ee3ca340032d9cc71d91a36b3b45a4c3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9ce201f2ee3ca340032d9cc71d91a36b3b45a4c3 commit 9ce201f2ee3ca340032d9cc71d91a36b3b45a4c3 Author: Alan Somers AuthorDate: 2021-10-06 22:54:59 +0000 Commit: Alan Somers CommitDate: 2021-10-21 00:05:43 +0000 ping: fix parsing of options including '4' and '6' ping uses a two-pass option parser. The first pass determines whether ipv4 or ipv6 is desired, and the second parses the rest of the options. But the first pass wrongly detects a '4' or '6' in an option's value as a request to use ipv6 or ipv6 respectively, for example in an invocation like "ping -c6 1.2.3.4". Fix this confusion by including all options in the first round of parsing, but ignoring those unrelated to ipv4/ipv6 selection. PR: 258048 Reported by: ghuckriede@blackberry.com Submitted by: ghuckriede@blackberry.com MFC after: 2 weeks Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D32344 --- sbin/ping/main.c | 14 +++++------ sbin/ping/main.h | 20 +++++++++++++++ sbin/ping/ping.c | 10 +------- sbin/ping/ping6.c | 20 ++++++--------- sbin/ping/tests/ping_test.sh | 58 +++++++++++++++++++++++++++++++++++++------- 5 files changed, 84 insertions(+), 38 deletions(-) diff --git a/sbin/ping/main.c b/sbin/ping/main.c index 01442679efff..c021e2c26b14 100644 --- a/sbin/ping/main.c +++ b/sbin/ping/main.c @@ -52,13 +52,11 @@ __FBSDID("$FreeBSD$"); #endif #if defined(INET) && defined(INET6) -#define OPTSTR ":46" +#define OPTSTR PING6OPTS PING4OPTS #elif defined(INET) -#define OPTSTR ":4" +#define OPTSTR PING4OPTS #elif defined(INET6) -#define OPTSTR ":6" -#else -#define OPTSTR "" +#define OPTSTR PING6OPTS #endif int @@ -82,7 +80,7 @@ main(int argc, char *argv[]) ipv6 = true; #endif - while ((ch = getopt(argc, argv, OPTSTR)) != -1) { + while ((ch = getopt(argc, argv, ":" OPTSTR)) != -1) { switch(ch) { #ifdef INET case '4': @@ -170,7 +168,7 @@ usage(void) "[-G sweepmaxsize]\n" " [-g sweepminsize] [-h sweepincrsize] [-i wait] " "[-l preload]\n" - " [-M mask | time] [-m ttl]" + " [-M mask | time] [-m ttl] " #ifdef IPSEC "[-P policy] " #endif @@ -188,7 +186,7 @@ usage(void) " [-z tos] IPv4-mcast-group\n" #endif /* INET */ #ifdef INET6 - "\tping [-6aADd" + "\tping [-6AaDd" #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) "E" #endif diff --git a/sbin/ping/main.h b/sbin/ping/main.h index f9707ccfb5ff..0f987e9a20ae 100644 --- a/sbin/ping/main.h +++ b/sbin/ping/main.h @@ -31,6 +31,26 @@ #ifndef MAIN_H #define MAIN_H 1 +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +#if defined(INET) && defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) + #define PING4ADDOPTS "P:" +#else + #define PING4ADDOPTS +#endif +#define PING4OPTS "4AaC:c:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" PING4ADDOPTS + +#if defined(INET6) && defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) + #define PING6ADDOPTS "P:" +#elif defined(INET6) && defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) + #define PING6ADDOPTS "ZE" +#else + #define PING6ADDOPTS +#endif +#define PING6OPTS "6Aab:C:c:Dde:fHI:i:k:l:m:nNoOp:qS:s:t:uvyYW:z:" PING6ADDOPTS + void usage(void) __dead2; #endif diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index fe197928085e..be535f72146a 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -301,15 +301,7 @@ ping(int argc, char *const *argv) alarmtimeout = df = preload = tos = pcp = 0; outpack = outpackhdr + sizeof(struct ip); - while ((ch = getopt(argc, argv, - "4AaC:c:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" -#ifdef IPSEC -#ifdef IPSEC_POLICY_IPSEC - "P:" -#endif /*IPSEC_POLICY_IPSEC*/ -#endif /*IPSEC*/ - )) != -1) - { + while ((ch = getopt(argc, argv, PING4OPTS)) != -1) { switch(ch) { case '4': /* This option is processed in main(). */ diff --git a/sbin/ping/ping6.c b/sbin/ping/ping6.c index 4cbeae770372..76a96f0631ff 100644 --- a/sbin/ping/ping6.c +++ b/sbin/ping/ping6.c @@ -293,7 +293,11 @@ static void pr_rthdr(void *, size_t); static int pr_bitrange(u_int32_t, int, int); static void pr_retip(struct ip6_hdr *, u_char *); static void summary(void); +#ifdef IPSEC +#ifdef IPSEC_POLICY_IPSEC static int setpolicy(int, char *); +#endif +#endif static char *nigroup(char *, int); int @@ -345,18 +349,8 @@ ping6(int argc, char *argv[]) alarmtimeout = preload = 0; datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN]; capdns = capdns_setup(); -#ifndef IPSEC -#define ADDOPTS -#else -#ifdef IPSEC_POLICY_IPSEC -#define ADDOPTS "P:" -#else -#define ADDOPTS "ZE" -#endif /*IPSEC_POLICY_IPSEC*/ -#endif - while ((ch = getopt(argc, argv, - "6k:b:C:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:z:" ADDOPTS)) != -1) { -#undef ADDOPTS + + while ((ch = getopt(argc, argv, PING6OPTS)) != -1) { switch (ch) { case '6': /* This option is processed in main(). */ @@ -2667,7 +2661,9 @@ pr_retip(struct ip6_hdr *ip6, u_char *end) nh = ip6->ip6_nxt; cp += hlen; while (end - cp >= 8) { +#ifdef IPSEC struct ah ah; +#endif switch (nh) { case IPPROTO_HOPOPTS: diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh index ed95594abbd2..54af89f4a22b 100644 --- a/sbin/ping/tests/ping_test.sh +++ b/sbin/ping/tests/ping_test.sh @@ -27,14 +27,23 @@ # # $FreeBSD$ +require_ipv4() { + if ! getaddrinfo -f inet localhost 1>/dev/null 2>&1; then + atf_skip "IPv4 is not configured" + fi +} +require_ipv6() { + if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then + atf_skip "IPv6 is not configured" + fi +} + atf_test_case ping_c1_s56_t1 ping_c1_s56_t1_head() { atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" } ping_c1_s56_t1_body() { - if ! getaddrinfo -f inet localhost 1>/dev/null 2>&1; then - atf_skip "IPv4 is not configured" - fi + require_ipv4 atf_check -s exit:0 -o save:std.out -e empty \ ping -4 -c 1 -s 56 -t 1 localhost check_ping_statistics std.out $(atf_get_srcdir)/ping_c1_s56_t1.out @@ -45,9 +54,7 @@ ping_6_c1_s8_t1_head() { atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" } ping_6_c1_s8_t1_body() { - if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then - atf_skip "IPv6 is not configured" - fi + require_ipv6 atf_check -s exit:0 -o save:std.out -e empty \ ping -6 -c 1 -s 8 -t 1 localhost check_ping_statistics std.out $(atf_get_srcdir)/ping_6_c1_s8_t1.out @@ -58,18 +65,51 @@ ping6_c1_s8_t1_head() { atf_set "descr" "Use IPv6 when invoked as ping6" } ping6_c1_s8_t1_body() { - if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then - atf_skip "IPv6 is not configured" - fi + require_ipv6 atf_check -s exit:0 -o save:std.out -e empty \ ping6 -c 1 -s 8 -t 1 localhost check_ping_statistics std.out $(atf_get_srcdir)/ping_6_c1_s8_t1.out } +ping_c1t6_head() { + atf_set "descr" "-t6 is not interpreted as -t -6 by ping" +} +ping_c1t6_body() { + require_ipv4 + atf_check -s exit:0 -o ignore -e empty ping -c1 -t6 127.0.0.1 +} + +ping6_c1t4_head() { + atf_set "descr" "-t4 is not interpreted as -t -4 by ping6" +} +ping6_c1t4_body() { + require_ipv6 + atf_check -s exit:0 -o ignore -e empty ping6 -c1 -t4 ::1 +} + +ping_46_head() { + atf_set "descr" "-4 and -6 may not be used together" +} +ping_46_body() { + atf_check -s exit:1 -e ignore ping -4 -6 +} + +ping6_46_head() { + atf_set "descr" "-4 and -6 may not be used together" +} +ping6_46_body() { + atf_check -s exit:1 -e ignore ping6 -4 -6 +} + + atf_init_test_cases() { atf_add_test_case ping_c1_s56_t1 atf_add_test_case ping_6_c1_s8_t1 atf_add_test_case ping6_c1_s8_t1 + atf_add_test_case ping_c1t6 + atf_add_test_case ping6_c1t4 + atf_add_test_case ping_46 + atf_add_test_case ping6_46 } check_ping_statistics() { From nobody Thu Oct 21 00:09:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9B681805BAD; Thu, 21 Oct 2021 00:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSWm4vd6z3FNZ; Thu, 21 Oct 2021 00:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 849A8110EA; Thu, 21 Oct 2021 00:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L098wV015465; Thu, 21 Oct 2021 00:09:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L098c3015464; Thu, 21 Oct 2021 00:09:08 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:09:08 GMT Message-Id: <202110210009.19L098c3015464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: ba2a30ed753c - stable/12 - cxgbe(4): Catch up with in-flight netmap rx before destroying queues. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba2a30ed753cafa9b1a12a1cc5ec290a780422b6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ba2a30ed753cafa9b1a12a1cc5ec290a780422b6 commit ba2a30ed753cafa9b1a12a1cc5ec290a780422b6 Author: Navdeep Parhar AuthorDate: 2020-11-21 03:27:32 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 18:24:03 +0000 cxgbe(4): Catch up with in-flight netmap rx before destroying queues. The netmap application using the driver is responsible for replenishing the receive freelists and they may be totally depleted when the application exits. Packets in flight, if any, might block the pipeline in case there aren't enough buffers left in the freelist. Avoid this by filling up the freelists with a driver allocated buffer. Sponsored by: Chelsio Communications (cherry picked from commit b3718e2d7ebfe7fc0bb57bd0906aacc28dd755b2) --- sys/dev/cxgbe/adapter.h | 3 +++ sys/dev/cxgbe/t4_netmap.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 18dd334a391c..a1006df3e987 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -737,6 +737,9 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; + + void *bb; /* bit bucket for packets with nowhere to go. */ + uma_zone_t bb_zone; }; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 2bee6040b10e..3dd3f42c5636 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -586,6 +588,8 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; + nm_rxq->bb_zone = rxb->zone; + nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK); slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL); /* XXXNM: error check, not assert */ @@ -628,6 +632,31 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, return (cxgbe_netmap_rss(sc, vi, ifp, na)); } +static void +flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq) +{ + int i, n; + u_int fl_pidx, fl_pidx_target, hw_cidx_desc; + const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb); + + hw_cidx_desc = nm_rxq->fl_cidx / 8; + if (hw_cidx_desc == 0) + fl_pidx_target = nm_rxq->fl_sidx2 - 8; + else + fl_pidx_target = (hw_cidx_desc - 1) * 8; + MPASS((fl_pidx_target & 7) == 0); + + fl_pidx = nm_rxq->fl_pidx; + MPASS((fl_pidx & 7) == 0); + for (n = 0; fl_pidx != fl_pidx_target; n++) { + for (i = 0; i < 8; i++, fl_pidx++) + nm_rxq->fl_desc[fl_pidx] = htobe64(ba | nm_rxq->fl_hwidx); + if (__predict_false(fl_pidx == nm_rxq->fl_sidx2)) + fl_pidx = 0; + } + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n)); +} + static int cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, struct netmap_adapter *na) @@ -652,6 +681,23 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, if (rc != 0) return (rc); /* error message logged already. */ + /* + * First pass over the rx queues to make sure they're all caught up. + * + * The freelists could be out of buffers and we may need to arrange + * things so that any packets still in flight (after TP's cong_drop + * logic but not yet DMA'd) have somewhere to go and do not block the + * pipeline. Do this before trying to free any queue. + */ + for_each_nm_rxq(vi, i, nm_rxq) { + nm_state = atomic_load_int(&nm_rxq->nm_state); + kring = na->rx_rings[nm_rxq->nid]; + if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) + continue; + MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + flush_nm_rxq(sc, vi, nm_rxq); + } + for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; @@ -688,6 +734,8 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, pause("nmst", 1); free_nm_rxq_hwq(vi, nm_rxq); + uma_zfree(nm_rxq->bb_zone, nm_rxq->bb); + nm_rxq->bb = NULL; /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; From nobody Thu Oct 21 00:09:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2ABF71805C1B; Thu, 21 Oct 2021 00:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSWn70WLz3FJB; Thu, 21 Oct 2021 00:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEE1B114D1; Thu, 21 Oct 2021 00:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L099ZF015489; Thu, 21 Oct 2021 00:09:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L099Di015488; Thu, 21 Oct 2021 00:09:09 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:09:09 GMT Message-Id: <202110210009.19L099Di015488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: d31b8f0dece1 - stable/12 - cxgbe(4): Revert r367917. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d31b8f0dece18bb5c301a71200d8a8c03ab84602 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=d31b8f0dece18bb5c301a71200d8a8c03ab84602 commit d31b8f0dece18bb5c301a71200d8a8c03ab84602 Author: Navdeep Parhar AuthorDate: 2020-12-02 20:54:03 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 18:26:49 +0000 cxgbe(4): Revert r367917. r367917 fixed the backpressure on the netmap rxq being stopped but that doesn't help if some other netmap rxq is starved (because it is stopping too although the driver doesn't know this yet) and blocks the pipeline. An alternate fix that works in all cases will be checked in instead. Sponsored by: Chelsio Communications (cherry picked from commit f42f3b2955e5afa770275fd76b4f754fbd67bbeb) --- sys/dev/cxgbe/adapter.h | 3 --- sys/dev/cxgbe/t4_netmap.c | 48 ----------------------------------------------- 2 files changed, 51 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index a1006df3e987..18dd334a391c 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -737,9 +737,6 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; - - void *bb; /* bit bucket for packets with nowhere to go. */ - uma_zone_t bb_zone; }; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 3dd3f42c5636..2bee6040b10e 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -588,8 +586,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; - nm_rxq->bb_zone = rxb->zone; - nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK); slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL); /* XXXNM: error check, not assert */ @@ -632,31 +628,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, return (cxgbe_netmap_rss(sc, vi, ifp, na)); } -static void -flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq) -{ - int i, n; - u_int fl_pidx, fl_pidx_target, hw_cidx_desc; - const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb); - - hw_cidx_desc = nm_rxq->fl_cidx / 8; - if (hw_cidx_desc == 0) - fl_pidx_target = nm_rxq->fl_sidx2 - 8; - else - fl_pidx_target = (hw_cidx_desc - 1) * 8; - MPASS((fl_pidx_target & 7) == 0); - - fl_pidx = nm_rxq->fl_pidx; - MPASS((fl_pidx & 7) == 0); - for (n = 0; fl_pidx != fl_pidx_target; n++) { - for (i = 0; i < 8; i++, fl_pidx++) - nm_rxq->fl_desc[fl_pidx] = htobe64(ba | nm_rxq->fl_hwidx); - if (__predict_false(fl_pidx == nm_rxq->fl_sidx2)) - fl_pidx = 0; - } - t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n)); -} - static int cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, struct netmap_adapter *na) @@ -681,23 +652,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, if (rc != 0) return (rc); /* error message logged already. */ - /* - * First pass over the rx queues to make sure they're all caught up. - * - * The freelists could be out of buffers and we may need to arrange - * things so that any packets still in flight (after TP's cong_drop - * logic but not yet DMA'd) have somewhere to go and do not block the - * pipeline. Do this before trying to free any queue. - */ - for_each_nm_rxq(vi, i, nm_rxq) { - nm_state = atomic_load_int(&nm_rxq->nm_state); - kring = na->rx_rings[nm_rxq->nid]; - if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) - continue; - MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); - flush_nm_rxq(sc, vi, nm_rxq); - } - for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; @@ -734,8 +688,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, pause("nmst", 1); free_nm_rxq_hwq(vi, nm_rxq); - uma_zfree(nm_rxq->bb_zone, nm_rxq->bb); - nm_rxq->bb = NULL; /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; From nobody Thu Oct 21 00:09:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3578318056E3; Thu, 21 Oct 2021 00:09:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSWp6Xdrz3FLZ; Thu, 21 Oct 2021 00:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5C64111C9; Thu, 21 Oct 2021 00:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L09A7t015518; Thu, 21 Oct 2021 00:09:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L09AIY015516; Thu, 21 Oct 2021 00:09:10 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:09:10 GMT Message-Id: <202110210009.19L09AIY015516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 1f4943c92cdd - stable/12 - cxgbe(4): Stop but don't free netmap queues when netmap is switched off. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1f4943c92cdd783e31a7c145660e8ac961aaabbd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=1f4943c92cdd783e31a7c145660e8ac961aaabbd commit 1f4943c92cdd783e31a7c145660e8ac961aaabbd Author: Navdeep Parhar AuthorDate: 2020-12-03 08:30:29 +0000 Commit: Navdeep Parhar CommitDate: 2021-10-20 20:55:36 +0000 cxgbe(4): Stop but don't free netmap queues when netmap is switched off. It is common for freelists to be starving when a netmap application stops. Mailbox commands to free queues can hang in such a situation. Avoid that by not freeing the queues when netmap is switched off. Instead, use an alternate method to stop the queues without releasing the context ids. If netmap is enabled again later then the same queue is reinitialized for use. Move alloc_nm_rxq and txq to t4_netmap.c while here. Sponsored by: Chelsio Communications (cherry picked from commit 8eba75ed68854188c01a2058fe1f826b3428dbfa) --- sys/dev/cxgbe/adapter.h | 11 +++ sys/dev/cxgbe/common/common.h | 2 + sys/dev/cxgbe/common/t4_hw.c | 26 +++++ sys/dev/cxgbe/t4_netmap.c | 220 +++++++++++++++++++++++++++++++++++++----- sys/dev/cxgbe/t4_sge.c | 175 +-------------------------------- 5 files changed, 237 insertions(+), 197 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 18dd334a391c..358c5c6dfcf5 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1221,6 +1221,12 @@ struct sge_nm_rxq; void cxgbe_nm_attach(struct vi_info *); void cxgbe_nm_detach(struct vi_info *); void service_nm_rxq(struct sge_nm_rxq *); +int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, + struct sysctl_oid *); +int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); +int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, + struct sysctl_oid *); +int free_nm_txq(struct vi_info *, struct sge_nm_txq *); #endif /* t4_sge.c */ @@ -1233,6 +1239,11 @@ int t4_create_dma_tag(struct adapter *); void t4_sge_sysctls(struct adapter *, struct sysctl_ctx_list *, struct sysctl_oid_list *); int t4_destroy_dma_tag(struct adapter *); +int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, + bus_addr_t *, void **); +int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + void *); +int sysctl_uint16(SYSCTL_HANDLER_ARGS); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 522b52f141bf..3ed9040e9581 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -840,6 +840,8 @@ int t4_iq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid); int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid); int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 6e78b5a4f762..427c0ff914c2 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -8619,6 +8619,32 @@ int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } +/** + * t4_eth_eq_stop - stop an Ethernet egress queue + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @pf: the PF owning the queues + * @vf: the VF owning the queues + * @eqid: egress queue id + * + * Stops an Ethernet egress queue. The queue can be reinitialized or + * freed but is not otherwise functional after this call. + */ +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid) +{ + struct fw_eq_eth_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_EQ_ETH_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_EXEC | + V_FW_EQ_ETH_CMD_PFN(pf) | + V_FW_EQ_ETH_CMD_VFN(vf)); + c.alloc_to_len16 = cpu_to_be32(F_FW_EQ_ETH_CMD_EQSTOP | FW_LEN16(c)); + c.eqid_pkd = cpu_to_be32(V_FW_EQ_ETH_CMD_EQID(eqid)); + return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); +} + /** * t4_eth_eq_free - free an Ethernet egress queue * @adap: the adapter diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 2bee6040b10e..29284d76bdda 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -120,6 +120,166 @@ static int nm_txcsum = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_txcsum, CTLFLAG_RWTUN, &nm_txcsum, 0, "Enable transmit checksum offloading."); +static int free_nm_rxq_hwq(struct vi_info *, struct sge_nm_rxq *); +static int free_nm_txq_hwq(struct vi_info *, struct sge_nm_txq *); + +int +alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, + int idx, struct sysctl_oid *oid) +{ + int rc; + struct sysctl_oid_list *children; + struct sysctl_ctx_list *ctx; + char name[16]; + size_t len; + struct adapter *sc = vi->adapter; + struct netmap_adapter *na = NA(vi->ifp); + + MPASS(na != NULL); + + len = vi->qsize_rxq * IQ_ESIZE; + rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, + &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); + if (rc != 0) + return (rc); + + len = na->num_rx_desc * EQ_ESIZE + sc->params.sge.spg_len; + rc = alloc_ring(sc, len, &nm_rxq->fl_desc_tag, &nm_rxq->fl_desc_map, + &nm_rxq->fl_ba, (void **)&nm_rxq->fl_desc); + if (rc != 0) + return (rc); + + nm_rxq->vi = vi; + nm_rxq->nid = idx; + nm_rxq->iq_cidx = 0; + nm_rxq->iq_sidx = vi->qsize_rxq - sc->params.sge.spg_len / IQ_ESIZE; + nm_rxq->iq_gen = F_RSPD_GEN; + nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; + nm_rxq->fl_sidx = na->num_rx_desc; + nm_rxq->fl_sidx2 = nm_rxq->fl_sidx; /* copy for rxsync cacheline */ + nm_rxq->intr_idx = intr_idx; + nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; + + ctx = &vi->ctx; + children = SYSCTL_CHILDREN(oid); + + snprintf(name, sizeof(name), "%d", idx); + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_abs_id, + 0, sysctl_uint16, "I", "absolute id of the queue"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cntxt_id, + 0, sysctl_uint16, "I", "SGE context id of the queue"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cidx, 0, + sysctl_uint16, "I", "consumer index"); + + children = SYSCTL_CHILDREN(oid); + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->fl_cntxt_id, + 0, sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_rxq->fl_cidx, 0, "consumer index"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &nm_rxq->fl_pidx, 0, "producer index"); + + return (rc); +} + +int +free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) +{ + struct adapter *sc = vi->adapter; + + if (!(vi->flags & VI_INIT_DONE)) + return (0); + + if (nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID) + free_nm_rxq_hwq(vi, nm_rxq); + MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); + + free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, + nm_rxq->iq_desc); + free_ring(sc, nm_rxq->fl_desc_tag, nm_rxq->fl_desc_map, nm_rxq->fl_ba, + nm_rxq->fl_desc); + + return (0); +} + +int +alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, + struct sysctl_oid *oid) +{ + int rc; + size_t len; + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; + struct netmap_adapter *na = NA(vi->ifp); + char name[16]; + struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); + + len = na->num_tx_desc * EQ_ESIZE + sc->params.sge.spg_len; + rc = alloc_ring(sc, len, &nm_txq->desc_tag, &nm_txq->desc_map, + &nm_txq->ba, (void **)&nm_txq->desc); + if (rc) + return (rc); + + nm_txq->pidx = nm_txq->cidx = 0; + nm_txq->sidx = na->num_tx_desc; + nm_txq->nid = idx; + nm_txq->iqidx = iqidx; + nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | + V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | + V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); + if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); + else + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); + nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; + + snprintf(name, sizeof(name), "%d", idx); + oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap tx queue"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_txq->cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->cidx, 0, + sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->pidx, 0, + sysctl_uint16, "I", "producer index"); + + return (rc); +} + +int +free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) +{ + struct adapter *sc = vi->adapter; + + if (!(vi->flags & VI_INIT_DONE)) + return (0); + + if (nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID) + free_nm_txq_hwq(vi, nm_txq); + MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); + + free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, + nm_txq->desc); + + return (0); +} + static int alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) { @@ -141,8 +301,15 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_IQ_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_IQ_CMD_PFN(sc->pf) | V_FW_IQ_CMD_VFN(0)); - c.alloc_to_len16 = htobe32(F_FW_IQ_CMD_ALLOC | F_FW_IQ_CMD_IQSTART | - FW_LEN16(c)); + c.alloc_to_len16 = htobe32(F_FW_IQ_CMD_IQSTART | FW_LEN16(c)); + if (nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID) + c.alloc_to_len16 |= htobe32(F_FW_IQ_CMD_ALLOC); + else { + c.iqid = htobe16(nm_rxq->iq_cntxt_id); + c.fl0id = htobe16(nm_rxq->fl_cntxt_id); + c.fl1id = htobe16(0xffff); + c.physiqid = htobe16(nm_rxq->iq_abs_id); + } MPASS(!forwarding_intr_to_fwq(sc)); KASSERT(nm_rxq->intr_idx < sc->intr_count, ("%s: invalid direct intr_idx %d", __func__, nm_rxq->intr_idx)); @@ -276,8 +443,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq *nm_txq) c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_EQ_ETH_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_EQ_ETH_CMD_PFN(sc->pf) | V_FW_EQ_ETH_CMD_VFN(0)); - c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_ALLOC | - F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); + c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); + if (nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID) + c.alloc_to_len16 |= htobe32(F_FW_EQ_ETH_CMD_ALLOC); + else + c.eqid_pkd = htobe32(V_FW_EQ_ETH_CMD_EQID(nm_txq->cntxt_id)); c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUIQE | F_FW_EQ_ETH_CMD_AUTOEQUEQE | V_FW_EQ_ETH_CMD_VIID(vi->viid)); c.fetchszm_to_iqid = @@ -580,8 +750,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, for_each_nm_rxq(vi, i, nm_rxq) { kring = na->rx_rings[nm_rxq->nid]; - if (!nm_kring_pending_on(kring) || - nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID) + if (!nm_kring_pending_on(kring)) continue; alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); @@ -611,8 +780,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, for_each_nm_txq(vi, i, nm_txq) { kring = na->tx_rings[nm_txq->nid]; - if (!nm_kring_pending_on(kring) || - nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID) + if (!nm_kring_pending_on(kring)) continue; alloc_nm_txq_hwq(vi, nm_txq); @@ -653,22 +821,17 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, return (rc); /* error message logged already. */ for_each_nm_txq(vi, i, nm_txq) { - struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; - kring = na->tx_rings[nm_txq->nid]; - if (!nm_kring_pending_off(kring) || - nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID) + if (!nm_kring_pending_off(kring)) continue; + MPASS(nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID); - /* Wait for hw pidx to catch up ... */ - while (be16toh(nm_txq->pidx) != spg->pidx) - pause("nmpidx", 1); - - /* ... and then for the cidx. */ - while (spg->pidx != spg->cidx) - pause("nmcidx", 1); - - free_nm_txq_hwq(vi, nm_txq); + rc = -t4_eth_eq_stop(sc, sc->mbox, sc->pf, 0, nm_txq->cntxt_id); + if (rc != 0) { + device_printf(vi->dev, + "failed to stop nm_txq[%d]: %d.\n", i, rc); + return (rc); + } /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; @@ -680,15 +843,22 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, kring = na->rx_rings[nm_rxq->nid]; if (nm_state != NM_OFF && !nm_kring_pending_off(kring)) nactive++; - if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) + if (!nm_kring_pending_off(kring)) continue; - + MPASS(nm_state != NM_OFF); MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + + rc = -t4_iq_stop(sc, sc->mbox, sc->pf, 0, FW_IQ_TYPE_FL_INT_CAP, + nm_rxq->iq_cntxt_id, nm_rxq->fl_cntxt_id, 0xffff); + if (rc != 0) { + device_printf(vi->dev, + "failed to stop nm_rxq[%d]: %d.\n", i, rc); + return (rc); + } + while (!atomic_cmpset_int(&nm_rxq->nm_state, NM_ON, NM_OFF)) pause("nmst", 1); - free_nm_rxq_hwq(vi, nm_rxq); - /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; kring->rtail = kring->nr_hwtail = 0; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 4489d40e9fe4..c6ff34a7c17b 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -234,10 +234,6 @@ static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, char *); static inline void init_eq(struct adapter *, struct sge_eq *, int, int, uint8_t, uint16_t, char *); -static int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, - bus_addr_t *, void **); -static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, - void *); static int alloc_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *, int, int); static int free_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *); @@ -257,14 +253,6 @@ static int alloc_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *, int, int, struct sysctl_oid *); static int free_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *); #endif -#ifdef DEV_NETMAP -static int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, - struct sysctl_oid *); -static int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); -static int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, - struct sysctl_oid *); -static int free_nm_txq(struct vi_info *, struct sge_nm_txq *); -#endif static int ctrl_eq_alloc(struct adapter *, struct sge_eq *); static int eth_eq_alloc(struct adapter *, struct vi_info *, struct sge_eq *); #if defined(TCP_OFFLOAD) || defined(RATELIMIT) @@ -321,7 +309,6 @@ static int t4_handle_wrerr_rpl(struct adapter *, const __be64 *); static void wrq_tx_drain(void *, int); static void drain_wrq_wr_list(struct adapter *, struct sge_wrq *); -static int sysctl_uint16(SYSCTL_HANDLER_ARGS); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT static inline u_int txpkt_eo_len16(u_int, u_int, u_int); @@ -3312,7 +3299,7 @@ init_eq(struct adapter *sc, struct sge_eq *eq, int eqtype, int qsize, strlcpy(eq->lockname, name, sizeof(eq->lockname)); } -static int +int alloc_ring(struct adapter *sc, size_t len, bus_dma_tag_t *tag, bus_dmamap_t *map, bus_addr_t *pa, void **va) { @@ -3344,7 +3331,7 @@ done: return (rc); } -static int +int free_ring(struct adapter *sc, bus_dma_tag_t tag, bus_dmamap_t map, bus_addr_t pa, void *va) { @@ -3861,162 +3848,6 @@ free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) } #endif -#ifdef DEV_NETMAP -static int -alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, - int idx, struct sysctl_oid *oid) -{ - int rc; - struct sysctl_oid_list *children; - struct sysctl_ctx_list *ctx; - char name[16]; - size_t len; - struct adapter *sc = vi->adapter; - struct netmap_adapter *na = NA(vi->ifp); - - MPASS(na != NULL); - - len = vi->qsize_rxq * IQ_ESIZE; - rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, - &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); - if (rc != 0) - return (rc); - - len = na->num_rx_desc * EQ_ESIZE + sc->params.sge.spg_len; - rc = alloc_ring(sc, len, &nm_rxq->fl_desc_tag, &nm_rxq->fl_desc_map, - &nm_rxq->fl_ba, (void **)&nm_rxq->fl_desc); - if (rc != 0) - return (rc); - - nm_rxq->vi = vi; - nm_rxq->nid = idx; - nm_rxq->iq_cidx = 0; - nm_rxq->iq_sidx = vi->qsize_rxq - sc->params.sge.spg_len / IQ_ESIZE; - nm_rxq->iq_gen = F_RSPD_GEN; - nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; - nm_rxq->fl_sidx = na->num_rx_desc; - nm_rxq->fl_sidx2 = nm_rxq->fl_sidx; /* copy for rxsync cacheline */ - nm_rxq->intr_idx = intr_idx; - nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; - - ctx = &vi->ctx; - children = SYSCTL_CHILDREN(oid); - - snprintf(name, sizeof(name), "%d", idx); - oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, CTLFLAG_RD, NULL, - "rx queue"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_abs_id, 0, sysctl_uint16, - "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_cntxt_id, 0, sysctl_uint16, - "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_cidx, 0, sysctl_uint16, "I", - "consumer index"); - - children = SYSCTL_CHILDREN(oid); - oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", CTLFLAG_RD, NULL, - "freelist"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->fl_cntxt_id, 0, sysctl_uint16, - "I", "SGE context id of the freelist"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, - &nm_rxq->fl_cidx, 0, "consumer index"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, - &nm_rxq->fl_pidx, 0, "producer index"); - - return (rc); -} - - -static int -free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) -{ - struct adapter *sc = vi->adapter; - - if (vi->flags & VI_INIT_DONE) - MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); - else - MPASS(nm_rxq->iq_cntxt_id == 0); - - free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, - nm_rxq->iq_desc); - free_ring(sc, nm_rxq->fl_desc_tag, nm_rxq->fl_desc_map, nm_rxq->fl_ba, - nm_rxq->fl_desc); - - return (0); -} - -static int -alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, - struct sysctl_oid *oid) -{ - int rc; - size_t len; - struct port_info *pi = vi->pi; - struct adapter *sc = pi->adapter; - struct netmap_adapter *na = NA(vi->ifp); - char name[16]; - struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); - - len = na->num_tx_desc * EQ_ESIZE + sc->params.sge.spg_len; - rc = alloc_ring(sc, len, &nm_txq->desc_tag, &nm_txq->desc_map, - &nm_txq->ba, (void **)&nm_txq->desc); - if (rc) - return (rc); - - nm_txq->pidx = nm_txq->cidx = 0; - nm_txq->sidx = na->num_tx_desc; - nm_txq->nid = idx; - nm_txq->iqidx = iqidx; - nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | - V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | - V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); - if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) - nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); - else - nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); - nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; - - snprintf(name, sizeof(name), "%d", idx); - oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD, - NULL, "netmap tx queue"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, - &nm_txq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD, &nm_txq->cidx, 0, sysctl_uint16, "I", - "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD, &nm_txq->pidx, 0, sysctl_uint16, "I", - "producer index"); - - return (rc); -} - -static int -free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) -{ - struct adapter *sc = vi->adapter; - - if (vi->flags & VI_INIT_DONE) - MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); - else - MPASS(nm_txq->cntxt_id == 0); - - free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, - nm_txq->desc); - - return (0); -} -#endif - /* * Returns a reasonable automatic cidx flush threshold for a given queue size. */ @@ -6029,7 +5860,7 @@ t4_handle_wrerr_rpl(struct adapter *adap, const __be64 *rpl) return (0); } -static int +int sysctl_uint16(SYSCTL_HANDLER_ARGS) { uint16_t *id = arg1; From nobody Thu Oct 21 00:10:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1D9C1806CD8; Thu, 21 Oct 2021 00:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSYp4k7Bz3GTy; Thu, 21 Oct 2021 00:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82D1B116B9; Thu, 21 Oct 2021 00:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L0Ase7024847; Thu, 21 Oct 2021 00:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L0Asb2024846; Thu, 21 Oct 2021 00:10:54 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:10:54 GMT Message-Id: <202110210010.19L0Asb2024846@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: 33dba3bb0ec2 - main - rtld-elf/paths.h: Make it usable outside rtld List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33dba3bb0ec2a0f0a401bed145cc0ef95f37a5c3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=33dba3bb0ec2a0f0a401bed145cc0ef95f37a5c3 commit 33dba3bb0ec2a0f0a401bed145cc0ef95f37a5c3 Author: Konstantin Belousov AuthorDate: 2021-10-12 15:50:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 00:08:54 +0000 rtld-elf/paths.h: Make it usable outside rtld but still for tightly coupled things like ldd(1) Rename paths.h to rtld_paths.h. Add guard for rtld-specific externs declarations. Add _COMPAT32_BASENAME_RTLD and _COMPAT32_PATH_RTLD. Reviewed by: arichardson, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32464 --- libexec/rtld-elf/arm/reloc.c | 2 +- libexec/rtld-elf/libmap.c | 2 +- libexec/rtld-elf/rtld.c | 2 +- libexec/rtld-elf/rtld_malloc.c | 2 +- libexec/rtld-elf/{paths.h => rtld_paths.h} | 18 ++++++++++++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index 4e551b0948ad..b6eafa59b299 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -16,7 +16,7 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "rtld.h" -#include "paths.h" +#include "rtld_paths.h" #ifdef __ARM_FP /* diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index e4388d14b951..854c73f39ef7 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -16,7 +16,7 @@ #include "debug.h" #include "rtld.h" #include "libmap.h" -#include "paths.h" +#include "rtld_paths.h" #include "rtld_libc.h" TAILQ_HEAD(lm_list, lm); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index d598bb044f8e..8b1f84c6901a 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "rtld.h" #include "libmap.h" -#include "paths.h" +#include "rtld_paths.h" #include "rtld_tls.h" #include "rtld_printf.h" #include "rtld_malloc.h" diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index 63fa6f5e2ee7..d08254b67d9f 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -55,7 +55,7 @@ static char *rcsid = "$FreeBSD$"; #include #include "rtld.h" #include "rtld_printf.h" -#include "paths.h" +#include "rtld_paths.h" /* * Pre-allocate mmap'ed pages diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/rtld_paths.h similarity index 88% rename from libexec/rtld-elf/paths.h rename to libexec/rtld-elf/rtld_paths.h index 75f3b1d47dd4..4ce423ce6dbb 100644 --- a/libexec/rtld-elf/paths.h +++ b/libexec/rtld-elf/rtld_paths.h @@ -26,15 +26,19 @@ * $FreeBSD$ */ -#ifndef PATHS_H -#define PATHS_H +#ifndef _RTLD_PATHS_H +#define _RTLD_PATHS_H #undef _PATH_ELF_HINTS +#ifndef _COMPAT32_BASENAME_RTLD +#define _COMPAT32_BASENAME_RTLD "ld-elf32.so.1" +#endif + #ifdef COMPAT_32BIT #define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints" #define _PATH_LIBMAP_CONF "/etc/libmap32.conf" -#define _BASENAME_RTLD "ld-elf32.so.1" +#define _BASENAME_RTLD _COMPAT32_BASENAME_RTLD #define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32" #define LD_ "LD_32_" #endif @@ -55,6 +59,10 @@ #define _PATH_RTLD "/libexec/" _BASENAME_RTLD #endif +#ifndef _COMPAT32_PATH_RTLD +#define _COMPAT32_PATH_RTLD "/libexec/" _COMPAT32_BASENAME_RTLD +#endif + #ifndef STANDARD_LIBRARY_PATH #define STANDARD_LIBRARY_PATH "/lib/casper:/lib:/usr/lib" #endif @@ -69,10 +77,12 @@ #define SOFT_STANDARD_LIBRARY_PATH "/usr/libsoft" #define LD_SOFT_ "LD_SOFT_" +#ifdef IN_RTLD extern const char *ld_elf_hints_default; extern const char *ld_path_libmap_conf; extern const char *ld_path_rtld; extern const char *ld_standard_library_path; extern const char *ld_env_prefix; +#endif -#endif /* PATHS_H */ +#endif /* _RTLD_PATHS_H */ From nobody Thu Oct 21 00:10:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 299601806C73; Thu, 21 Oct 2021 00:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSYr0GCGz3GWX; Thu, 21 Oct 2021 00:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C11A41135D; Thu, 21 Oct 2021 00:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L0AtKp024872; Thu, 21 Oct 2021 00:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L0AtMN024871; Thu, 21 Oct 2021 00:10:55 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:10:55 GMT Message-Id: <202110210010.19L0AtMN024871@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: ca8c576d10e2 - main - ldd: style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca8c576d10e22830d0c7ac865af21aad9ae44181 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ca8c576d10e22830d0c7ac865af21aad9ae44181 commit ca8c576d10e22830d0c7ac865af21aad9ae44181 Author: Konstantin Belousov AuthorDate: 2021-10-12 11:39:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 00:09:03 +0000 ldd: style Reviewed by: arichardson, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32464 --- usr.bin/ldd/ldd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 3353345d549d..ee3f2070598d 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { char *fmt1, *fmt2; - int rval, c, aflag; + int aflag, c, fd, rval, status, is_shlib, rv, type; aflag = 0; fmt1 = fmt2 = NULL; @@ -167,8 +167,6 @@ main(int argc, char *argv[]) rval = 0; for (; argc > 0; argc--, argv++) { - int fd, status, is_shlib, rv, type; - if ((fd = open(*argv, O_RDONLY, 0)) < 0) { warn("%s", *argv); rval |= 1; @@ -244,7 +242,7 @@ main(int argc, char *argv[]) } } - return rval; + return (rval); } static void From nobody Thu Oct 21 00:10:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53BC61806E28; Thu, 21 Oct 2021 00:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZSYs0VL4z3GMp; Thu, 21 Oct 2021 00:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D646E114E6; Thu, 21 Oct 2021 00:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L0AuSt024902; Thu, 21 Oct 2021 00:10:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L0AuFr024901; Thu, 21 Oct 2021 00:10:56 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:10:56 GMT Message-Id: <202110210010.19L0AuFr024901@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: 2c7a6dad4de1 - main - ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c7a6dad4de17c357eb91c723bad860c6512a598 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2c7a6dad4de17c357eb91c723bad860c6512a598 commit 2c7a6dad4de17c357eb91c723bad860c6512a598 Author: Konstantin Belousov AuthorDate: 2021-10-11 22:35:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 00:09:14 +0000 ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified Problem is that rtld cannot reliably access updated environment. This was made more obvious by bfd4c875a10560aaa2. The application environment can be in arbitrary state and place, system components can observe it only during execve(2), or in case of rtld, right after execve, when environment is still at know location and format. Instead spawn ld-elf.so.1 in direct exec mode which can correctly read all inherited updates to the environment. PR: 259069 Reviewed by: arichardson, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32464 --- usr.bin/ldd/Makefile | 1 + usr.bin/ldd/ldd.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile index 78e551d80a33..1a671bc9f402 100644 --- a/usr.bin/ldd/Makefile +++ b/usr.bin/ldd/Makefile @@ -3,6 +3,7 @@ PROG?= ldd SRCS= ldd.c +CFLAGS+= -I${SRCTOP}/libexec/rtld-elf LIBADD= elf .include diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index ee3f2070598d..492e29dff211 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -134,6 +135,7 @@ int main(int argc, char *argv[]) { char *fmt1, *fmt2; + const char *rtld; int aflag, c, fd, rval, status, is_shlib, rv, type; aflag = 0; @@ -234,9 +236,17 @@ main(int argc, char *argv[]) if (is_shlib == 0) { execl(*argv, *argv, (char *)NULL); warn("%s", *argv); - } else { + } else if (fmt1 == NULL && fmt2 == NULL) { dlopen(*argv, RTLD_TRACE); warnx("%s: %s", *argv, dlerror()); + } else { + rtld = _PATH_RTLD; +#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) + if (type == TYPE_ELF32) + rtld = _COMPAT32_PATH_RTLD; +#endif + execl(rtld, rtld, "-d", "--", + *argv, (char *)NULL); } _exit(1); } From nobody Thu Oct 21 00:45:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 14A111814E72; Thu, 21 Oct 2021 00:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZTKb6ddYz3Qww; Thu, 21 Oct 2021 00:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD56B11C4F; Thu, 21 Oct 2021 00:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L0jN42068100; Thu, 21 Oct 2021 00:45:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L0jNTk068099; Thu, 21 Oct 2021 00:45:23 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:45:23 GMT Message-Id: <202110210045.19L0jNTk068099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 27c4d9242bf0 - releng/12.3 - 12.3: create releng/12.3 branch List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 27c4d9242bf086f2038defcd458bb4b146892add Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been created by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=27c4d9242bf086f2038defcd458bb4b146892add commit 27c4d9242bf086f2038defcd458bb4b146892add Author: Glen Barber AuthorDate: 2021-10-21 00:44:32 +0000 Commit: Glen Barber CommitDate: 2021-10-21 00:44:32 +0000 12.3: create releng/12.3 branch Update from PRERELEASE to BETA1 switch pkg(8) configuration to use 'quarterly' Bump __FreeBSD_version Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/pkg_repos/release-dvd.conf | 2 +- sys/conf/newvers.sh | 2 +- sys/sys/param.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release/pkg_repos/release-dvd.conf b/release/pkg_repos/release-dvd.conf index 95413592b719..34997f2c7067 100644 --- a/release/pkg_repos/release-dvd.conf +++ b/release/pkg_repos/release-dvd.conf @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 75a68fddfaf9..1e65930884c0 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.3" -BRANCH="PRERELEASE" +BRANCH="BETA1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi diff --git a/sys/sys/param.h b/sys/sys/param.h index eea35ca6f893..bedd806b0ebd 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1202508 /* Master, propagated to newvers */ +#define __FreeBSD_version 1203000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Thu Oct 21 00:48:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F5B41817EED; Thu, 21 Oct 2021 00:48: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZTP63rZBz3jxK; Thu, 21 Oct 2021 00:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6191911DA2; Thu, 21 Oct 2021 00:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L0mQY3068741; Thu, 21 Oct 2021 00:48:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L0mQG6068740; Thu, 21 Oct 2021 00:48:26 GMT (envelope-from git) Date: Thu, 21 Oct 2021 00:48:26 GMT Message-Id: <202110210048.19L0mQG6068740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: f2900e784cb0 - stable/12 - 12.3: rename stable/12 to -STABLE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f2900e784cb024e55ec0f5cd6834af5fadcb9f9a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=f2900e784cb024e55ec0f5cd6834af5fadcb9f9a commit f2900e784cb024e55ec0f5cd6834af5fadcb9f9a Author: Glen Barber AuthorDate: 2021-10-21 00:48:09 +0000 Commit: Glen Barber CommitDate: 2021-10-21 00:48:09 +0000 12.3: rename stable/12 to -STABLE Bump __FreeBSD_version while here Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- sys/sys/param.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 75a68fddfaf9..751d395ad519 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.3" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi diff --git a/sys/sys/param.h b/sys/sys/param.h index eea35ca6f893..2bfe64db455a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1202508 /* Master, propagated to newvers */ +#define __FreeBSD_version 1203500 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Thu Oct 21 03:24:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BBB7B1807D5A; Thu, 21 Oct 2021 03:24:20 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZXs04zG8z4sFP; Thu, 21 Oct 2021 03:24:20 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634786660; 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=HFk8rnM0x/5Xx8TjE4d9M/H6TgER410TfqB1E44tN1g=; b=dE/jJReJ4smbIZQa4w+l0QFG8pd2CTXqG3K21A+ZSenuu7rWixMlHv2UXYElRxXweW+bL5 84ctA/OQPspXJER5LMRYpZybLo8T12bIGHfl3qKROVue3hW8dscipK2iNOwNz5d5cbAJrW UsBKWeta+mmdv/xb+rV6EFxaX1Ciut0mN1hQxUTvXZfMrWV4GKSVL1gNz1l/gn/X1SZ0ah 2OHsZMzd5j1rBUkErbwMBnqb1Albod0mnqC9Wlwpi9YhjGq1n6lCF7xrktJq0Oymhf+76T BNOJ27OMr0MhttM98nYQmt8w1Hh6YuUdacQ9455SJSKtPelyQiXQveX0R6s7Gw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 9487DB6B; Thu, 21 Oct 2021 03:24:20 +0000 (UTC) Date: Thu, 21 Oct 2021 03:24:20 +0000 From: Alexey Dokuchaev To: Shawn Webb Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211020135704.e2krf765elhscvfd@mutt-hbsd> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020135704.e2krf765elhscvfd@mutt-hbsd> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634786660; 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=HFk8rnM0x/5Xx8TjE4d9M/H6TgER410TfqB1E44tN1g=; b=o3qQLoUMwtBw9YYO8g27OCn7aPCHJWvmLSeNLTa2Jl23IwtoNDuQdm0Yx4bIkLjWprZeax ZaBxJiSe54to3AHU7m5UgWP8qbpOguubcOkk5hC0raoouDNtDTaohfpMqdrXfzb+ikt8qg dbt9vw+4LZuFxkCbpvc8YI96YDAiafl85aocSjqL61EOwRNqbV535Z9c7bb9wiAQrFitUF /GZF+0AXtPeeeTx3fqZo7WIh6AOCV3gthg8CjxdE66cOrOy46EnOnRCC2L74as08yhVxkU dvB9QAakNb3GJ2pelU7R2na47eXMq6RVLXJunuzioQNpP8ZuWSpvdgjJAoYiqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634786660; a=rsa-sha256; cv=none; b=QCg6NevSNSn1X7wyq3PB4nBbJUel3QGiud++ohfT5gy62ykO8YrmeSWmt5AGrJOC1cAGzY kO66z2fGSzqDfeyV+bdJ1RDNY6mjhLVrcd7vsdUsBDkj6nwSPsdtRYN2DxFUJoXtRdTWAA RtKd2K/8mL7At5bjaiekeIrZm3Uc0WY4Y4buGJVxRpw/QCGQV5nMWtEzGsf4Kjco3ssMnH MA/2Uuc4F+wUYcVhBteUAisPFNl/h8HWr3o0m0OUt+pwQ4EoMgnA84+qOFFgAG9TLzPvaf VoGEfM77zHz3vdUoebIgykT68FmtCMGsNJeQZruTYjrgoyIEfRBrfah0Vv6SRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 09:57:04AM -0400, Shawn Webb wrote: > On Tue, Oct 19, 2021 at 07:38:15AM +0000, Emmanuel Vadot wrote: > > commit 225639e7db685a4047e384abdbc296c0e02bd147 > > > > vt: Disable bell by default > > > > Bell is either useless if you're working on remote servers or > > really annoying when you're working with a local machine that > > have a loud buzzer. Switch the default to have it disable. > > I have no objection to the change (or any opinion on the matter), but > I wonder if changes like this carry an accessibility impact. I wonder > if any hard-of-sight folks relied on the original behavior. Pretty sure it does; as explained by Gleb and me earlier, PC speaker is important diagnostic communication channel; unfortunately Emmanuel sees it just as annoying useless buzzer. :( ./danfe From nobody Thu Oct 21 04:15:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AFE4E17FE268; Thu, 21 Oct 2021 04:15: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZYzg4Yc9z3M4r; Thu, 21 Oct 2021 04:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C08614BAC; Thu, 21 Oct 2021 04:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L4FBwg047797; Thu, 21 Oct 2021 04:15:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L4FBOh047796; Thu, 21 Oct 2021 04:15:11 GMT (envelope-from git) Date: Thu, 21 Oct 2021 04:15:11 GMT Message-Id: <202110210415.19L4FBOh047796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rebecca Cran Subject: git: 35175e100add - main - bhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bcran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35175e100add6fc2bc73a826aeafbb8e198adb97 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bcran: URL: https://cgit.FreeBSD.org/src/commit/?id=35175e100add6fc2bc73a826aeafbb8e198adb97 commit 35175e100add6fc2bc73a826aeafbb8e198adb97 Author: Rebecca Cran AuthorDate: 2021-10-21 02:33:49 +0000 Commit: Rebecca Cran CommitDate: 2021-10-21 04:10:33 +0000 bhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT Bump the firmware version to 14.0 and set the firmware release date to today. Reviewed by: jhb, bz, imp Differential Revision: https://reviews.freebsd.org/D32534 --- usr.sbin/bhyve/smbiostbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c index ca68f8d95363..ada3177105a9 100644 --- a/usr.sbin/bhyve/smbiostbl.c +++ b/usr.sbin/bhyve/smbiostbl.c @@ -52,9 +52,9 @@ __FBSDID("$FreeBSD$"); #define SMBIOS_BASE 0xF1000 -#define FIRMWARE_VERSION "13.0" +#define FIRMWARE_VERSION "14.0" /* The SMBIOS specification defines the date format to be mm/dd/yyyy */ -#define FIRMWARE_RELEASE_DATE "11/10/2020" +#define FIRMWARE_RELEASE_DATE "10/17/2021" /* BHYVE_ACPI_BASE - SMBIOS_BASE) */ #define SMBIOS_MAX_LENGTH (0xF2400 - 0xF1000) From nobody Thu Oct 21 05:39:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AF7CA17F9628; Thu, 21 Oct 2021 05:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZbsG4c4dz4Rj0; Thu, 21 Oct 2021 05:39:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D918156EF; Thu, 21 Oct 2021 05:39:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L5dk0H054534; Thu, 21 Oct 2021 05:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L5dk61054533; Thu, 21 Oct 2021 05:39:46 GMT (envelope-from git) Date: Thu, 21 Oct 2021 05:39:46 GMT Message-Id: <202110210539.19L5dk61054533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: c6d4cd2a81c8 - stable/13 - contrib/tzdata: correct DST in Fiji List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: c6d4cd2a81c817bdbd68a94fb6f809ac5d960084 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=c6d4cd2a81c817bdbd68a94fb6f809ac5d960084 commit c6d4cd2a81c817bdbd68a94fb6f809ac5d960084 Author: Philip Paeps AuthorDate: 2021-10-18 06:19:42 +0000 Commit: Philip Paeps CommitDate: 2021-10-21 05:31:14 +0000 contrib/tzdata: correct DST in Fiji Direct commit to stable/13. Unfortunately, there is still no clear consensus on the tz mailing list about some of the changes introduced by tzdata 2021b and later releases. Pending consensus, only merge the recently announced DST transition date for Fiji and corrections to commentary from tzdata 2021d. This corrects future timestamps in Fiji. --- contrib/tzdata/australasia | 24 +++++++++++++++++++----- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index a2c5ee86eecf..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Thu Oct 21 05:40:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 32D6717F9A03; Thu, 21 Oct 2021 05:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZbsY0nFyz4S0D; Thu, 21 Oct 2021 05:40:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFD30156F2; Thu, 21 Oct 2021 05:40:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L5e0nd055604; Thu, 21 Oct 2021 05:40:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L5e0ZI055579; Thu, 21 Oct 2021 05:40:00 GMT (envelope-from git) Date: Thu, 21 Oct 2021 05:40:00 GMT Message-Id: <202110210540.19L5e0ZI055579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 74a0f31dbbd0 - stable/12 - contrib/tzdata: correct DST in Fiji List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 74a0f31dbbd0b32689d63d8c965c611bdfc4da2f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=74a0f31dbbd0b32689d63d8c965c611bdfc4da2f commit 74a0f31dbbd0b32689d63d8c965c611bdfc4da2f Author: Philip Paeps AuthorDate: 2021-10-18 06:19:42 +0000 Commit: Philip Paeps CommitDate: 2021-10-21 05:37:38 +0000 contrib/tzdata: correct DST in Fiji Direct commit to stable/12. Unfortunately, there is still no clear consensus on the tz mailing list about some of the changes introduced by tzdata 2021b and later releases. Pending consensus, only merge the recently announced DST transition date for Fiji and corrections to commentary from tzdata 2021d. This corrects future timestamps in Fiji. --- contrib/tzdata/australasia | 24 +++++++++++++++++++----- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index a2c5ee86eecf..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Thu Oct 21 05:40:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 520D917F9E07; Thu, 21 Oct 2021 05:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZbst1mn7z4RyP; Thu, 21 Oct 2021 05:40:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E43415CCE; Thu, 21 Oct 2021 05:40:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L5eIKd061235; Thu, 21 Oct 2021 05:40:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L5eIdp061227; Thu, 21 Oct 2021 05:40:18 GMT (envelope-from git) Date: Thu, 21 Oct 2021 05:40:18 GMT Message-Id: <202110210540.19L5eIdp061227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: b7d19f92bfc6 - stable/11 - contrib/tzdata: correct DST in Fiji List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/11 X-Git-Reftype: branch X-Git-Commit: b7d19f92bfc6c8edcfa78090f6656f2322be4fa7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=b7d19f92bfc6c8edcfa78090f6656f2322be4fa7 commit b7d19f92bfc6c8edcfa78090f6656f2322be4fa7 Author: Philip Paeps AuthorDate: 2021-10-18 06:19:42 +0000 Commit: Philip Paeps CommitDate: 2021-10-21 05:38:31 +0000 contrib/tzdata: correct DST in Fiji Direct commit to stable/11. Unfortunately, there is still no clear consensus on the tz mailing list about some of the changes introduced by tzdata 2021b and later releases. Pending consensus, only merge the recently announced DST transition date for Fiji and corrections to commentary from tzdata 2021d. This corrects future timestamps in Fiji. --- contrib/tzdata/australasia | 24 +++++++++++++++++++----- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index a2c5ee86eecf..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Thu Oct 21 05:46:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3242717FD03D for ; Thu, 21 Oct 2021 05:46: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZc0W0mwxz4VBQ; Thu, 21 Oct 2021 05:46:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA03B16107; Thu, 21 Oct 2021 05:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L5k2oL067624; Thu, 21 Oct 2021 05:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L5k2al067623; Thu, 21 Oct 2021 05:46:02 GMT (envelope-from git) Date: Thu, 21 Oct 2021 05:46:02 GMT Message-Id: <202110210546.19L5k2al067623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 4a1195ca5041..ec64fdb93d14 - vendor/openzfs/master - vendor branch updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs/master X-Git-Reftype: branch X-Git-Commit: ec64fdb93d144ab1884097cfd36e18b62a2db848 X-Git-Oldrev: 4a1195ca5041cbff2a6b025a31937fef84876c52 X-Git-Newrev: ec64fdb93d144ab1884097cfd36e18b62a2db848 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch vendor/openzfs/master has been updated by mm: URL: https://cgit.FreeBSD.org/src/log/?id=4a1195ca5041..ec64fdb93d14 606574081189 Linux 5.14 compat: META 2a49ebbb4dd0 Avoid panic in case of pool errors and missing L2ARC 139690d6c3c7 Really zero the zero page 8a3fe59c0364 Added test for being able to read various variants of zstd 1d901c3ee596 Upstream: unmount snapshots before destroying them on macOS 59eab1093a36 Handle partial reads in zfs_read df5ea74ff668 Assorted parameter changes for performance tests ce2bdcedf549 libspl: fix warning about missing spl_pagesize declaration 96ad227a9dad ZTS: Minimize udev_wait in zvol_misc tests ed3a3bdb0d59 Proper support for DESTDIR and INSTALL_MOD_PATH 60b618a967b1 ZFS: Remove a redundant if condition (#12598) aad91df07525 Reject zfs send -RI with nonexistent fromsnap 2a8430a26059 Rescan enclosure sysfs path on import 543ab04cc3e2 Document additional -c caveat 48df24d4ce7b Remove zdb and libzpool from initramfs image 514498fef697 Simplify and document OpenZFS library dependencies 2d02bba23d83 arcstat: Fix integer division with python3 9d1407e8f248 Correct refcount_add in dmu_zfetch 97bbeeb93803 Fail invalid incremental recursive send gracefully a5b464263bc1 initramfs: use correct dataset for rootfs on rollback=1 72f06d01b555 ZTS: deadman_sync fix 648445e0078e ZTS: Add known exceptions 280d0f0ce45a Export minimal zfs_refcount interfaces d785245857b8 zio: use unsigned values for enum afbc61792116 Remove FreeBSD's local copy of the dmu_buf_hold_array() function 01b572bc623c zdb: fix overflow of time estimation fd778e44c88f Notify on UNAVAIL statechange a95c82bed840 Remove code duplication a4cecfbdc96f zpool should call zfs_nicestrtonum() with non-NULL handle 6cb5e1e7591d libshare: nfs: pass through ipv6 addresses in bracket notation 1886cdfcfb97 vdev_id: Fix enclosure_symlinks feature ec64fdb93d14 Skip snapshot in zfs_iter_mounted() From nobody Thu Oct 21 06:13:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2DF391808882; Thu, 21 Oct 2021 06:13:35 +0000 (UTC) (envelope-from bapt@etoilebsd.net) 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) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZccH0HMqz4ccZ; Thu, 21 Oct 2021 06:13:34 +0000 (UTC) (envelope-from bapt@etoilebsd.net) Received: from dummy.faircode.eu (10.246.39.62.rev.sfr.net [62.39.246.10]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aniel.nours.eu (Postfix) with ESMTPSA id 714173EAD4; Thu, 21 Oct 2021 08:13:26 +0200 (CEST) Date: Thu, 21 Oct 2021 06:13:25 +0000 (UTC) From: Baptiste Daroussin To: Gleb Smirnoff Cc: Emmanuel Vadot , Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: In-Reply-To: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: X-Rspamd-Queue-Id: 4HZccH0HMqz4ccZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N 20 oct. 2021 19:11:15 Gleb Smirnoff : > =C2=A0 Emmanuel, > > On Wed, Oct 20, 2021 at 01:42:37PM +0200, Emmanuel Vadot wrote: > E>=C2=A0 Stop using POLA for "This is a change that I don't agree with". > > A change that just changes the system behaviour and nothing else, > is a POLA violation. > > E>=C2=A0 In the past weeks we had commits that changed mixer(8) cli in a > E> non-backward compatible way and changed the root shell. For both you > E> haven't complain so it means that either you don't care or you agree > E> with those changes. > > Mixer and root shell weren't like your change. Mixer is a complete > rewrite which has some technical background to justify it. Root shell > is also different to what you did. It is not flip of a binary switch. > > E>=C2=A0 I agree that the bell is clearly a user preference and also I co= uld > E> have left the review opened for more time (but I've been there and > E> usually you have review/feedback the first day and after it's silent). > E> I wish there was an easy way for developer (and community member) to > E> create a poll for changes like that but we don't have one right now. > E>=C2=A0 Now based on the number of people who reviewed and the people wh= o sent > E> me private message to thanks me for this change I think that more > E> people are annoyed by the bell than people who wants it and we want > E> sane default that most users agrees on in base FreeBSD. If you don't > E> agree with the defaults we have a way to change them. > > To me this looks like abuse of committer priveleges. I got commit bit, > so I can change the defaults. > > Speaking of the bell itself. It is of course very annoying on some > laptops, especially if the laptop is used by someone else, not you. > But it is extremely useful when working in a loud server room on > a console, reviving a crashed machine, usually in a very stressful > environment. Gives feeling of machine being responsive or not being > responsive. > > So it is more a question of server vs desktop default. Okay, let's > ignore the biased opinion that FreeBSD is a server OS. But I would > assert that vt(4) is a way more used on servers, rather than on > laptops. If somebody is using vt(4) instead of X on a laptop, then > this person is special. Either really impared, as Shawn suggested, > or just a geek who hates GUI. In the latter case, they should tweak > the configuration. > > -- > Gleb Smirnoff Interrestingly my experience in datacenters is the exact opposite, the firs= t thing everyone I know is doing when installing freebsd in datacenter is d= isabling the bell, because the last thing you want is add noise on top of t= he noise. And use the bell only for very specific purpose. So your claim that it is server usage vs laptop is not true. It seems that there are very different habbits their and no way to really p= oll what the majority would like. Note that I am for both laptop/desktop and servers part of the people consi= dering the default should be off as well. Best regards, Bapt From nobody Thu Oct 21 07:40:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4A507180637D; Thu, 21 Oct 2021 07:40:02 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZfX15PSPz3DKN; Thu, 21 Oct 2021 07:40:01 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634802000; 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=8fFlpaN17Ilfn/PZGYvycCFIJEr0b9mChxrRB0bG/lo=; b=fY089KirmgjX49/Nvo40TP92WAXCMKYvv8eWXogZYDwUa8ugBt1FwgrRyjaPinBED928GM cCdJKiTOP0NIIXeO8KUK94h6DSCKNDt3gXESAslnxecdoikaJ0LO8KfmvTDkmJX45eRokK oyWK8xIxgUZQDWCTFbYWgybxHZw1YOA= Received: from skull.home.blih.net (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id cd10684c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 21 Oct 2021 07:40:00 +0000 (UTC) Date: Thu, 21 Oct 2021 09:40:00 +0200 From: Emmanuel Vadot To: Gleb Smirnoff Cc: Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211021094000.58097dbece05fcd445aa3d87@bidouilliste.com> In-Reply-To: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HZfX15PSPz3DKN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, 20 Oct 2021 10:11:05 -0700 Gleb Smirnoff wrote: > Emmanuel, > > On Wed, Oct 20, 2021 at 01:42:37PM +0200, Emmanuel Vadot wrote: > E> Stop using POLA for "This is a change that I don't agree with". > > A change that just changes the system behaviour and nothing else, > is a POLA violation. > > E> In the past weeks we had commits that changed mixer(8) cli in a > E> non-backward compatible way and changed the root shell. For both you > E> haven't complain so it means that either you don't care or you agree > E> with those changes. > > Mixer and root shell weren't like your change. Mixer is a complete > rewrite which has some technical background to justify it. Root shell > is also different to what you did. It is not flip of a binary switch. > > E> I agree that the bell is clearly a user preference and also I could > E> have left the review opened for more time (but I've been there and > E> usually you have review/feedback the first day and after it's silent). > E> I wish there was an easy way for developer (and community member) to > E> create a poll for changes like that but we don't have one right now. > E> Now based on the number of people who reviewed and the people who sent > E> me private message to thanks me for this change I think that more > E> people are annoyed by the bell than people who wants it and we want > E> sane default that most users agrees on in base FreeBSD. If you don't > E> agree with the defaults we have a way to change them. > > To me this looks like abuse of committer priveleges. I got commit bit, > so I can change the defaults. Oh common ... > Speaking of the bell itself. It is of course very annoying on some > laptops, especially if the laptop is used by someone else, not you. > But it is extremely useful when working in a loud server room on > a console, reviving a crashed machine, usually in a very stressful > environment. Gives feeling of machine being responsive or not being > responsive. Let's agree to disagree, I think that a high pitch noise like the bell in a stressful environment is horrible and makes me want to punch things (keyboard, screen, co-worker etc ...) > So it is more a question of server vs desktop default. Okay, let's > ignore the biased opinion that FreeBSD is a server OS. But I would > assert that vt(4) is a way more used on servers, rather than on > laptops. That's probably true. Now, I don't think that nowadays people spend a lot of time in datacenter installing FreeBSD on their server, they rack the machine, make sure that the BMC is working and leave. This makes the bell useless. > If somebody is using vt(4) instead of X on a laptop, then > this person is special. Either really impared, as Shawn suggested, > or just a geek who hates GUI. In the latter case, they should tweak > the configuration. > > -- > Gleb Smirnoff Except that FreeBSD doesn't include drm drivers or graphical env by default so the first thing that a user (new or not) have to deal with is vt(4). So they will login, do a bunch of command to configure the machine and will probably use tab for completion, and what will they hear when multiple commands are possible ? The bell. What will they hear if they try to go left or right in the shell and arrive at one of the ends ? The bell. And they will hear it in a bunch of other situation. Again it's clearly user preference and as you can see I really hate this bell. I'm sure that more people than the one who answered this commit like the bell but the question is do more people wants it on be default or not ? The non-scientific method that is twitter seems to agree with me (https://twitter.com/FreeBSDHelp/status/1450955125002887170). So, do we really want to make a poll so users can vote on what to do with a freaking bell ??? -- Emmanuel Vadot From nobody Thu Oct 21 07:40:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 615541806C07; Thu, 21 Oct 2021 07:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZfXy1V5Tz3F2D; Thu, 21 Oct 2021 07:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14C6C170EA; Thu, 21 Oct 2021 07:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L7eo0V023467; Thu, 21 Oct 2021 07:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L7eoDS023466; Thu, 21 Oct 2021 07:40:50 GMT (envelope-from git) Date: Thu, 21 Oct 2021 07:40:50 GMT Message-Id: <202110210740.19L7eoDS023466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Roger Pau Monn=C3=A9?= Subject: git: 535badd1b8d2 - main - xen/pcifront: purge from tree List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 535badd1b8d210961be977161aa17cc3077edb46 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=535badd1b8d210961be977161aa17cc3077edb46 commit 535badd1b8d210961be977161aa17cc3077edb46 Author: Roger Pau Monné AuthorDate: 2021-10-20 10:39:33 +0000 Commit: Roger Pau Monné CommitDate: 2021-10-21 07:39:16 +0000 xen/pcifront: purge from tree Xen pcifront has been unhooked from the build for a long time, as it's only used by PV mode which FreeBSD doesn't support. Remove it from the tree. --- sys/dev/xen/pcifront/pcifront.c | 688 ---------------------------------------- 1 file changed, 688 deletions(-) diff --git a/sys/dev/xen/pcifront/pcifront.c b/sys/dev/xen/pcifront/pcifront.c deleted file mode 100644 index cc8cc92fac3c..000000000000 --- a/sys/dev/xen/pcifront/pcifront.c +++ /dev/null @@ -1,688 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2006, Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Cisco Systems, Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "pcib_if.h" - -#ifdef XEN_PCIDEV_FE_DEBUG -#define DPRINTF(fmt, args...) \ - printf("pcifront (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) -#else -#define DPRINTF(fmt, args...) ((void)0) -#endif -#define WPRINTF(fmt, args...) \ - printf("pcifront (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) - -#define INVALID_GRANT_REF (0) -#define INVALID_EVTCHN (-1) -#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) - -struct pcifront_device { - STAILQ_ENTRY(pcifront_device) next; - - struct xenbus_device *xdev; - - int unit; - int evtchn; - int gnt_ref; - - /* Lock this when doing any operations in sh_info */ - struct mtx sh_info_lock; - struct xen_pci_sharedinfo *sh_info; - - device_t ndev; - - int ref_cnt; -}; - -static STAILQ_HEAD(pcifront_dlist, pcifront_device) pdev_list = STAILQ_HEAD_INITIALIZER(pdev_list); - -struct xpcib_softc { - int domain; - int bus; - struct pcifront_device *pdev; -}; - -/* Allocate a PCI device structure */ -static struct pcifront_device * -alloc_pdev(struct xenbus_device *xdev) -{ - struct pcifront_device *pdev = NULL; - int err, unit; - - err = sscanf(xdev->nodename, "device/pci/%d", &unit); - if (err != 1) { - if (err == 0) - err = -EINVAL; - xenbus_dev_fatal(pdev->xdev, err, "Error scanning pci device instance number"); - goto out; - } - - pdev = (struct pcifront_device *)malloc(sizeof(struct pcifront_device), M_DEVBUF, M_NOWAIT); - if (pdev == NULL) { - err = -ENOMEM; - xenbus_dev_fatal(xdev, err, "Error allocating pcifront_device struct"); - goto out; - } - pdev->unit = unit; - pdev->xdev = xdev; - pdev->ref_cnt = 1; - - pdev->sh_info = (struct xen_pci_sharedinfo *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (pdev->sh_info == NULL) { - free(pdev, M_DEVBUF); - pdev = NULL; - err = -ENOMEM; - xenbus_dev_fatal(xdev, err, "Error allocating sh_info struct"); - goto out; - } - pdev->sh_info->flags = 0; - - xdev->data = pdev; - - mtx_init(&pdev->sh_info_lock, "info_lock", "pci shared dev info lock", MTX_DEF); - - pdev->evtchn = INVALID_EVTCHN; - pdev->gnt_ref = INVALID_GRANT_REF; - - STAILQ_INSERT_TAIL(&pdev_list, pdev, next); - - DPRINTF("Allocated pdev @ 0x%p (unit=%d)\n", pdev, unit); - - out: - return pdev; -} - -/* Hold a reference to a pcifront device */ -static void -get_pdev(struct pcifront_device *pdev) -{ - pdev->ref_cnt++; -} - -/* Release a reference to a pcifront device */ -static void -put_pdev(struct pcifront_device *pdev) -{ - if (--pdev->ref_cnt > 0) - return; - - DPRINTF("freeing pdev @ 0x%p (ref_cnt=%d)\n", pdev, pdev->ref_cnt); - - if (pdev->evtchn != INVALID_EVTCHN) - xenbus_free_evtchn(pdev->xdev, pdev->evtchn); - - if (pdev->gnt_ref != INVALID_GRANT_REF) - gnttab_end_foreign_access(pdev->gnt_ref, 0, (void *)pdev->sh_info); - - pdev->xdev->data = NULL; - - free(pdev, M_DEVBUF); -} - -/* Write to the xenbus info needed by backend */ -static int -pcifront_publish_info(struct pcifront_device *pdev) -{ - int err = 0; - struct xenbus_transaction *trans; - - err = xenbus_grant_ring(pdev->xdev, virt_to_mfn(pdev->sh_info)); - if (err < 0) { - WPRINTF("error granting access to ring page\n"); - goto out; - } - - pdev->gnt_ref = err; - - err = xenbus_alloc_evtchn(pdev->xdev, &pdev->evtchn); - if (err) - goto out; - - do_publish: - trans = xenbus_transaction_start(); - if (IS_ERR(trans)) { - xenbus_dev_fatal(pdev->xdev, err, - "Error writing configuration for backend " - "(start transaction)"); - goto out; - } - - err = xenbus_printf(trans, pdev->xdev->nodename, - "pci-op-ref", "%u", pdev->gnt_ref); - if (!err) - err = xenbus_printf(trans, pdev->xdev->nodename, - "event-channel", "%u", pdev->evtchn); - if (!err) - err = xenbus_printf(trans, pdev->xdev->nodename, - "magic", XEN_PCI_MAGIC); - if (!err) - err = xenbus_switch_state(pdev->xdev, trans, - XenbusStateInitialised); - - if (err) { - xenbus_transaction_end(trans, 1); - xenbus_dev_fatal(pdev->xdev, err, - "Error writing configuration for backend"); - goto out; - } else { - err = xenbus_transaction_end(trans, 0); - if (err == -EAGAIN) - goto do_publish; - else if (err) { - xenbus_dev_fatal(pdev->xdev, err, - "Error completing transaction for backend"); - goto out; - } - } - - out: - return err; -} - -/* The backend is now connected so complete the connection process on our side */ -static int -pcifront_connect(struct pcifront_device *pdev) -{ - device_t nexus; - devclass_t nexus_devclass; - - /* We will add our device as a child of the nexus0 device */ - if (!(nexus_devclass = devclass_find("nexus")) || - !(nexus = devclass_get_device(nexus_devclass, 0))) { - WPRINTF("could not find nexus0!\n"); - return -1; - } - - /* Create a newbus device representing this frontend instance */ - pdev->ndev = BUS_ADD_CHILD(nexus, 0, "xpcife", pdev->unit); - if (!pdev->ndev) { - WPRINTF("could not create xpcife%d!\n", pdev->unit); - return -EFAULT; - } - get_pdev(pdev); - device_set_ivars(pdev->ndev, pdev); - - /* Good to go connected now */ - xenbus_switch_state(pdev->xdev, NULL, XenbusStateConnected); - - printf("pcifront: connected to %s\n", pdev->xdev->nodename); - - mtx_lock(&Giant); - device_probe_and_attach(pdev->ndev); - mtx_unlock(&Giant); - - return 0; -} - -/* The backend is closing so process a disconnect */ -static int -pcifront_disconnect(struct pcifront_device *pdev) -{ - int err = 0; - XenbusState prev_state; - - prev_state = xenbus_read_driver_state(pdev->xdev->nodename); - - if (prev_state < XenbusStateClosing) { - err = xenbus_switch_state(pdev->xdev, NULL, XenbusStateClosing); - if (!err && prev_state == XenbusStateConnected) { - /* TODO - need to detach the newbus devices */ - } - } - - return err; -} - -/* Process a probe from the xenbus */ -static int -pcifront_probe(struct xenbus_device *xdev, - const struct xenbus_device_id *id) -{ - int err = 0; - struct pcifront_device *pdev; - - DPRINTF("xenbus probing\n"); - - if ((pdev = alloc_pdev(xdev)) == NULL) - goto out; - - err = pcifront_publish_info(pdev); - - out: - if (err) - put_pdev(pdev); - return err; -} - -/* Remove the xenbus PCI device */ -static int -pcifront_remove(struct xenbus_device *xdev) -{ - DPRINTF("removing xenbus device node (%s)\n", xdev->nodename); - if (xdev->data) - put_pdev(xdev->data); - return 0; -} - -/* Called by xenbus when our backend node changes state */ -static void -pcifront_backend_changed(struct xenbus_device *xdev, - XenbusState be_state) -{ - struct pcifront_device *pdev = xdev->data; - - switch (be_state) { - case XenbusStateClosing: - DPRINTF("backend closing (%s)\n", xdev->nodename); - pcifront_disconnect(pdev); - break; - - case XenbusStateClosed: - DPRINTF("backend closed (%s)\n", xdev->nodename); - pcifront_disconnect(pdev); - break; - - case XenbusStateConnected: - DPRINTF("backend connected (%s)\n", xdev->nodename); - pcifront_connect(pdev); - break; - - default: - break; - } -} - -/* Process PCI operation */ -static int -do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) -{ - int err = 0; - struct xen_pci_op *active_op = &pdev->sh_info->op; - evtchn_port_t port = pdev->evtchn; - time_t timeout; - - mtx_lock(&pdev->sh_info_lock); - - memcpy(active_op, op, sizeof(struct xen_pci_op)); - - /* Go */ - wmb(); - set_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags); - notify_remote_via_evtchn(port); - - timeout = time_uptime + 2; - - clear_evtchn(port); - - /* Spin while waiting for the answer */ - while (test_bit - (_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags)) { - int err = HYPERVISOR_poll(&port, 1, 3 * hz); - if (err) - panic("Failed HYPERVISOR_poll: err=%d", err); - clear_evtchn(port); - if (time_uptime > timeout) { - WPRINTF("pciback not responding!!!\n"); - clear_bit(_XEN_PCIF_active, - (unsigned long *)&pdev->sh_info->flags); - err = XEN_PCI_ERR_dev_not_found; - goto out; - } - } - - memcpy(op, active_op, sizeof(struct xen_pci_op)); - - err = op->err; - out: - mtx_unlock(&pdev->sh_info_lock); - return err; -} - -/* ** XenBus Driver registration ** */ - -static struct xenbus_device_id pcifront_ids[] = { - { "pci" }, - { "" } -}; - -static struct xenbus_driver pcifront = { - .name = "pcifront", - .ids = pcifront_ids, - .probe = pcifront_probe, - .remove = pcifront_remove, - .otherend_changed = pcifront_backend_changed, -}; - -/* Register the driver with xenbus during sys init */ -static void -pcifront_init(void *unused) -{ - if ((xen_start_info->flags & SIF_INITDOMAIN)) - return; - - DPRINTF("xenbus registering\n"); - - xenbus_register_frontend(&pcifront); -} - -SYSINIT(pciif, SI_SUB_PSEUDO, SI_ORDER_ANY, pcifront_init, NULL) - -/* Newbus xpcife device driver probe */ -static int -xpcife_probe(device_t dev) -{ -#ifdef XEN_PCIDEV_FE_DEBUG - struct pcifront_device *pdev = (struct pcifront_device *)device_get_ivars(dev); - DPRINTF("xpcife probe (unit=%d)\n", pdev->unit); -#endif - return (BUS_PROBE_NOWILDCARD); -} - -/* Newbus xpcife device driver attach */ -static int -xpcife_attach(device_t dev) -{ - struct pcifront_device *pdev = (struct pcifront_device *)device_get_ivars(dev); - int i, num_roots, len, err; - char str[64]; - unsigned int domain, bus; - - DPRINTF("xpcife attach (unit=%d)\n", pdev->unit); - - err = xenbus_scanf(NULL, pdev->xdev->otherend, - "root_num", "%d", &num_roots); - if (err != 1) { - if (err == 0) - err = -EINVAL; - xenbus_dev_fatal(pdev->xdev, err, - "Error reading number of PCI roots"); - goto out; - } - - /* Add a pcib device for each root */ - for (i = 0; i < num_roots; i++) { - device_t child; - - len = snprintf(str, sizeof(str), "root-%d", i); - if (unlikely(len >= (sizeof(str) - 1))) { - err = -ENOMEM; - goto out; - } - - err = xenbus_scanf(NULL, pdev->xdev->otherend, str, - "%x:%x", &domain, &bus); - if (err != 2) { - if (err >= 0) - err = -EINVAL; - xenbus_dev_fatal(pdev->xdev, err, - "Error reading PCI root %d", i); - goto out; - } - err = 0; - if (domain != pdev->xdev->otherend_id) { - err = -EINVAL; - xenbus_dev_fatal(pdev->xdev, err, - "Domain mismatch %d != %d", domain, pdev->xdev->otherend_id); - goto out; - } - - child = device_add_child(dev, "pcib", bus); - if (!child) { - err = -ENOMEM; - xenbus_dev_fatal(pdev->xdev, err, - "Unable to create pcib%d", bus); - goto out; - } - } - - out: - return bus_generic_attach(dev); -} - -static devclass_t xpcife_devclass; - -static device_method_t xpcife_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, xpcife_probe), - DEVMETHOD(device_attach, xpcife_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - /* Bus interface */ - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - DEVMETHOD_END -}; - -static driver_t xpcife_driver = { - "xpcife", - xpcife_methods, - 0, -}; - -DRIVER_MODULE(xpcife, nexus, xpcife_driver, xpcife_devclass, 0, 0); - -/* Newbus xen pcib device driver probe */ -static int -xpcib_probe(device_t dev) -{ - struct xpcib_softc *sc = (struct xpcib_softc *)device_get_softc(dev); - struct pcifront_device *pdev = (struct pcifront_device *)device_get_ivars(device_get_parent(dev)); - - DPRINTF("xpcib probe (bus=%d)\n", device_get_unit(dev)); - - sc->domain = pdev->xdev->otherend_id; - sc->bus = device_get_unit(dev); - sc->pdev = pdev; - - return 0; -} - -/* Newbus xen pcib device driver attach */ -static int -xpcib_attach(device_t dev) -{ - struct xpcib_softc *sc = (struct xpcib_softc *)device_get_softc(dev); - - DPRINTF("xpcib attach (bus=%d)\n", sc->bus); - - device_add_child(dev, "pci", -1); - return bus_generic_attach(dev); -} - -static int -xpcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct xpcib_softc *sc = (struct xpcib_softc *)device_get_softc(dev); - switch (which) { - case PCIB_IVAR_BUS: - *result = sc->bus; - return 0; - } - return ENOENT; -} - -/* Return the number of slots supported */ -static int -xpcib_maxslots(device_t dev) -{ - return 31; -} - -#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) - -/* Read configuration space register */ -static u_int32_t -xpcib_read_config(device_t dev, int bus, int slot, int func, - int reg, int bytes) -{ - struct xpcib_softc *sc = (struct xpcib_softc *)device_get_softc(dev); - struct xen_pci_op op = { - .cmd = XEN_PCI_OP_conf_read, - .domain = sc->domain, - .bus = sc->bus, - .devfn = PCI_DEVFN(slot, func), - .offset = reg, - .size = bytes, - }; - int err; - - err = do_pci_op(sc->pdev, &op); - - DPRINTF("read config (b=%d, s=%d, f=%d, reg=%d, len=%d, val=%x, err=%d)\n", - bus, slot, func, reg, bytes, op.value, err); - - if (err) - op.value = ~0; - - return op.value; -} - -/* Write configuration space register */ -static void -xpcib_write_config(device_t dev, int bus, int slot, int func, - int reg, u_int32_t data, int bytes) -{ - struct xpcib_softc *sc = (struct xpcib_softc *)device_get_softc(dev); - struct xen_pci_op op = { - .cmd = XEN_PCI_OP_conf_write, - .domain = sc->domain, - .bus = sc->bus, - .devfn = PCI_DEVFN(slot, func), - .offset = reg, - .size = bytes, - .value = data, - }; - int err; - - err = do_pci_op(sc->pdev, &op); - - DPRINTF("write config (b=%d, s=%d, f=%d, reg=%d, len=%d, val=%x, err=%d)\n", - bus, slot, func, reg, bytes, data, err); -} - -static int -xpcib_route_interrupt(device_t pcib, device_t dev, int pin) -{ - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - - DPRINTF("route intr (pin=%d, line=%d)\n", pin, cfg->intline); - - return cfg->intline; -} - -static device_method_t xpcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, xpcib_probe), - DEVMETHOD(device_attach, xpcib_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar, xpcib_read_ivar), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, xpcib_maxslots), - DEVMETHOD(pcib_read_config, xpcib_read_config), - DEVMETHOD(pcib_write_config, xpcib_write_config), - DEVMETHOD(pcib_route_interrupt, xpcib_route_interrupt), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - DEVMETHOD_END -}; - -static devclass_t xpcib_devclass; - -DEFINE_CLASS_0(pcib, xpcib_driver, xpcib_methods, sizeof(struct xpcib_softc)); -DRIVER_MODULE(pcib, xpcife, xpcib_driver, xpcib_devclass, 0, 0); - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: t - * End: - */ From nobody Thu Oct 21 07:40:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DF8081806B3A; Thu, 21 Oct 2021 07:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZfXz3XX7z3DvT; Thu, 21 Oct 2021 07:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 475CB170EB; Thu, 21 Oct 2021 07:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19L7epim023502; Thu, 21 Oct 2021 07:40:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19L7epoq023501; Thu, 21 Oct 2021 07:40:51 GMT (envelope-from git) Date: Thu, 21 Oct 2021 07:40:51 GMT Message-Id: <202110210740.19L7epoq023501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Roger Pau Monn=C3=A9?= Subject: git: 5bb67f5f3f59 - main - xen/devices: purge uses of intr_machdep.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bb67f5f3f59d77e6f5d67b1a7fa7c514fdaff50 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=5bb67f5f3f59d77e6f5d67b1a7fa7c514fdaff50 commit 5bb67f5f3f59d77e6f5d67b1a7fa7c514fdaff50 Author: Elliott Mitchell AuthorDate: 2021-04-23 02:59:22 +0000 Commit: Roger Pau Monné CommitDate: 2021-10-21 07:39:16 +0000 xen/devices: purge uses of intr_machdep.h Devices in sys/dev should be architecture-independent and NOT #include intr_machdep.h. Reviewed by: mhorne royger Differential Revision: https://reviews.freebsd.org/D29959 --- sys/dev/xen/blkfront/blkfront.c | 1 - sys/dev/xen/evtchn/evtchn_dev.c | 1 - 2 files changed, 2 deletions(-) diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c index 7078cb16caa1..4f67d1f827e7 100644 --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/dev/xen/evtchn/evtchn_dev.c b/sys/dev/xen/evtchn/evtchn_dev.c index fd8e290431ba..c970404cce3c 100644 --- a/sys/dev/xen/evtchn/evtchn_dev.c +++ b/sys/dev/xen/evtchn/evtchn_dev.c @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include From nobody Thu Oct 21 08:02:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1FE9B180FA2B; Thu, 21 Oct 2021 08:02:17 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZg1h6kvzz3LYQ; Thu, 21 Oct 2021 08:02:16 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mdT1i-000I7Y-EN; Thu, 21 Oct 2021 11:02:14 +0300 Date: Thu, 21 Oct 2021 11:02:14 +0300 From: Slawa Olhovchenkov To: Gleb Smirnoff Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211021080214.GB77338@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HZg1h6kvzz3LYQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, Oct 20, 2021 at 10:11:05AM -0700, Gleb Smirnoff wrote: > laptops. If somebody is using vt(4) instead of X on a laptop, then This change disable bell in X11 too. This is completly disable speaker bell. From nobody Thu Oct 21 11:08:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CBC3D1817A86; Thu, 21 Oct 2021 11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZl804LVxz4sFn; Thu, 21 Oct 2021 11:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71EA71A11F; Thu, 21 Oct 2021 11:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LB80lM092725; Thu, 21 Oct 2021 11:08:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LB80ed092724; Thu, 21 Oct 2021 11:08:00 GMT (envelope-from git) Date: Thu, 21 Oct 2021 11:08:00 GMT Message-Id: <202110211108.19LB80ed092724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 12615938c6e0 - main - timeout.1: Fix typos in examples List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12615938c6e0bc3ca7604a8b0614ff23d9964370 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=12615938c6e0bc3ca7604a8b0614ff23d9964370 commit 12615938c6e0bc3ca7604a8b0614ff23d9964370 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-10-21 11:06:45 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-10-21 11:07:32 +0000 timeout.1: Fix typos in examples MFC after: 3 days --- usr.bin/timeout/timeout.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1 index 87a86c81e6ee..27f022c48636 100644 --- a/usr.bin/timeout/timeout.1 +++ b/usr.bin/timeout/timeout.1 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2021 +.Dd October 21, 2021 .Dt TIMEOUT 1 .Os .Sh NAME @@ -161,7 +161,7 @@ $ echo $? .Pp Same as above but preserving status. Exit status is 128 + signal number (15 for -.Va SIGTERM ) +.Va SIGTERM ) : .Bd -literal -offset indent $ timeout --preserve-status 2 sleep 4 $ echo $? @@ -171,7 +171,7 @@ $ echo $? Same as above but sending .Va SIGALRM (signal number 14) instead of -.Va SIGTERM +.Va SIGTERM : .Bd -literal -offset indent $ timeout --preserve-status -s SIGALRM 2 sleep 4 $ echo $? @@ -189,8 +189,8 @@ signal after 1 minute and send a .Va SIGKILL signal 5 seconds later if the process refuses to stop: .Bd -literal -offset indent -timeout -k 5s 1m fetch \\ -https://download.freebsd.org/ftp/doc/en/books/handbook/book.pdf +$ timeout -k 5s 1m fetch \\ +> https://download.freebsd.org/ftp/doc/en/books/handbook/book.pdf .Ed .Sh SEE ALSO .Xr kill 1 , From nobody Thu Oct 21 11:24:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F0C2717F0AE7; Thu, 21 Oct 2021 11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZlVh56rgz4xkb; Thu, 21 Oct 2021 11:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 903221A6A0; Thu, 21 Oct 2021 11:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LBOCAc019018; Thu, 21 Oct 2021 11:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LBOCot019017; Thu, 21 Oct 2021 11:24:12 GMT (envelope-from git) Date: Thu, 21 Oct 2021 11:24:12 GMT Message-Id: <202110211124.19LBOCot019017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 01593a0ff9f1 - main - Only change the fadt revision in acpidump on i386 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01593a0ff9f16e2cb23ab2ebc4ca3b8bd2434425 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=01593a0ff9f16e2cb23ab2ebc4ca3b8bd2434425 commit 01593a0ff9f16e2cb23ab2ebc4ca3b8bd2434425 Author: Andrew Turner AuthorDate: 2021-10-20 09:19:55 +0000 Commit: Andrew Turner CommitDate: 2021-10-21 11:20:32 +0000 Only change the fadt revision in acpidump on i386 There is a workaround in acpidump for an old IBM laptop. This is being hit on a modern arm64 system causing acpidump to use the wrong field when reading a later address. As the laptop has a 32-bit CPU the only FreeBSD support for it is i386. As such limit the workaround to that architecture. Reviewed by: emaste, jkim, jhb (all earlier version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32573 --- usr.sbin/acpi/acpidump/acpi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index adb5b968f441..0e91a85f6a90 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -219,16 +219,22 @@ acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt) if (addr_size == 8) { fadt_revision = 2; +#if defined(__i386__) /* * A few systems (e.g., IBM T23) have an RSDP that claims * revision 2 but the 64 bit addresses are invalid. If * revision 2 and the 32 bit address is non-zero but the * 32 and 64 bit versions don't match, prefer the 32 bit * version for all subsequent tables. + * + * The only known ACPI systems this affects are early + * implementations on 32-bit x86. Because of this limit the + * workaround to i386. */ if (fadt->Facs != 0 && (fadt->XFacs & 0xffffffff) != fadt->Facs) fadt_revision = 1; +#endif } else fadt_revision = 1; return (fadt_revision); From nobody Thu Oct 21 13:47:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EA2AE180CE66; Thu, 21 Oct 2021 13:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZpgs678nz3qgC; Thu, 21 Oct 2021 13:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE10B1C168; Thu, 21 Oct 2021 13:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LDlLQC004710; Thu, 21 Oct 2021 13:47:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LDlLoS004709; Thu, 21 Oct 2021 13:47:21 GMT (envelope-from git) Date: Thu, 21 Oct 2021 13:47:21 GMT Message-Id: <202110211347.19LDlLoS004709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 6ba2210ee039 - main - zfs: merge openzfs/zfs@ec64fdb93 (master) into main List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ba2210ee039f2f12878c217bcf058e9c8b26b29 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=6ba2210ee039f2f12878c217bcf058e9c8b26b29 commit 6ba2210ee039f2f12878c217bcf058e9c8b26b29 Merge: 01593a0ff9f1 ec64fdb93d14 Author: Martin Matuska AuthorDate: 2021-10-21 11:58:45 +0000 Commit: Martin Matuska CommitDate: 2021-10-21 13:06:06 +0000 zfs: merge openzfs/zfs@ec64fdb93 (master) into main Notable upstream pull request merges: #12392 Avoid panic in case of pool errors and missing L2ARC #12448 skip snapshot in zfs_iter_mounted() #12516 Fix NFS and large reads on older kernels #12533 Fail invalid incremental recursive send gracefully #12569 FreeBSD: Really zero the zero page #12575 Reject zfs send -RI with nonexistent fromsnap #12602 Correct refcount_add in dmu_zfetch #12650 zpool should call zfs_nicestrtonum() with non-NULL handle Obtained from: OpenZFS OpenZFS commit: ec64fdb93d144ab1884097cfd36e18b62a2db848 cddl/lib/libzfs/Makefile | 1 - cddl/lib/libzfs_core/Makefile | 7 +- cddl/lib/libzutil/Makefile | 5 +- sys/contrib/openzfs/META | 2 +- sys/contrib/openzfs/cmd/arcstat/arcstat.in | 66 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 4 +- sys/contrib/openzfs/cmd/zdb/zdb.c | 9 +- .../openzfs/cmd/zed/zed.d/statechange-notify.sh | 5 +- sys/contrib/openzfs/cmd/zpool/Makefile.am | 3 +- sys/contrib/openzfs/cmd/zpool/zpool_iter.c | 50 +- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 10 +- sys/contrib/openzfs/cmd/zpool/zpool_util.h | 2 +- sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in | 1 - sys/contrib/openzfs/contrib/initramfs/scripts/zfs | 1 + sys/contrib/openzfs/include/libzfs.h | 1 + sys/contrib/openzfs/include/libzfs_core.h | 3 + sys/contrib/openzfs/include/libzutil.h | 11 +- .../include/os/freebsd/zfs/sys/zfs_ioctl_compat.h | 1 - sys/contrib/openzfs/include/sys/dmu.h | 2 + sys/contrib/openzfs/include/sys/zfs_refcount.h | 8 + sys/contrib/openzfs/include/sys/zio.h | 72 +- sys/contrib/openzfs/lib/Makefile.am | 39 + sys/contrib/openzfs/lib/libshare/os/linux/nfs.c | 47 +- sys/contrib/openzfs/lib/libspl/page.c | 1 + sys/contrib/openzfs/lib/libzfs/Makefile.am | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs.abi | 1893 +++++++++++++++++++- sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c | 5 +- sys/contrib/openzfs/lib/libzfs/libzfs_iter.c | 7 +- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 28 +- .../openzfs/lib/libzfs/os/freebsd/libzfs_compat.c | 9 +- .../lib/libzfs/os/freebsd/libzfs_ioctl_compat.c | 432 ----- .../openzfs/lib/libzfs/os/linux/libzfs_util_os.c | 6 + sys/contrib/openzfs/lib/libzfs_core/Makefile.am | 20 +- .../openzfs/lib/libzfs_core/libzfs_core.abi | 946 +--------- sys/contrib/openzfs/lib/libzfs_core/libzfs_core.c | 10 +- .../os/freebsd/libzfs_core_ioctl.c} | 5 +- .../os/linux/libzfs_core_ioctl.c} | 4 +- sys/contrib/openzfs/lib/libzpool/Makefile.am | 4 +- sys/contrib/openzfs/lib/libzpool/util.c | 98 +- sys/contrib/openzfs/lib/libzutil/Makefile.am | 12 +- .../lib/libzutil/os/freebsd/zutil_import_os.c | 5 + .../lib/libzutil/os/linux/zutil_import_os.c | 67 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 68 + sys/contrib/openzfs/man/man8/zfs-send.8 | 3 + sys/contrib/openzfs/man/man8/zfs.8 | 2 +- sys/contrib/openzfs/module/Makefile.in | 9 +- sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 1 + sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c | 19 - sys/contrib/openzfs/module/zfs/arc.c | 7 +- sys/contrib/openzfs/module/zfs/dmu.c | 6 +- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 3 +- sys/contrib/openzfs/module/zfs/dnode.c | 75 +- sys/contrib/openzfs/module/zfs/refcount.c | 8 + sys/contrib/openzfs/module/zfs/vdev.c | 24 + sys/contrib/openzfs/module/zfs/zfs_vnops.c | 8 + sys/contrib/openzfs/tests/runfiles/linux.run | 2 +- sys/contrib/openzfs/tests/runfiles/sanity.run | 2 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 4 +- .../openzfs/tests/test-runner/include/logapi.shlib | 50 + .../cmd/libzfs_input_check/libzfs_input_check.c | 6 +- .../openzfs/tests/zfs-tests/cmd/mkbusy/Makefile.am | 2 - .../openzfs/tests/zfs-tests/cmd/mkbusy/mkbusy.c | 20 +- .../openzfs/tests/zfs-tests/include/blkdev.shlib | 2 +- .../functional/cli_root/zfs_share/Makefile.am | 1 + .../cli_root/zfs_share/zfs_share_007_neg.ksh | 2 +- .../cli_root/zfs_share/zfs_share_013_pos.ksh | 80 + .../cli_root/zfs_unmount/zfs_unmount_nested.ksh | 8 +- .../tests/functional/compression/Makefile.am | 4 +- .../functional/compression/compress_zstd_bswap.ksh | 55 + .../functional/compression/testpool_zstd.tar.gz | Bin 0 -> 1286794 bytes .../zfs-tests/tests/functional/ctime/Makefile.am | 2 - .../tests/zfs-tests/tests/functional/ctime/ctime.c | 10 +- .../tests/functional/deadman/deadman_sync.ksh | 4 +- .../tests/functional/rsend/rsend_016_neg.ksh | 14 +- .../zvol/zvol_misc/zvol_misc_common.kshlib | 11 +- .../zvol/zvol_misc/zvol_misc_rename_inuse.ksh | 4 +- .../zvol/zvol_misc/zvol_misc_snapdev.ksh | 2 +- .../zvol/zvol_misc/zvol_misc_volmode.ksh | 46 +- .../functional/zvol/zvol_misc/zvol_misc_zil.ksh | 4 +- .../openzfs/tests/zfs-tests/tests/perf/perf.shlib | 1 - .../tests/perf/regression/random_reads.ksh | 1 + .../tests/perf/regression/random_readwrite.ksh | 1 + .../perf/regression/random_readwrite_fixed.ksh | 1 + .../tests/perf/regression/random_writes.ksh | 1 + .../tests/perf/regression/random_writes_zil.ksh | 3 +- .../tests/perf/regression/sequential_reads.ksh | 1 + .../regression/sequential_reads_arc_cached.ksh | 3 +- .../sequential_reads_arc_cached_clone.ksh | 3 +- .../regression/sequential_reads_dbuf_cached.ksh | 1 + .../tests/perf/regression/sequential_writes.ksh | 3 +- sys/modules/zfs/zfs_config.h | 21 +- sys/modules/zfs/zfs_gitrev.h | 2 +- 92 files changed, 2750 insertions(+), 1764 deletions(-) diff --cc cddl/lib/libzfs/Makefile index 6de09d1b7333,000000000000..63bfcb39d4d8 mode 100644,000000..100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@@ -1,109 -1,0 +1,108 @@@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs/os/freebsd +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare +.PATH: ${SRCTOP}/sys/contrib/openzfs/include +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib + +PACKAGE= runtime +LIB= zfs +LIBADD= \ + avl \ + bsdxml \ + crypto \ + geom \ + m \ + md \ + nvpair \ + pthread \ + umem \ + util \ + uutil \ + z \ + zfs_core \ + zutil + +INCS= libzfs.h +USER_C = \ + libzfs_changelist.c \ + libzfs_config.c \ + libzfs_crypto.c \ + libzfs_dataset.c \ + libzfs_diff.c \ + libzfs_import.c \ + libzfs_iter.c \ + libzfs_mount.c \ + libzfs_pool.c \ + libzfs_sendrecv.c \ + libzfs_status.c \ + libzfs_util.c + +# FreeBSD +USER_C += \ + libzfs_compat.c \ - libzfs_ioctl_compat.c \ + libzfs_zmount.c + +# libshare +USER_C += \ + libshare.c \ + nfs.c \ + os/freebsd/nfs.c \ + os/freebsd/smb.c + +KERNEL_C = \ + algs/sha2/sha2.c \ + cityhash.c \ + zfeature_common.c \ + zfs_comutil.c \ + zfs_deleg.c \ + zfs_fletcher.c \ + zfs_fletcher_superscalar.c \ + zfs_fletcher_superscalar4.c \ + zfs_namecheck.c \ + zfs_prop.c \ + zpool_prop.c \ + zprop_common.c + + +ARCH_C = +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +ARCH_C += zfs_fletcher_intel.c \ + zfs_fletcher_sse.c +CFLAGS += -DHAVE_SSE2 +.endif +.if ${MACHINE_ARCH} == "amd64" +ARCH_C += zfs_fletcher_avx512.c +CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F +.endif +.if ${MACHINE_CPUARCH} == "aarch64" +ARCH_C += zfs_fletcher_aarch64_neon.c +.endif + +SRCS= $(USER_C) $(KERNEL_C) $(ARCH_C) + +WARNS?= 2 +SHLIB_MAJOR= 4 +CSTD= c99 +CFLAGS+= -DIN_BASE +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libshare +CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include +CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS+= -DSYSCONFDIR=\"/etc\" +CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\" + + +.include diff --cc cddl/lib/libzfs_core/Makefile index 52747bfcc2d8,000000000000..abe0348f2313 mode 100644,000000..100644 --- a/cddl/lib/libzfs_core/Makefile +++ b/cddl/lib/libzfs_core/Makefile @@@ -1,28 -1,0 +1,33 @@@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core +.PATH: ${SRCTOP}/sys/contrib/openzfs/include ++.PATH: ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs ++.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs + + +LIB= zfs_core +LIBADD= nvpair +PACKAGE= runtime + +INCS= libzfs_core.h - SRCS= libzfs_core.c ++SRCS= libzfs_core.c \ ++ os/freebsd/libzfs_core_ioctl.c \ ++ zfs_ioctl_compat.c + +WARNS?= 2 +CSTD= c99 +CFLAGS+= -DIN_BASE +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core/common +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/ +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd ++CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs +CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h + +.include diff --cc cddl/lib/libzutil/Makefile index 7aea9da14e90,000000000000..85467151a5bb mode 100644,000000..100644 --- a/cddl/lib/libzutil/Makefile +++ b/cddl/lib/libzutil/Makefile @@@ -1,42 -1,0 +1,41 @@@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzutil +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzutil/os/freebsd +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs + +LIB= zutil +LIBADD= avl tpool +PACKAGE= runtime + +INCS = zutil_import.h + +SRCS = \ + zutil_device_path.c \ + zutil_import.c \ + zutil_import.h \ + zutil_nicenum.c \ + zutil_pool.c + +SRCS += \ - zutil_device_path_os.c \ - zutil_import_os.c \ - zutil_compat.c ++ os/freebsd/zutil_device_path_os.c \ ++ os/freebsd/zutil_import_os.c + +SRCS += zfs_ioctl_compat.c + + +WARNS?= 2 +CSTD= c99 + +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/ +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs +CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzutil +CFLAGS+= -DHAVE_ISSETUGID -DIN_BASE +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h + +.include diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh index 000000000000,150eddac0ebb..150eddac0ebb mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_zstd_bswap.ksh index 000000000000,9726cf0dd5a6..9726cf0dd5a6 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_zstd_bswap.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_zstd_bswap.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/testpool_zstd.tar.gz index 000000000000,4096f7fcbe44..4096f7fcbe44 mode 000000,100644..100644 Binary files differ diff --cc sys/modules/zfs/zfs_config.h index 82f6d415f966,000000000000..8bbe141827db mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,849 -1,0 +1,864 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_disk() exists */ +/* #undef HAVE_BLK_ALLOC_DISK */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + ++/* blk_queue_update_readahead() exists */ ++/* #undef HAVE_BLK_QUEUE_UPDATE_READAHEAD */ ++ +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + ++/* disk_update_readahead() exists */ ++/* #undef HAVE_DISK_UPDATE_READAHEAD */ ++ +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + ++/* iops->get_acl() exists */ ++/* #undef HAVE_GET_ACL */ ++ ++/* iops->get_acl() takes rcu */ ++/* #undef HAVE_GET_ACL_RCU */ ++ +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + ++/* standalone exists */ ++/* #undef HAVE_STANDALONE_LINUX_STDARG */ ++ +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* 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_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + *** 237 LINES SKIPPED *** From nobody Thu Oct 21 15:20:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6280D17F0CD8; Thu, 21 Oct 2021 15:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZrlS0W4wz3CKs; Thu, 21 Oct 2021 15:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEEAF1D825; Thu, 21 Oct 2021 15:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LFKZo3037261; Thu, 21 Oct 2021 15:20:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LFKZoh037260; Thu, 21 Oct 2021 15:20:35 GMT (envelope-from git) Date: Thu, 21 Oct 2021 15:20:35 GMT Message-Id: <202110211520.19LFKZoh037260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 8cb175ba0c61 - main - Enable stack gap on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cb175ba0c61dd8956ae96b8b4f25e494025cc62 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=8cb175ba0c61dd8956ae96b8b4f25e494025cc62 commit 8cb175ba0c61dd8956ae96b8b4f25e494025cc62 Author: Dawid Gorecki AuthorDate: 2021-10-21 15:18:46 +0000 Commit: Marcin Wojtas CommitDate: 2021-10-21 15:20:08 +0000 Enable stack gap on arm64 Stack gap code used on amd64 can also be reused for arm64. Point sv_stackgap to elf64_stackgap to enable this feature. Reviewed by: mw, kib, emaste Tested by: mw MFC: after 1 month Differential Revision: https://reviews.freebsd.org/D32588 --- sys/arm64/arm64/elf_machdep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index eafaf4150dff..bb9e7e8fee4c 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -93,6 +93,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_stackgap = elf64_stackgap, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, .sv_onexec_old = exec_onexec_old, From nobody Thu Oct 21 16:31:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F1363181ED46; Thu, 21 Oct 2021 16:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZtJq6YBpz4VvR; Thu, 21 Oct 2021 16:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C18261E674; Thu, 21 Oct 2021 16:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LGV7CF038164; Thu, 21 Oct 2021 16:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LGV7Mk038163; Thu, 21 Oct 2021 16:31:07 GMT (envelope-from git) Date: Thu, 21 Oct 2021 16:31:07 GMT Message-Id: <202110211631.19LGV7Mk038163@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: f1f7f31366e5 - main - cmp: initialize limit to avoid stack garbage limits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1f7f31366e5830f4f5b96c6394a0b91475744f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f1f7f31366e5830f4f5b96c6394a0b91475744f4 commit f1f7f31366e5830f4f5b96c6394a0b91475744f4 Author: Kyle Evans AuthorDate: 2021-10-21 16:30:55 +0000 Commit: Kyle Evans CommitDate: 2021-10-21 16:30:55 +0000 cmp: initialize limit to avoid stack garbage limits Pointy hat: kevans Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]") Sponsored by: Klara, Inc. --- usr.bin/cmp/cmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 98ae96c73375..83ea7ae7eee0 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -105,7 +105,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; - skip1 = skip2 = 0; + limit = skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { From nobody Thu Oct 21 17:03:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 15BF3180456A; Thu, 21 Oct 2021 17:03:16 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv1v584qz4fpk; Thu, 21 Oct 2021 17:03:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19LH365e010537 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 21 Oct 2021 10:03:07 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19LH35S2010536; Thu, 21 Oct 2021 10:03:05 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 21 Oct 2021 10:03:05 -0700 From: Gleb Smirnoff To: Slawa Olhovchenkov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211021080214.GB77338@zxy.spb.ru> X-Rspamd-Queue-Id: 4HZv1v584qz4fpk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: S> > laptops. If somebody is using vt(4) instead of X on a laptop, then S> S> This change disable bell in X11 too. S> This is completly disable speaker bell. Are you sure? I haven't yet upgraded my desktop to this point, so can't test. How is that possible that vt(4) affects X11? -- Gleb Smirnoff From nobody Thu Oct 21 17:06:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7716C18066F1; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv622cGnz4gw5; Thu, 21 Oct 2021 17:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38EB71EFB2; Thu, 21 Oct 2021 17:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6okU080050; Thu, 21 Oct 2021 17:06:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6o2l080049; Thu, 21 Oct 2021 17:06:50 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:50 GMT Message-Id: <202110211706.19LH6o2l080049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ec3872a696a9 - stable/13 - Add an OCF algorithm for ChaCha20-Poly1305 AEAD. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ec3872a696a9b931ca8366c616bf9efc2dbfe8f8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ec3872a696a9b931ca8366c616bf9efc2dbfe8f8 commit ec3872a696a9b931ca8366c616bf9efc2dbfe8f8 Author: John Baldwin AuthorDate: 2021-02-18 17:21:56 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:22 +0000 Add an OCF algorithm for ChaCha20-Poly1305 AEAD. Note that this algorithm implements the mode defined in RFC 8439. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27836 (cherry picked from commit fc8fc743d89388c0c5b97a491428fab2b36beac8) --- share/man/man7/crypto.7 | 4 +++- sys/conf/files | 1 + sys/modules/crypto/Makefile | 1 + sys/opencrypto/crypto.c | 12 +++++----- sys/opencrypto/cryptodev.c | 11 +++++++++ sys/opencrypto/cryptodev.h | 5 +++- sys/opencrypto/xform_chacha20_poly1305.c | 41 ++++++++++++++++++++++++++++++++ sys/opencrypto/xform_enc.h | 1 + 8 files changed, 68 insertions(+), 8 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index d6cae1e39819..ccc2d1fc9be3 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2021 +.Dd February 18, 2021 .Dt CRYPTO 7 .Os .Sh NAME @@ -161,6 +161,8 @@ The following AEAD algorithms are supported: AES Galois/Counter Mode .It Dv CRYPTO_AES_CCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta AES Counter with CBC-MAC +.It Dv CRYPTO_CHACHA20_POLY1305 Ta 12 Ta 32 Ta 16 Ta +ChaCha20-Poly1305 .El .Sh SEE ALSO .Xr crypto 4 , diff --git a/sys/conf/files b/sys/conf/files index 2d3ae104753d..a352a0759c99 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4948,6 +4948,7 @@ opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support opencrypto/xform_cbc_mac.c optional crypto +opencrypto/xform_chacha20_poly1305.c optional crypto opencrypto/xform_poly1305.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile index 01ade43a0e51..89af6ab8fc61 100644 --- a/sys/modules/crypto/Makefile +++ b/sys/modules/crypto/Makefile @@ -67,6 +67,7 @@ SRCS += randombytes.c CFLAGS.randombytes.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += utils.c CFLAGS.utils.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} +SRCS += xform_chacha20_poly1305.c SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h SRCS += opt_compat.h diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 59c74c86de00..704077043bb8 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -602,6 +602,8 @@ crypto_cipher(const struct crypto_session_params *csp) return (&enc_xform_chacha20); case CRYPTO_AES_CCM_16: return (&enc_xform_ccm); + case CRYPTO_CHACHA20_POLY1305: + return (&enc_xform_chacha20_poly1305); default: return (NULL); } @@ -693,6 +695,7 @@ static enum alg_type { [CRYPTO_POLY1305] = ALG_KEYED_DIGEST, [CRYPTO_AES_CCM_CBC_MAC] = ALG_KEYED_DIGEST, [CRYPTO_AES_CCM_16] = ALG_AEAD, + [CRYPTO_CHACHA20_POLY1305] = ALG_AEAD, }; static enum alg_type @@ -837,6 +840,7 @@ check_csp(const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: if (csp->csp_auth_mlen > 16) return (false); break; @@ -1310,12 +1314,8 @@ crp_sanity(struct cryptop *crp) crp->crp_op == (CRYPTO_OP_DECRYPT | CRYPTO_OP_VERIFY_DIGEST), ("invalid AEAD op %x", crp->crp_op)); - if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) - KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, - ("GCM without a separate IV")); - if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) - KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, - ("CCM without a separate IV")); + KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, + ("AEAD without a separate IV")); break; case CSP_MODE_ETA: KASSERT(crp->crp_op == diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 61f8f332e1ca..81c6dcd01e2a 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -428,6 +428,9 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) case CRYPTO_AES_CCM_16: txform = &enc_xform_ccm; break; + case CRYPTO_CHACHA20_POLY1305: + txform = &enc_xform_chacha20_poly1305; + break; default: CRYPTDEB("invalid cipher"); SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); @@ -586,6 +589,12 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) return (EINVAL); } csp.csp_mode = CSP_MODE_AEAD; + } else if (sop->cipher == CRYPTO_CHACHA20_POLY1305) { + if (sop->mac != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + csp.csp_mode = CSP_MODE_AEAD; } else if (txform != NULL && thash != NULL) csp.csp_mode = CSP_MODE_ETA; else if (txform != NULL) @@ -679,6 +688,8 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) cse->hashsize = AES_GMAC_HASH_LEN; else if (csp.csp_cipher_alg == CRYPTO_AES_CCM_16) cse->hashsize = AES_CBC_MAC_HASH_LEN; + else if (csp.csp_cipher_alg == CRYPTO_CHACHA20_POLY1305) + cse->hashsize = POLY1305_HASH_LEN; cse->ivsize = csp.csp_ivlen; mtx_lock(&fcr->lock); diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index ecb1d929d1db..277867734841 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -124,6 +124,7 @@ #define AES_CCM_IV_LEN 12 #define AES_XTS_IV_LEN 8 #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ +#define CHACHA20_POLY1305_IV_LEN 12 /* Min and Max Encryption Key Sizes */ #define NULL_MIN_KEY 0 @@ -136,6 +137,7 @@ #define AES_XTS_MAX_KEY (2 * AES_MAX_KEY) #define CAMELLIA_MIN_KEY 16 #define CAMELLIA_MAX_KEY 32 +#define CHACHA20_POLY1305_KEY 32 /* Maximum hash algorithm result length */ #define AALG_MAX_RESULT_LEN 64 /* Keep this updated */ @@ -184,7 +186,8 @@ #define CRYPTO_POLY1305 38 #define CRYPTO_AES_CCM_CBC_MAC 39 /* auth side */ #define CRYPTO_AES_CCM_16 40 /* cipher side */ -#define CRYPTO_ALGORITHM_MAX 40 /* Keep updated - see below */ +#define CRYPTO_CHACHA20_POLY1305 41 /* combined AEAD cipher per RFC 8439 */ +#define CRYPTO_ALGORITHM_MAX 41 /* Keep updated - see below */ #define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ (x) <= CRYPTO_ALGORITHM_MAX) diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c new file mode 100644 index 000000000000..e568e76cad51 --- /dev/null +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Netflix Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +struct enc_xform enc_xform_chacha20_poly1305 = { + .type = CRYPTO_CHACHA20_POLY1305, + .name = "ChaCha20-Poly1305", + .ctxsize = sizeof(struct chacha_ctx), + .blocksize = 1, + .native_blocksize = CHACHA_BLOCKLEN, + .ivsize = CHACHA20_POLY1305_IV_LEN, + .minkey = CHACHA20_POLY1305_KEY, + .maxkey = CHACHA20_POLY1305_KEY, +}; + diff --git a/sys/opencrypto/xform_enc.h b/sys/opencrypto/xform_enc.h index b44f1ff0c270..e8325f20917b 100644 --- a/sys/opencrypto/xform_enc.h +++ b/sys/opencrypto/xform_enc.h @@ -81,6 +81,7 @@ extern struct enc_xform enc_xform_aes_nist_gmac; extern struct enc_xform enc_xform_aes_xts; extern struct enc_xform enc_xform_camellia; extern struct enc_xform enc_xform_chacha20; +extern struct enc_xform enc_xform_chacha20_poly1305; extern struct enc_xform enc_xform_ccm; struct aes_icm_ctx { From nobody Thu Oct 21 17:06:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8555218067CE; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6338DVz4h0C; Thu, 21 Oct 2021 17:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48CAB1F20B; Thu, 21 Oct 2021 17:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6ppE080074; Thu, 21 Oct 2021 17:06:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6pms080073; Thu, 21 Oct 2021 17:06:51 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:51 GMT Message-Id: <202110211706.19LH6pms080073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d5cbcae312e7 - stable/13 - Add an implementation of CHACHA20_POLY1305 to cryptosoft. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: d5cbcae312e705fb89e2ce79c823e9d8697c6b0c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d5cbcae312e705fb89e2ce79c823e9d8697c6b0c commit d5cbcae312e705fb89e2ce79c823e9d8697c6b0c Author: John Baldwin AuthorDate: 2021-02-18 17:22:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:22 +0000 Add an implementation of CHACHA20_POLY1305 to cryptosoft. This uses the chacha20 IETF and poly1305 implementations from libsodium. A seperate auth_hash is created for the auth side whose Setkey method derives the poly1305 key from the AEAD key and nonce as described in RFC 8439. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27837 (cherry picked from commit dd2e1352b68aa33f7f6f8c19aaf88cf287013ae8) --- sys/conf/files | 3 +- sys/modules/crypto/Makefile | 9 +- sys/opencrypto/cryptosoft.c | 199 +++++++++++++++++++++++++++++++ sys/opencrypto/xform_auth.h | 1 + sys/opencrypto/xform_chacha20_poly1305.c | 128 +++++++++++++++++++- 5 files changed, 335 insertions(+), 5 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index a352a0759c99..f21c216288b1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4948,7 +4948,8 @@ opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support opencrypto/xform_cbc_mac.c optional crypto -opencrypto/xform_chacha20_poly1305.c optional crypto +opencrypto/xform_chacha20_poly1305.c optional crypto \ + compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" opencrypto/xform_poly1305.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile index 89af6ab8fc61..f64ea1f6fc8b 100644 --- a/sys/modules/crypto/Makefile +++ b/sys/modules/crypto/Makefile @@ -15,6 +15,8 @@ LIBSODIUM=${SRCTOP}/sys/contrib/libsodium/src/libsodium .PATH: ${SRCTOP}/sys/contrib/libb2 .PATH: ${LIBSODIUM}/crypto_onetimeauth/poly1305 .PATH: ${LIBSODIUM}/crypto_onetimeauth/poly1305/donna +.PATH: ${LIBSODIUM}/crypto_stream/chacha20 +.PATH: ${LIBSODIUM}/crypto_stream/chacha20/ref .PATH: ${LIBSODIUM}/crypto_verify/sodium .PATH: ${SRCTOP}/sys/crypto/libsodium @@ -55,8 +57,14 @@ SRCS += chacha-sw.c LIBSODIUM_INC=${LIBSODIUM}/include LIBSODIUM_COMPAT=${SRCTOP}/sys/crypto/libsodium +SRCS += xform_chacha20_poly1305.c +CFLAGS.xform_chacha20_poly1305.c+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += xform_poly1305.c CFLAGS.xform_poly1305.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} +SRCS += stream_chacha20.c +CFLAGS.stream_chacha20.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} +SRCS += chacha20_ref.c +CFLAGS.chacha20_ref.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} SRCS += onetimeauth_poly1305.c CFLAGS.onetimeauth_poly1305.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} SRCS += poly1305_donna.c @@ -67,7 +75,6 @@ SRCS += randombytes.c CFLAGS.randombytes.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += utils.c CFLAGS.utils.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} -SRCS += xform_chacha20_poly1305.c SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h SRCS += opt_compat.h diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 60d1f60d6cc1..6ac628b9c21f 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -867,6 +867,168 @@ out: return (error); } +static int +swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) +{ + const struct crypto_session_params *csp; + uint64_t blkbuf[howmany(CHACHA20_NATIVE_BLOCK_LEN, sizeof(uint64_t))]; + u_char *blk = (u_char *)blkbuf; + u_char tag[POLY1305_HASH_LEN]; + struct crypto_buffer_cursor cc_in, cc_out; + const u_char *inblk; + u_char *outblk; + uint64_t *blkp; + union authctx ctx; + struct swcr_auth *swa; + struct swcr_encdec *swe; + struct auth_hash *axf; + struct enc_xform *exf; + int blksz, error, r, resid; + + swa = &ses->swcr_auth; + axf = swa->sw_axf; + + swe = &ses->swcr_encdec; + exf = swe->sw_exf; + blksz = exf->native_blocksize; + KASSERT(blksz <= sizeof(blkbuf), ("%s: blocksize mismatch", __func__)); + + if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) + return (EINVAL); + + csp = crypto_get_params(crp->crp_session); + + /* Generate Poly1305 key. */ + if (crp->crp_cipher_key != NULL) + axf->Setkey(&ctx, crp->crp_cipher_key, csp->csp_cipher_klen); + else + axf->Setkey(&ctx, csp->csp_cipher_key, csp->csp_cipher_klen); + axf->Reinit(&ctx, crp->crp_iv, csp->csp_ivlen); + + /* Supply MAC with AAD */ + if (crp->crp_aad != NULL) + axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, + crp->crp_aad_length, axf->Update, &ctx); + if (crp->crp_aad_length % 16 != 0) { + /* padding1 */ + memset(blk, 0, 16); + axf->Update(&ctx, blk, 16 - crp->crp_aad_length % 16); + } + + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + csp->csp_cipher_klen); + exf->reinit(swe->sw_kschedule, crp->crp_iv); + + /* Do encryption with MAC */ + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else + cc_out = cc_in; + for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->encrypt(swe->sw_kschedule, inblk, outblk); + axf->Update(&ctx, outblk, blksz); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); + } else { + axf->Update(&ctx, inblk, blksz); + } + } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + exf->encrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } + axf->Update(&ctx, blk, resid); + if (resid % 16 != 0) { + /* padding2 */ + memset(blk, 0, 16); + axf->Update(&ctx, blk, 16 - resid % 16); + } + } + + /* lengths */ + blkp = (uint64_t *)blk; + blkp[0] = htole64(crp->crp_aad_length); + blkp[1] = htole64(crp->crp_payload_length); + axf->Update(&ctx, blk, sizeof(uint64_t) * 2); + + /* Finalize MAC */ + axf->Final(tag, &ctx); + + /* Validate tag */ + error = 0; + if (!CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + u_char tag2[POLY1305_HASH_LEN]; + + crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, tag2); + + r = timingsafe_bcmp(tag, tag2, swa->sw_mlen); + explicit_bzero(tag2, sizeof(tag2)); + if (r != 0) { + error = EBADMSG; + goto out; + } + + /* tag matches, decrypt data */ + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + for (resid = crp->crp_payload_length; resid > blksz; + resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->decrypt(swe->sw_kschedule, inblk, outblk); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); + } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + exf->decrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } + } else { + /* Inject the authentication data */ + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); + } + +out: + explicit_bzero(blkbuf, sizeof(blkbuf)); + explicit_bzero(tag, sizeof(tag)); + explicit_bzero(&ctx, sizeof(ctx)); + return (error); +} + /* * Apply a cipher and a digest to perform EtA. */ @@ -1171,6 +1333,33 @@ swcr_setup_ccm(struct swcr_session *ses, return (swcr_setup_cipher(ses, csp)); } +static int +swcr_setup_chacha20_poly1305(struct swcr_session *ses, + const struct crypto_session_params *csp) +{ + struct swcr_auth *swa; + struct auth_hash *axf; + + if (csp->csp_ivlen != CHACHA20_POLY1305_IV_LEN) + return (EINVAL); + + /* First, setup the auth side. */ + swa = &ses->swcr_auth; + axf = &auth_hash_chacha20_poly1305; + swa->sw_axf = axf; + if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > axf->hashsize) + return (EINVAL); + if (csp->csp_auth_mlen == 0) + swa->sw_mlen = axf->hashsize; + else + swa->sw_mlen = csp->csp_auth_mlen; + + /* The auth state is regenerated for each nonce. */ + + /* Second, setup the cipher side. */ + return (swcr_setup_cipher(ses, csp)); +} + static bool swcr_auth_supported(const struct crypto_session_params *csp) { @@ -1258,6 +1447,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: return (EINVAL); default: if (!swcr_cipher_supported(csp)) @@ -1273,6 +1463,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: break; default: return (EINVAL); @@ -1283,6 +1474,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: return (EINVAL); } switch (csp->csp_auth_alg) { @@ -1343,6 +1535,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, #ifdef INVARIANTS case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: panic("bad cipher algo"); #endif default: @@ -1366,6 +1559,11 @@ swcr_newsession(device_t dev, crypto_session_t cses, if (error == 0) ses->swcr_process = swcr_ccm; break; + case CRYPTO_CHACHA20_POLY1305: + error = swcr_setup_chacha20_poly1305(ses, csp); + if (error == 0) + ses->swcr_process = swcr_chacha20_poly1305; + break; #ifdef INVARIANTS default: panic("bad aead algo"); @@ -1377,6 +1575,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: panic("bad eta cipher algo"); } switch (csp->csp_auth_alg) { diff --git a/sys/opencrypto/xform_auth.h b/sys/opencrypto/xform_auth.h index dbdb278209b5..6427965671d3 100644 --- a/sys/opencrypto/xform_auth.h +++ b/sys/opencrypto/xform_auth.h @@ -84,6 +84,7 @@ extern struct auth_hash auth_hash_poly1305; extern struct auth_hash auth_hash_ccm_cbc_mac_128; extern struct auth_hash auth_hash_ccm_cbc_mac_192; extern struct auth_hash auth_hash_ccm_cbc_mac_256; +extern struct auth_hash auth_hash_chacha20_poly1305; union authctx { SHA1_CTX sha1ctx; diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index e568e76cad51..3a72c06f931b 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -25,17 +25,139 @@ * SUCH DAMAGE. */ -#include +#include #include +#include +#include + +struct chacha20_poly1305_cipher_ctx { + const void *key; + uint32_t ic; + char nonce[CHACHA20_POLY1305_IV_LEN]; +}; + +static int +chacha20_poly1305_setkey(void *vctx, const uint8_t *key, int len) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + if (len != CHACHA20_POLY1305_KEY) + return (EINVAL); + + ctx->key = key; + return (0); +} + +static void +chacha20_poly1305_reinit(void *vctx, const uint8_t *iv) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + /* Block 0 is used for the poly1305 key. */ + memcpy(ctx->nonce, iv, sizeof(ctx->nonce)); + ctx->ic = 1; +} + +static void +chacha20_poly1305_crypt(void *vctx, const uint8_t *in, uint8_t *out) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + int error; + + error = crypto_stream_chacha20_ietf_xor_ic(out, in, + CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); + KASSERT(error == 0, ("%s failed: %d", __func__, error)); + ctx->ic++; +} + +static void +chacha20_poly1305_crypt_last(void *vctx, const uint8_t *in, uint8_t *out, + size_t len) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + int error; + + error = crypto_stream_chacha20_ietf_xor_ic(out, in, len, ctx->nonce, + ctx->ic, ctx->key); + KASSERT(error == 0, ("%s failed: %d", __func__, error)); +} + struct enc_xform enc_xform_chacha20_poly1305 = { .type = CRYPTO_CHACHA20_POLY1305, .name = "ChaCha20-Poly1305", - .ctxsize = sizeof(struct chacha_ctx), + .ctxsize = sizeof(struct chacha20_poly1305_cipher_ctx), .blocksize = 1, - .native_blocksize = CHACHA_BLOCKLEN, + .native_blocksize = CHACHA20_NATIVE_BLOCK_LEN, .ivsize = CHACHA20_POLY1305_IV_LEN, .minkey = CHACHA20_POLY1305_KEY, .maxkey = CHACHA20_POLY1305_KEY, + .encrypt = chacha20_poly1305_crypt, + .decrypt = chacha20_poly1305_crypt, + .setkey = chacha20_poly1305_setkey, + .reinit = chacha20_poly1305_reinit, + .encrypt_last = chacha20_poly1305_crypt_last, + .decrypt_last = chacha20_poly1305_crypt_last, }; +struct chacha20_poly1305_auth_ctx { + struct crypto_onetimeauth_poly1305_state state; + const void *key; +}; +CTASSERT(sizeof(union authctx) >= sizeof(struct chacha20_poly1305_auth_ctx)); + +static void +chacha20_poly1305_Init(void *vctx) +{ +} + +static void +chacha20_poly1305_Setkey(void *vctx, const uint8_t *key, u_int klen) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + ctx->key = key; +} + +static void +chacha20_poly1305_Reinit(void *vctx, const uint8_t *nonce, u_int noncelen) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + char block[CHACHA20_NATIVE_BLOCK_LEN]; + + crypto_stream_chacha20_ietf(block, sizeof(block), nonce, ctx->key); + crypto_onetimeauth_poly1305_init(&ctx->state, block); + explicit_bzero(block, sizeof(block)); +} + +static int +chacha20_poly1305_Update(void *vctx, const void *data, u_int len) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + crypto_onetimeauth_poly1305_update(&ctx->state, data, len); + return (0); +} + +static void +chacha20_poly1305_Final(uint8_t *digest, void *vctx) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + crypto_onetimeauth_poly1305_final(&ctx->state, digest); +} + +struct auth_hash auth_hash_chacha20_poly1305 = { + .type = CRYPTO_POLY1305, + .name = "ChaCha20-Poly1305", + .keysize = POLY1305_KEY_LEN, + .hashsize = POLY1305_HASH_LEN, + .ctxsize = sizeof(struct chacha20_poly1305_auth_ctx), + .blocksize = crypto_onetimeauth_poly1305_BYTES, + .Init = chacha20_poly1305_Init, + .Setkey = chacha20_poly1305_Setkey, + .Reinit = chacha20_poly1305_Reinit, + .Update = chacha20_poly1305_Update, + .Final = chacha20_poly1305_Final, +}; From nobody Thu Oct 21 17:06:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D7E7A1806A04; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv644dSvz4h5q; Thu, 21 Oct 2021 17:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 710D21EFB3; Thu, 21 Oct 2021 17:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6qrW080098; Thu, 21 Oct 2021 17:06:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6q3K080097; Thu, 21 Oct 2021 17:06:52 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:52 GMT Message-Id: <202110211706.19LH6q3K080097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 3a7ae9ce6dce - stable/13 - cryptocheck: Add Chacha20-Poly1305 AEAD coverage. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a7ae9ce6dcea8cc5beb0dc3284e1b50a60eff1e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3a7ae9ce6dcea8cc5beb0dc3284e1b50a60eff1e commit 3a7ae9ce6dcea8cc5beb0dc3284e1b50a60eff1e Author: John Baldwin AuthorDate: 2021-02-18 17:23:36 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:22 +0000 cryptocheck: Add Chacha20-Poly1305 AEAD coverage. - Make openssl_gcm_encrypt generic to AEAD ciphers (aside from CCM) and use it for Chacha20-Poly1305. - Use generic AEAD control constants instead of GCM/CCM specific names. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27838 (cherry picked from commit 1bd9fc96d4e4a26bb0060698c07b6f13d19cd819) --- tools/tools/crypto/cryptocheck.c | 46 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index efb68f8966ef..fc08396b45f5 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -120,6 +120,7 @@ * aes-ccm 128-bit AES-CCM * aes-ccm192 192-bit AES-CCM * aes-ccm256 256-bit AES-CCM + * chacha20-poly1305 Chacha20 (96 bit nonce) with Poly1305 per RFC 8439 */ #include @@ -149,6 +150,7 @@ static const struct alg { int cipher; int mac; enum { T_HASH, T_HMAC, T_GMAC, T_CIPHER, T_ETA, T_AEAD } type; + int tag_len; const EVP_CIPHER *(*evp_cipher)(void); const EVP_MD *(*evp_md)(void); } algs[] = { @@ -177,11 +179,11 @@ static const struct alg { { .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HASH, .evp_md = EVP_blake2s256 }, { .name = "gmac", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_128_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_128_gcm }, { .name = "gmac192", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_192_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_192_gcm }, { .name = "gmac256", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_256_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_256_gcm }, { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, .evp_cipher = EVP_aes_128_cbc }, { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, @@ -201,17 +203,22 @@ static const struct alg { { .name = "chacha20", .cipher = CRYPTO_CHACHA20, .type = T_CIPHER, .evp_cipher = EVP_chacha20 }, { .name = "aes-gcm", .cipher = CRYPTO_AES_NIST_GCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_128_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_128_gcm }, { .name = "aes-gcm192", .cipher = CRYPTO_AES_NIST_GCM_16, - .type = T_AEAD, .evp_cipher = EVP_aes_192_gcm }, + .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, + .evp_cipher = EVP_aes_192_gcm }, { .name = "aes-gcm256", .cipher = CRYPTO_AES_NIST_GCM_16, - .type = T_AEAD, .evp_cipher = EVP_aes_256_gcm }, + .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, + .evp_cipher = EVP_aes_256_gcm }, { .name = "aes-ccm", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_128_ccm }, + .evp_cipher = EVP_aes_128_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, { .name = "aes-ccm192", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_192_ccm }, + .evp_cipher = EVP_aes_192_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, { .name = "aes-ccm256", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_256_ccm }, + .evp_cipher = EVP_aes_256_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, + { .name = "chacha20-poly1305", .cipher = CRYPTO_CHACHA20_POLY1305, + .type = T_AEAD, .tag_len = POLY1305_HASH_LEN, + .evp_cipher = EVP_chacha20_poly1305 }, }; static bool verbose; @@ -1046,7 +1053,7 @@ openssl_gmac(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, if (EVP_EncryptFinal_ex(ctx, NULL, &outl) != 1) errx(1, "OpenSSL %s (%zu) final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1133,7 +1140,7 @@ out: } static void -openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, +openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) { @@ -1168,7 +1175,7 @@ openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if ((size_t)total != size) errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, size, total); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1177,7 +1184,7 @@ openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, #ifdef notused static bool -openssl_gcm_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, +openssl_aead_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) { @@ -1206,7 +1213,7 @@ openssl_gcm_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, errx(1, "OpenSSL %s (%zu) decrypt update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); total = outl; - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1235,10 +1242,10 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, iv_len, NULL) != 1) + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) errx(1, "OpenSSL %s (%zu) setting tag length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, @@ -1268,7 +1275,7 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if ((size_t)total != size) errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, size, total); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_GET_TAG, AES_CBC_MAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_CBC_MAC_HASH_LEN, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1311,7 +1318,8 @@ ocf_aead(const struct ocf_session *ses, const char *iv, size_t iv_len, return (0); } -#define AEAD_MAX_TAG_LEN MAX(AES_GMAC_HASH_LEN, AES_CBC_MAC_HASH_LEN) +#define AEAD_MAX_TAG_LEN \ + MAX(MAX(AES_GMAC_HASH_LEN, AES_CBC_MAC_HASH_LEN), POLY1305_HASH_LEN) static void run_aead_test(const struct alg *alg, size_t aad_len, size_t size) @@ -1368,7 +1376,7 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) openssl_ccm_encrypt(alg, cipher, key, iv, iv_len, aad, aad_len, cleartext, ciphertext, size, control_tag); else - openssl_gcm_encrypt(alg, cipher, key, iv, aad, aad_len, + openssl_aead_encrypt(alg, cipher, key, iv, aad, aad_len, cleartext, ciphertext, size, control_tag); if (!ocf_init_aead_session(alg, key, key_len, &ses)) From nobody Thu Oct 21 17:06:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 26FA018067D8; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv655f9lz4gwF; Thu, 21 Oct 2021 17:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7ECE61F097; Thu, 21 Oct 2021 17:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6r6W080122; Thu, 21 Oct 2021 17:06:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6rlo080121; Thu, 21 Oct 2021 17:06:53 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:53 GMT Message-Id: <202110211706.19LH6rlo080121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: c3eec459b643 - stable/13 - cryptosoft: Support per-op keys for AES-GCM and AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: c3eec459b643f08a9af479b28a0789b655207617 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c3eec459b643f08a9af479b28a0789b655207617 commit c3eec459b643f08a9af479b28a0789b655207617 Author: John Baldwin AuthorDate: 2021-02-18 17:24:35 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:23 +0000 cryptosoft: Support per-op keys for AES-GCM and AES-CCM. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28752 (cherry picked from commit a10020cfe2830e9626ac58ae97ecd12afb3553be) --- sys/opencrypto/cryptosoft.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 6ac628b9c21f..a09f085a1eef 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -537,6 +537,9 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) } } + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + crypto_get_params(crp->crp_session)->csp_cipher_klen); exf->reinit(swe->sw_kschedule, iv); /* Do encryption with MAC */ @@ -755,6 +758,9 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) if (error) return (error); + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + crypto_get_params(crp->crp_session)->csp_cipher_klen); exf->reinit(swe->sw_kschedule, iv); /* Do encryption/decryption with MAC */ From nobody Thu Oct 21 17:06:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C0EBF1806B16; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6756XKz4gwS; Thu, 21 Oct 2021 17:06:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5F9E1ED6D; Thu, 21 Oct 2021 17:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6spk080146; Thu, 21 Oct 2021 17:06:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6sS0080145; Thu, 21 Oct 2021 17:06:54 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:54 GMT Message-Id: <202110211706.19LH6sS0080145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1ab6c8ca7eed - stable/13 - cryptocheck: Add support for the Poly1305 digest. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1ab6c8ca7eed3d0e75959636d6855a92ebf5015b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ab6c8ca7eed3d0e75959636d6855a92ebf5015b commit 1ab6c8ca7eed3d0e75959636d6855a92ebf5015b Author: John Baldwin AuthorDate: 2021-03-03 23:17:00 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:23 +0000 cryptocheck: Add support for the Poly1305 digest. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28758 (cherry picked from commit 68c03734484f679bf2f15fc81359128e331db364) --- tools/tools/crypto/cryptocheck.c | 90 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 85 insertions(+), 5 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index fc08396b45f5..389d0cc9f610 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -98,6 +98,7 @@ * gmac 128-bit GMAC * gmac192 192-bit GMAC * gmac256 256-bit GMAC + * poly1305 * * Ciphers: * aes-cbc 128-bit AES-CBC @@ -149,10 +150,12 @@ static const struct alg { const char *name; int cipher; int mac; - enum { T_HASH, T_HMAC, T_GMAC, T_CIPHER, T_ETA, T_AEAD } type; + enum { T_HASH, T_HMAC, T_GMAC, T_DIGEST, T_CIPHER, T_ETA, T_AEAD } type; + int key_len; int tag_len; const EVP_CIPHER *(*evp_cipher)(void); const EVP_MD *(*evp_md)(void); + int pkey; } algs[] = { { .name = "sha1", .mac = CRYPTO_SHA1, .type = T_HASH, .evp_md = EVP_sha1 }, @@ -184,6 +187,8 @@ static const struct alg { .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_192_gcm }, { .name = "gmac256", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_256_gcm }, + { .name = "poly1305", .mac = CRYPTO_POLY1305, .type = T_DIGEST, + .key_len = POLY1305_KEY_LEN, .pkey = EVP_PKEY_POLY1305 }, { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, .evp_cipher = EVP_aes_128_cbc }, { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, @@ -1061,7 +1066,7 @@ openssl_gmac(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, } static bool -ocf_gmac(const struct alg *alg, const char *input, size_t size, const char *key, +ocf_mac(const struct alg *alg, const char *input, size_t size, const char *key, size_t key_len, const char *iv, char *tag, int *cridp) { struct ocf_session ses; @@ -1072,7 +1077,7 @@ ocf_gmac(const struct alg *alg, const char *input, size_t size, const char *key, sop.mackeylen = key_len; sop.mackey = key; sop.mac = alg->mac; - if (!ocf_init_session(&sop, "GMAC", alg->name, &ses)) + if (!ocf_init_session(&sop, "MAC", alg->name, &ses)) return (false); ocf_init_cop(&ses, &cop); @@ -1119,7 +1124,78 @@ run_gmac_test(const struct alg *alg, size_t size) openssl_gmac(alg, cipher, key, iv, buffer, size, control_tag); /* OCF GMAC. */ - if (!ocf_gmac(alg, buffer, size, key, key_len, iv, test_tag, &crid)) + if (!ocf_mac(alg, buffer, size, key, key_len, iv, test_tag, &crid)) + goto out; + if (memcmp(control_tag, test_tag, sizeof(control_tag)) != 0) { + printf("%s (%zu) mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(control_tag, sizeof(control_tag), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_tag, sizeof(test_tag), NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(buffer); + free(key); +} + +static void +openssl_digest(const struct alg *alg, const char *key, u_int key_len, + const char *input, size_t size, char *tag, u_int tag_len) +{ + EVP_MD_CTX *mdctx; + EVP_PKEY *pkey; + size_t len; + + pkey = EVP_PKEY_new_raw_private_key(alg->pkey, NULL, key, key_len); + if (pkey == NULL) + errx(1, "OpenSSL %s (%zu) pkey new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + mdctx = EVP_MD_CTX_new(); + if (mdctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_DigestSignInit(mdctx, NULL, NULL, NULL, pkey) != 1) + errx(1, "OpenSSL %s (%zu) digest sign init failed: %s", + alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_DigestSignUpdate(mdctx, input, size) != 1) + errx(1, "OpenSSL %s (%zu) digest update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + len = tag_len; + if (EVP_DigestSignFinal(mdctx, tag, &len) != 1) + errx(1, "OpenSSL %s (%zu) digest final failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_MD_CTX_free(mdctx); + EVP_PKEY_free(pkey); +} + +static void +run_digest_test(const struct alg *alg, size_t size) +{ + char *key, *buffer; + u_int key_len; + int crid; + char control_tag[EVP_MAX_MD_SIZE], test_tag[EVP_MAX_MD_SIZE]; + + memset(control_tag, 0x3c, sizeof(control_tag)); + memset(test_tag, 0x3c, sizeof(test_tag)); + + key_len = alg->key_len; + + key = alloc_buffer(key_len); + buffer = alloc_buffer(size); + + /* OpenSSL Poly1305. */ + openssl_digest(alg, key, key_len, buffer, size, control_tag, + sizeof(control_tag)); + + /* OCF Poly1305. */ + if (!ocf_mac(alg, buffer, size, key, key_len, NULL, test_tag, &crid)) goto out; if (memcmp(control_tag, test_tag, sizeof(control_tag)) != 0) { printf("%s (%zu) mismatch:\n", alg->name, size); @@ -1471,6 +1547,9 @@ run_test(const struct alg *alg, size_t aad_len, size_t size) case T_GMAC: run_gmac_test(alg, size); break; + case T_DIGEST: + run_digest_test(alg, size); + break; case T_CIPHER: run_cipher_test(alg, size); break; @@ -1518,7 +1597,8 @@ run_mac_tests(void) u_int i; for (i = 0; i < nitems(algs); i++) - if (algs[i].type == T_HMAC || algs[i].type == T_GMAC) + if (algs[i].type == T_HMAC || algs[i].type == T_GMAC || + algs[i].type == T_DIGEST) run_test_sizes(&algs[i]); } From nobody Thu Oct 21 17:06:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 921661806875; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv680mKRz4h8N; Thu, 21 Oct 2021 17:06:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C226D1ED6E; Thu, 21 Oct 2021 17:06:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6tNI080177; Thu, 21 Oct 2021 17:06:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6tYA080176; Thu, 21 Oct 2021 17:06:55 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:55 GMT Message-Id: <202110211706.19LH6tYA080176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 29af3bc12dd7 - stable/13 - cryptocheck: Free generated IV after each GMAC test. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 29af3bc12dd76a4a83556634e400e8f047ea679a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=29af3bc12dd76a4a83556634e400e8f047ea679a commit 29af3bc12dd76a4a83556634e400e8f047ea679a Author: John Baldwin AuthorDate: 2021-03-03 23:17:19 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:23 +0000 cryptocheck: Free generated IV after each GMAC test. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28753 (cherry picked from commit 442a293611461834778d1b7cd2ac170fb3427dcf) --- tools/tools/crypto/cryptocheck.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index 389d0cc9f610..bd075d24e0f5 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -1141,6 +1141,7 @@ run_gmac_test(const struct alg *alg, size_t size) out: free(buffer); + free(iv); free(key); } From nobody Thu Oct 21 17:06:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4326218069BD; Thu, 21 Oct 2021 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6939s3z4h29; Thu, 21 Oct 2021 17:06:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E621ED6F; Thu, 21 Oct 2021 17:06:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6uGF080201; Thu, 21 Oct 2021 17:06:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6uD0080200; Thu, 21 Oct 2021 17:06:56 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:56 GMT Message-Id: <202110211706.19LH6uD0080200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: bc6265e8cf8d - stable/13 - ossl: Add Poly1305 digest support. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: bc6265e8cf8dd4c6897b25307f89d1b7a3372e28 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bc6265e8cf8dd4c6897b25307f89d1b7a3372e28 commit bc6265e8cf8dd4c6897b25307f89d1b7a3372e28 Author: John Baldwin AuthorDate: 2021-03-03 23:17:29 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:23 +0000 ossl: Add Poly1305 digest support. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28754 (cherry picked from commit a079e38b08f2f07c50ba915dae66d099559abdcc) --- share/man/man4/ossl.4 | 4 +- sys/conf/files | 1 + sys/conf/files.amd64 | 1 + sys/conf/files.arm64 | 2 + sys/conf/files.i386 | 1 + sys/crypto/openssl/ossl.c | 46 ++++++---- sys/crypto/openssl/ossl.h | 3 +- sys/crypto/openssl/ossl_poly1305.c | 181 +++++++++++++++++++++++++++++++++++++ sys/crypto/openssl/ossl_poly1305.h | 35 +++++++ sys/modules/ossl/Makefile | 4 + 10 files changed, 260 insertions(+), 18 deletions(-) diff --git a/share/man/man4/ossl.4 b/share/man/man4/ossl.4 index ce97a9fc0f71..9c0d7f897d53 100644 --- a/share/man/man4/ossl.4 +++ b/share/man/man4/ossl.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 4, 2020 +.Dd March 3, 2021 .Dt OSSL 4 .Os .Sh NAME @@ -74,6 +74,8 @@ driver includes support for the following algorithms: .Pp .Bl -bullet -compact .It +Poly1305 +.It SHA1 .It SHA1-HMAC diff --git a/sys/conf/files b/sys/conf/files index f21c216288b1..e680382210cd 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -741,6 +741,7 @@ crypto/chacha20/chacha-sw.c optional crypto | ipsec | ipsec_support crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb crypto/openssl/ossl.c optional ossl +crypto/openssl/ossl_poly1305.c optional ossl crypto/openssl/ossl_sha1.c optional ossl crypto/openssl/ossl_sha256.c optional ossl crypto/openssl/ossl_sha512.c optional ossl diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 60184978fb51..f6271d0e0e92 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -139,6 +139,7 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/des/des_enc.c optional netsmb +crypto/openssl/amd64/poly1305-x86_64.S optional ossl crypto/openssl/amd64/sha1-x86_64.S optional ossl crypto/openssl/amd64/sha256-x86_64.S optional ossl crypto/openssl/amd64/sha512-x86_64.S optional ossl diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 6e0f5658f33c..d6c9586f58f7 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -127,6 +127,8 @@ ghashv8-armx.o optional armv8crypto \ crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl +crypto/openssl/aarch64/poly1305-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" crypto/openssl/aarch64/sha1-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" crypto/openssl/aarch64/sha256-armv8.S optional ossl \ diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 6a0ca49c0432..5238e2bab40a 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -77,6 +77,7 @@ compat/linux/linux.c optional compat_linux compat/ndis/winx32_wrap.S optional ndisapi pci crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb +crypto/openssl/i386/poly1305-x86.S optional ossl crypto/openssl/i386/sha1-586.S optional ossl crypto/openssl/i386/sha256-586.S optional ossl crypto/openssl/i386/sha512-586.S optional ossl diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index 35f19c9fbca7..229729c27c21 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -135,6 +135,8 @@ ossl_lookup_hash(const struct crypto_session_params *csp) case CRYPTO_SHA2_512: case CRYPTO_SHA2_512_HMAC: return (&ossl_hash_sha512); + case CRYPTO_POLY1305: + return (&ossl_hash_poly1305); default: return (NULL); } @@ -159,14 +161,6 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); } -static void -ossl_setkey_hmac(struct ossl_session *s, const void *key, int klen) -{ - - hmac_init_ipad(s->hash.axf, key, klen, &s->hash.ictx); - hmac_init_opad(s->hash.axf, key, klen, &s->hash.octx); -} - static int ossl_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) @@ -188,8 +182,16 @@ ossl_newsession(device_t dev, crypto_session_t cses, } else { if (csp->csp_auth_key != NULL) { fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); - ossl_setkey_hmac(s, csp->csp_auth_key, - csp->csp_auth_klen); + if (axf->Setkey != NULL) { + axf->Init(&s->hash.ictx); + axf->Setkey(&s->hash.ictx, csp->csp_auth_key, + csp->csp_auth_klen); + } else { + hmac_init_ipad(axf, csp->csp_auth_key, + csp->csp_auth_klen, &s->hash.ictx); + hmac_init_opad(axf, csp->csp_auth_key, + csp->csp_auth_klen, &s->hash.octx); + } fpu_kern_leave(curthread, NULL); } } @@ -218,10 +220,18 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) fpu_entered = true; } - if (crp->crp_auth_key != NULL) - ossl_setkey_hmac(s, crp->crp_auth_key, csp->csp_auth_klen); - - ctx = s->hash.ictx; + if (crp->crp_auth_key == NULL) { + ctx = s->hash.ictx; + } else { + if (axf->Setkey != NULL) { + axf->Init(&ctx); + axf->Setkey(&ctx, crp->crp_auth_key, + csp->csp_auth_klen); + } else { + hmac_init_ipad(axf, crp->crp_auth_key, + csp->csp_auth_klen, &ctx); + } + } if (crp->crp_aad != NULL) error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); @@ -238,8 +248,12 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) axf->Final(digest, &ctx); - if (csp->csp_auth_klen != 0) { - ctx = s->hash.octx; + if (csp->csp_auth_klen != 0 && axf->Setkey == NULL) { + if (crp->crp_auth_key == NULL) + ctx = s->hash.octx; + else + hmac_init_opad(axf, crp->crp_auth_key, + csp->csp_auth_klen, &ctx); axf->Update(&ctx, digest, axf->hashsize); axf->Final(digest, &ctx); } diff --git a/sys/crypto/openssl/ossl.h b/sys/crypto/openssl/ossl.h index 533d497f1be3..55022b10f377 100644 --- a/sys/crypto/openssl/ossl.h +++ b/sys/crypto/openssl/ossl.h @@ -38,9 +38,10 @@ void ossl_cpuid(void); /* Needs to be big enough to hold any hash context. */ struct ossl_hash_context { - uint32_t dummy[54]; + uint32_t dummy[61]; } __aligned(32); +extern struct auth_hash ossl_hash_poly1305; extern struct auth_hash ossl_hash_sha1; extern struct auth_hash ossl_hash_sha224; extern struct auth_hash ossl_hash_sha256; diff --git a/sys/crypto/openssl/ossl_poly1305.c b/sys/crypto/openssl/ossl_poly1305.c new file mode 100644 index 000000000000..8f8c5bc4b6e7 --- /dev/null +++ b/sys/crypto/openssl/ossl_poly1305.c @@ -0,0 +1,181 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include +#include + +#include +#include + +#include +#include + +#define POLY1305_ASM + +/* From crypto/poly1305/poly1305.c */ + +/* pick 32-bit unsigned integer in little endian order */ +static unsigned int U8TOU32(const unsigned char *p) +{ + return (((unsigned int)(p[0] & 0xff)) | + ((unsigned int)(p[1] & 0xff) << 8) | + ((unsigned int)(p[2] & 0xff) << 16) | + ((unsigned int)(p[3] & 0xff) << 24)); +} + +/* + * Implementations can be classified by amount of significant bits in + * words making up the multi-precision value, or in other words radix + * or base of numerical representation, e.g. base 2^64, base 2^32, + * base 2^26. Complementary characteristic is how wide is the result of + * multiplication of pair of digits, e.g. it would take 128 bits to + * accommodate multiplication result in base 2^64 case. These are used + * interchangeably. To describe implementation that is. But interface + * is designed to isolate this so that low-level primitives implemented + * in assembly can be self-contained/self-coherent. + */ +int poly1305_init(void *ctx, const unsigned char key[16], void *func); +void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, + unsigned int padbit); +void poly1305_emit(void *ctx, unsigned char mac[16], + const unsigned int nonce[4]); + +static void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]) +{ + ctx->nonce[0] = U8TOU32(&key[16]); + ctx->nonce[1] = U8TOU32(&key[20]); + ctx->nonce[2] = U8TOU32(&key[24]); + ctx->nonce[3] = U8TOU32(&key[28]); + + /* + * Unlike reference poly1305_init assembly counterpart is expected + * to return a value: non-zero if it initializes ctx->func, and zero + * otherwise. Latter is to simplify assembly in cases when there no + * multiple code paths to switch between. + */ + if (!poly1305_init(ctx->opaque, key, &ctx->func)) { + ctx->func.blocks = poly1305_blocks; + ctx->func.emit = poly1305_emit; + } + + ctx->num = 0; + +} + +#ifdef POLY1305_ASM +/* + * This "eclipses" poly1305_blocks and poly1305_emit, but it's + * conscious choice imposed by -Wshadow compiler warnings. + */ +# define poly1305_blocks (*poly1305_blocks_p) +# define poly1305_emit (*poly1305_emit_p) +#endif + +static void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) +{ +#ifdef POLY1305_ASM + /* + * As documented, poly1305_blocks is never called with input + * longer than single block and padbit argument set to 0. This + * property is fluently used in assembly modules to optimize + * padbit handling on loop boundary. + */ + poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; +#endif + size_t rem, num; + + if ((num = ctx->num)) { + rem = POLY1305_BLOCK_SIZE - num; + if (len >= rem) { + memcpy(ctx->data + num, inp, rem); + poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); + inp += rem; + len -= rem; + } else { + /* Still not enough data to process a block. */ + memcpy(ctx->data + num, inp, len); + ctx->num = num + len; + return; + } + } + + rem = len % POLY1305_BLOCK_SIZE; + len -= rem; + + if (len >= POLY1305_BLOCK_SIZE) { + poly1305_blocks(ctx->opaque, inp, len, 1); + inp += len; + } + + if (rem) + memcpy(ctx->data, inp, rem); + + ctx->num = rem; +} + +static void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) +{ +#ifdef POLY1305_ASM + poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; + poly1305_emit_f poly1305_emit_p = ctx->func.emit; +#endif + size_t num; + + if ((num = ctx->num)) { + ctx->data[num++] = 1; /* pad bit */ + while (num < POLY1305_BLOCK_SIZE) + ctx->data[num++] = 0; + poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); + } + + poly1305_emit(ctx->opaque, mac, ctx->nonce); + + /* zero out the state */ + OPENSSL_cleanse(ctx, sizeof(*ctx)); +} + +static void +ossl_poly1305_init(void *vctx) +{ +} + +static void +ossl_poly1305_setkey(void *vctx, const uint8_t *key, u_int klen) +{ + MPASS(klen == 32); + Poly1305_Init(vctx, key); +} + +static int +ossl_poly1305_update(void *vctx, const void *buf, u_int len) +{ + Poly1305_Update(vctx, buf, len); + return (0); +} + +static void +ossl_poly1305_final(uint8_t *digest, void *vctx) +{ + Poly1305_Final(vctx, digest); +} + +struct auth_hash ossl_hash_poly1305 = { + .type = CRYPTO_POLY1305, + .name = "OpenSSL-Poly1305", + .hashsize = POLY1305_HASH_LEN, + .ctxsize = sizeof(struct poly1305_context), + .blocksize = POLY1305_BLOCK_SIZE, + .Init = ossl_poly1305_init, + .Setkey = ossl_poly1305_setkey, + .Update = ossl_poly1305_update, + .Final = ossl_poly1305_final, +}; + +_Static_assert(sizeof(struct poly1305_context) <= + sizeof(struct ossl_hash_context), "ossl_hash_context too small"); diff --git a/sys/crypto/openssl/ossl_poly1305.h b/sys/crypto/openssl/ossl_poly1305.h new file mode 100644 index 000000000000..d1b2db6d5cba --- /dev/null +++ b/sys/crypto/openssl/ossl_poly1305.h @@ -0,0 +1,35 @@ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* From include/crypto/poly1305.h */ + +#define POLY1305_BLOCK_SIZE 16 + +typedef struct poly1305_context POLY1305; + +/* From crypto/poly1305/poly1305_local.h */ + +typedef void (*poly1305_blocks_f) (void *ctx, const unsigned char *inp, + size_t len, unsigned int padbit); +typedef void (*poly1305_emit_f) (void *ctx, unsigned char mac[16], + const unsigned int nonce[4]); + +struct poly1305_context { + double opaque[24]; /* large enough to hold internal state, declared + * 'double' to ensure at least 64-bit invariant + * alignment across all platforms and + * configurations */ + unsigned int nonce[4]; + unsigned char data[POLY1305_BLOCK_SIZE]; + size_t num; + struct { + poly1305_blocks_f blocks; + poly1305_emit_f emit; + } func; +}; diff --git a/sys/modules/ossl/Makefile b/sys/modules/ossl/Makefile index 6fe8c5a6c812..2ddebefebd1a 100644 --- a/sys/modules/ossl/Makefile +++ b/sys/modules/ossl/Makefile @@ -8,24 +8,28 @@ SRCS= bus_if.h \ cryptodev_if.h \ device_if.h \ ossl.c \ + ossl_poly1305.c \ ossl_sha1.c \ ossl_sha256.c \ ossl_sha512.c \ ${SRCS.${MACHINE_CPUARCH}} SRCS.aarch64= \ + poly1305-armv8.S \ sha1-armv8.S \ sha256-armv8.S \ sha512-armv8.S \ ossl_aarch64.c SRCS.amd64= \ + poly1305-x86_64.S \ sha1-x86_64.S \ sha256-x86_64.S \ sha512-x86_64.S \ ossl_x86.c SRCS.i386= \ + poly1305-x86.S \ sha1-586.S \ sha256-586.S \ sha512-586.S \ From nobody Thu Oct 21 17:06:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B2C41806AC3; Thu, 21 Oct 2021 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6B4XZZz4h3p; Thu, 21 Oct 2021 17:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B50B1EDB7; Thu, 21 Oct 2021 17:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6w63080225; Thu, 21 Oct 2021 17:06:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6wPG080224; Thu, 21 Oct 2021 17:06:58 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:58 GMT Message-Id: <202110211706.19LH6wPG080224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ee1e39b012f6 - stable/13 - The ChaCha20 counter is little endian, not big endian. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ee1e39b012f6239539cc0293eb0495e237d033ca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ee1e39b012f6239539cc0293eb0495e237d033ca commit ee1e39b012f6239539cc0293eb0495e237d033ca Author: John Baldwin AuthorDate: 2021-03-03 23:17:37 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:23 +0000 The ChaCha20 counter is little endian, not big endian. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28755 (cherry picked from commit a899ce4ba4c404d342bf892b8b756b66fc65d6b5) --- share/man/man7/crypto.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index ccc2d1fc9be3..6e5bd83621aa 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 18, 2021 +.Dd March 3, 2021 .Dt CRYPTO 7 .Os .Sh NAME @@ -136,7 +136,7 @@ counter rollover. .Dv CRYPTO_CHACHA20 accepts a 16 byte IV. The first 8 bytes are used as a nonce. -The last 8 bytes are used as 64-bit big-endian block counter. +The last 8 bytes are used as a 64-bit little-endian block counter. .Ss Authenticated Encryption with Associated Data Algorithms AEAD algorithms in OCF combine a stream cipher with an authentication algorithm to provide both secrecy and authentication. From nobody Thu Oct 21 17:06:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4710C1806971; Thu, 21 Oct 2021 17:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6D4q6nz4hHf; Thu, 21 Oct 2021 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D8031EFB4; Thu, 21 Oct 2021 17:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH6xlD080249; Thu, 21 Oct 2021 17:06:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH6xp5080248; Thu, 21 Oct 2021 17:06:59 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:06:59 GMT Message-Id: <202110211706.19LH6xp5080248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 6ca6d4edc234 - stable/13 - ossl: Add ChaCha20 cipher support. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ca6d4edc234cee9e3c85b058d8b0adda0a2026f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6ca6d4edc234cee9e3c85b058d8b0adda0a2026f commit 6ca6d4edc234cee9e3c85b058d8b0adda0a2026f Author: John Baldwin AuthorDate: 2021-03-03 23:17:43 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 ossl: Add ChaCha20 cipher support. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28756 (cherry picked from commit 92aecd1e6fac47ffc893f628c1fe289568bb19cb) --- share/man/man4/ossl.4 | 2 + sys/conf/files | 1 + sys/conf/files.amd64 | 1 + sys/conf/files.arm64 | 2 + sys/conf/files.i386 | 1 + sys/crypto/openssl/ossl.c | 82 ++++++++++++++++----- sys/crypto/openssl/ossl.h | 5 ++ sys/crypto/openssl/ossl_chacha.h | 42 +++++++++++ sys/crypto/openssl/ossl_chacha20.c | 141 +++++++++++++++++++++++++++++++++++++ sys/modules/ossl/Makefile | 4 ++ 10 files changed, 262 insertions(+), 19 deletions(-) diff --git a/share/man/man4/ossl.4 b/share/man/man4/ossl.4 index 9c0d7f897d53..2aa4b69eda31 100644 --- a/share/man/man4/ossl.4 +++ b/share/man/man4/ossl.4 @@ -74,6 +74,8 @@ driver includes support for the following algorithms: .Pp .Bl -bullet -compact .It +ChaCha20 +.It Poly1305 .It SHA1 diff --git a/sys/conf/files b/sys/conf/files index e680382210cd..a5f23ca09774 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -741,6 +741,7 @@ crypto/chacha20/chacha-sw.c optional crypto | ipsec | ipsec_support crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb crypto/openssl/ossl.c optional ossl +crypto/openssl/ossl_chacha20.c optional ossl crypto/openssl/ossl_poly1305.c optional ossl crypto/openssl/ossl_sha1.c optional ossl crypto/openssl/ossl_sha256.c optional ossl diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index f6271d0e0e92..bf2213eec68c 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -139,6 +139,7 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/des/des_enc.c optional netsmb +crypto/openssl/amd64/chacha-x86_64.S optional ossl crypto/openssl/amd64/poly1305-x86_64.S optional ossl crypto/openssl/amd64/sha1-x86_64.S optional ossl crypto/openssl/amd64/sha256-x86_64.S optional ossl diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index d6c9586f58f7..84fd0c7858ff 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -127,6 +127,8 @@ ghashv8-armx.o optional armv8crypto \ crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl +crypto/openssl/aarch64/chacha-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" crypto/openssl/aarch64/poly1305-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" crypto/openssl/aarch64/sha1-armv8.S optional ossl \ diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 5238e2bab40a..7beb3f21292c 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -77,6 +77,7 @@ compat/linux/linux.c optional compat_linux compat/ndis/winx32_wrap.S optional ndisapi pci crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb +crypto/openssl/i386/chacha-x86.S optional ossl crypto/openssl/i386/poly1305-x86.S optional ossl crypto/openssl/i386/sha1-586.S optional ossl crypto/openssl/i386/sha256-586.S optional ossl diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index 229729c27c21..0c863429939c 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "cryptodev_if.h" @@ -154,6 +155,16 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) if (ossl_lookup_hash(csp) == NULL) return (EINVAL); break; + case CSP_MODE_CIPHER: + switch (csp->csp_cipher_alg) { + case CRYPTO_CHACHA20: + if (csp->csp_cipher_klen != CHACHA_KEY_SIZE) + return (EINVAL); + break; + default: + return (EINVAL); + } + break; default: return (EINVAL); } @@ -161,15 +172,12 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); } -static int -ossl_newsession(device_t dev, crypto_session_t cses, +static void +ossl_newsession_hash(struct ossl_session *s, const struct crypto_session_params *csp) { - struct ossl_session *s; struct auth_hash *axf; - s = crypto_get_driver_session(cses); - axf = ossl_lookup_hash(csp); s->hash.axf = axf; if (csp->csp_auth_mlen == 0) @@ -195,31 +203,35 @@ ossl_newsession(device_t dev, crypto_session_t cses, fpu_kern_leave(curthread, NULL); } } +} + +static int +ossl_newsession(device_t dev, crypto_session_t cses, + const struct crypto_session_params *csp) +{ + struct ossl_session *s; + + s = crypto_get_driver_session(cses); + switch (csp->csp_mode) { + case CSP_MODE_DIGEST: + ossl_newsession_hash(s, csp); + break; + } + return (0); } static int -ossl_process(device_t dev, struct cryptop *crp, int hint) +ossl_process_hash(struct ossl_session *s, struct cryptop *crp, + const struct crypto_session_params *csp) { struct ossl_hash_context ctx; char digest[HASH_MAX_LEN]; - const struct crypto_session_params *csp; - struct ossl_session *s; struct auth_hash *axf; int error; - bool fpu_entered; - s = crypto_get_driver_session(crp->crp_session); - csp = crypto_get_params(crp->crp_session); axf = s->hash.axf; - if (is_fpu_kern_thread(0)) { - fpu_entered = false; - } else { - fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); - fpu_entered = true; - } - if (crp->crp_auth_key == NULL) { ctx = s->hash.ictx; } else { @@ -273,13 +285,45 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) explicit_bzero(digest, sizeof(digest)); out: + explicit_bzero(&ctx, sizeof(ctx)); + return (error); +} + +static int +ossl_process(device_t dev, struct cryptop *crp, int hint) +{ + const struct crypto_session_params *csp; + struct ossl_session *s; + int error; + bool fpu_entered; + + s = crypto_get_driver_session(crp->crp_session); + csp = crypto_get_params(crp->crp_session); + + if (is_fpu_kern_thread(0)) { + fpu_entered = false; + } else { + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); + fpu_entered = true; + } + + switch (csp->csp_mode) { + case CSP_MODE_DIGEST: + error = ossl_process_hash(s, crp, csp); + break; + case CSP_MODE_CIPHER: + error = ossl_chacha20(crp, csp); + break; + default: + __assert_unreachable(); + } + if (fpu_entered) fpu_kern_leave(curthread, NULL); crp->crp_etype = error; crypto_done(crp); - explicit_bzero(&ctx, sizeof(ctx)); return (0); } diff --git a/sys/crypto/openssl/ossl.h b/sys/crypto/openssl/ossl.h index 55022b10f377..b7c681d0fb1d 100644 --- a/sys/crypto/openssl/ossl.h +++ b/sys/crypto/openssl/ossl.h @@ -34,6 +34,11 @@ /* Compatibility shims. */ #define OPENSSL_cleanse explicit_bzero +struct cryptop; +struct crypto_session_params; + +int ossl_chacha20(struct cryptop *crp, + const struct crypto_session_params *csp); void ossl_cpuid(void); /* Needs to be big enough to hold any hash context. */ diff --git a/sys/crypto/openssl/ossl_chacha.h b/sys/crypto/openssl/ossl_chacha.h new file mode 100644 index 000000000000..781899c6bdf6 --- /dev/null +++ b/sys/crypto/openssl/ossl_chacha.h @@ -0,0 +1,42 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* From include/crypto/chacha.h */ + +#ifndef OSSL_CRYPTO_CHACHA_H +#define OSSL_CRYPTO_CHACHA_H + +/* + * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and + * nonce and writes the result to |out|, which may be equal to |inp|. + * The |key| is not 32 bytes of verbatim key material though, but the + * said material collected into 8 32-bit elements array in host byte + * order. Same approach applies to nonce: the |counter| argument is + * pointer to concatenated nonce and counter values collected into 4 + * 32-bit elements. This, passing crypto material collected into 32-bit + * elements as opposite to passing verbatim byte vectors, is chosen for + * efficiency in multi-call scenarios. + */ +void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, + size_t len, const unsigned int key[8], + const unsigned int counter[4]); +/* + * You can notice that there is no key setup procedure. Because it's + * as trivial as collecting bytes into 32-bit elements, it's reckoned + * that below macro is sufficient. + */ +#define CHACHA_U8TOU32(p) ( \ + ((unsigned int)(p)[0]) | ((unsigned int)(p)[1]<<8) | \ + ((unsigned int)(p)[2]<<16) | ((unsigned int)(p)[3]<<24) ) + +#define CHACHA_KEY_SIZE 32 +#define CHACHA_CTR_SIZE 16 +#define CHACHA_BLK_SIZE 64 + +#endif diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c new file mode 100644 index 000000000000..70a0a5718dbd --- /dev/null +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -0,0 +1,141 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Netflix, Inc + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include +#include +#include +#include + +#include + +#include +#include + +int +ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) +{ + _Alignas(8) unsigned int key[CHACHA_KEY_SIZE / 4]; + unsigned int counter[CHACHA_CTR_SIZE / 4]; + unsigned char block[CHACHA_BLK_SIZE]; + struct crypto_buffer_cursor cc_in, cc_out; + const unsigned char *in, *inseg, *cipher_key; + unsigned char *out, *outseg; + size_t resid, todo, inlen, outlen; + uint32_t next_counter; + u_int i; + + if (crp->crp_cipher_key != NULL) + cipher_key = crp->crp_cipher_key; + else + cipher_key = csp->csp_cipher_key; + for (i = 0; i < nitems(key); i++) + key[i] = CHACHA_U8TOU32(cipher_key + i * 4); + crypto_read_iv(crp, counter); + for (i = 0; i < nitems(counter); i++) + counter[i] = le32toh(counter[i]); + + resid = crp->crp_payload_length; + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else + cc_out = cc_in; + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + while (resid >= CHACHA_BLK_SIZE) { + if (inlen < CHACHA_BLK_SIZE) { + crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); + in = block; + inlen = CHACHA_BLK_SIZE; + } else + in = inseg; + if (outlen < CHACHA_BLK_SIZE) { + out = block; + outlen = CHACHA_BLK_SIZE; + } else + out = outseg; + + /* Figure out how many blocks we can encrypt/decrypt at once. */ + todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + +#ifdef __LP64__ + /* ChaCha20_ctr32() assumes length is <= 4GB. */ + todo = (uint32_t)todo; +#endif + + /* Truncate if the 32-bit counter would roll over. */ + next_counter = counter[0] + todo / CHACHA_BLK_SIZE; + if (next_counter < counter[0]) { + todo -= next_counter * CHACHA_BLK_SIZE; + next_counter = 0; + } + + ChaCha20_ctr32(out, in, todo, key, counter); + + counter[0] = next_counter; + if (counter[0] == 0) + counter[1]++; + + if (out == block) { + crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + } else { + crypto_cursor_advance(&cc_out, todo); + outseg += todo; + outlen -= todo; + } + if (in == block) { + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + } else { + crypto_cursor_advance(&cc_in, todo); + inseg += todo; + inlen -= todo; + } + resid -= todo; + } + + if (resid > 0) { + memset(block, 0, sizeof(block)); + crypto_cursor_copydata(&cc_in, resid, block); + ChaCha20_ctr32(block, block, CHACHA_BLK_SIZE, key, counter); + crypto_cursor_copyback(&cc_out, resid, block); + } + + explicit_bzero(block, sizeof(block)); + explicit_bzero(counter, sizeof(counter)); + explicit_bzero(key, sizeof(key)); + return (0); +} diff --git a/sys/modules/ossl/Makefile b/sys/modules/ossl/Makefile index 2ddebefebd1a..dfd82dcf6e1f 100644 --- a/sys/modules/ossl/Makefile +++ b/sys/modules/ossl/Makefile @@ -8,6 +8,7 @@ SRCS= bus_if.h \ cryptodev_if.h \ device_if.h \ ossl.c \ + ossl_chacha20.c \ ossl_poly1305.c \ ossl_sha1.c \ ossl_sha256.c \ @@ -15,6 +16,7 @@ SRCS= bus_if.h \ ${SRCS.${MACHINE_CPUARCH}} SRCS.aarch64= \ + chacha-armv8.S \ poly1305-armv8.S \ sha1-armv8.S \ sha256-armv8.S \ @@ -22,6 +24,7 @@ SRCS.aarch64= \ ossl_aarch64.c SRCS.amd64= \ + chacha-x86_64.S \ poly1305-x86_64.S \ sha1-x86_64.S \ sha256-x86_64.S \ @@ -29,6 +32,7 @@ SRCS.amd64= \ ossl_x86.c SRCS.i386= \ + chacha-x86.S \ poly1305-x86.S \ sha1-586.S \ sha256-586.S \ From nobody Thu Oct 21 17:07:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A7691806AE0; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6F1Gl0z4h2N; Thu, 21 Oct 2021 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60BA71F01F; Thu, 21 Oct 2021 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH70d4080273; Thu, 21 Oct 2021 17:07:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH70FE080272; Thu, 21 Oct 2021 17:07:00 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:00 GMT Message-Id: <202110211707.19LH70FE080272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8e89a7d1821a - stable/13 - poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8e89a7d1821a1650e2789b54c91b85ee822ec0f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8e89a7d1821a1650e2789b54c91b85ee822ec0f4 commit 8e89a7d1821a1650e2789b54c91b85ee822ec0f4 Author: John Baldwin AuthorDate: 2021-03-05 17:47:58 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. There currently isn't a need to provide a public interface to a software Poly1305 implementation beyond what is already available via libsodium's APIs and these symbols conflict with symbols shared within the ossl.ko module between ossl_poly1305.c and ossl_chacha20.c. Reported by: se, kp Fixes: 78991a93eb9d Sponsored by: Netflix (cherry picked from commit bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff) --- sys/opencrypto/xform_poly1305.c | 43 ++++++++++++----------------------------- sys/opencrypto/xform_poly1305.h | 16 --------------- 2 files changed, 12 insertions(+), 47 deletions(-) diff --git a/sys/opencrypto/xform_poly1305.c b/sys/opencrypto/xform_poly1305.c index bddbb572d682..d8ceab47deca 100644 --- a/sys/opencrypto/xform_poly1305.c +++ b/sys/opencrypto/xform_poly1305.c @@ -4,7 +4,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include @@ -16,16 +15,16 @@ CTASSERT(sizeof(union authctx) >= sizeof(struct poly1305_xform_ctx)); CTASSERT(POLY1305_KEY_LEN == crypto_onetimeauth_poly1305_KEYBYTES); CTASSERT(POLY1305_HASH_LEN == crypto_onetimeauth_poly1305_BYTES); -void -Poly1305_Init(void *polyctx) +static void +xform_Poly1305_Init(void *polyctx) { /* Nop */ } -void -Poly1305_Setkey(struct poly1305_xform_ctx *polyctx, - const uint8_t key[__min_size(POLY1305_KEY_LEN)], size_t klen) +static void +xform_Poly1305_Setkey(void *ctx, const uint8_t *key, u_int klen) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; if (klen != POLY1305_KEY_LEN) @@ -36,16 +35,10 @@ Poly1305_Setkey(struct poly1305_xform_ctx *polyctx, panic("%s: Invariant violated: %d", __func__, rc); } -static void -xform_Poly1305_Setkey(void *ctx, const uint8_t *key, u_int klen) -{ - Poly1305_Setkey(ctx, key, klen); -} - -int -Poly1305_Update(struct poly1305_xform_ctx *polyctx, const void *data, - size_t len) +static int +xform_Poly1305_Update(void *ctx, const void *data, u_int len) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; rc = crypto_onetimeauth_poly1305_update(&polyctx->state, data, len); @@ -54,16 +47,10 @@ Poly1305_Update(struct poly1305_xform_ctx *polyctx, const void *data, return (0); } -static int -xform_Poly1305_Update(void *ctx, const void *data, u_int len) -{ - return (Poly1305_Update(ctx, data, len)); -} - -void -Poly1305_Final(uint8_t digest[__min_size(POLY1305_HASH_LEN)], - struct poly1305_xform_ctx *polyctx) +static void +xform_Poly1305_Final(uint8_t *digest, void *ctx) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; rc = crypto_onetimeauth_poly1305_final(&polyctx->state, digest); @@ -71,12 +58,6 @@ Poly1305_Final(uint8_t digest[__min_size(POLY1305_HASH_LEN)], panic("%s: Invariant violated: %d", __func__, rc); } -static void -xform_Poly1305_Final(uint8_t *digest, void *ctx) -{ - Poly1305_Final(digest, ctx); -} - struct auth_hash auth_hash_poly1305 = { .type = CRYPTO_POLY1305, .name = "Poly-1305", @@ -84,7 +65,7 @@ struct auth_hash auth_hash_poly1305 = { .hashsize = POLY1305_HASH_LEN, .ctxsize = sizeof(struct poly1305_xform_ctx), .blocksize = crypto_onetimeauth_poly1305_BYTES, - .Init = Poly1305_Init, + .Init = xform_Poly1305_Init, .Setkey = xform_Poly1305_Setkey, .Update = xform_Poly1305_Update, .Final = xform_Poly1305_Final, diff --git a/sys/opencrypto/xform_poly1305.h b/sys/opencrypto/xform_poly1305.h deleted file mode 100644 index cca1c6af9395..000000000000 --- a/sys/opencrypto/xform_poly1305.h +++ /dev/null @@ -1,16 +0,0 @@ -/* This file is in the public domain. */ -/* $FreeBSD$ */ -#pragma once - -#include - -struct poly1305_xform_ctx; - -void Poly1305_Init(void *); - -void Poly1305_Setkey(struct poly1305_xform_ctx *, - const uint8_t [__min_size(32)], size_t); - -int Poly1305_Update(struct poly1305_xform_ctx *, const void *, size_t); - -void Poly1305_Final(uint8_t [__min_size(16)], struct poly1305_xform_ctx *); From nobody Thu Oct 21 17:07:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8E4061806A6E; Thu, 21 Oct 2021 17:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6G1cqnz4hHs; Thu, 21 Oct 2021 17:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9F61ED70; Thu, 21 Oct 2021 17:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH71CF080303; Thu, 21 Oct 2021 17:07:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH71O8080302; Thu, 21 Oct 2021 17:07:01 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:01 GMT Message-Id: <202110211707.19LH71O8080302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5131b1448c34 - stable/13 - ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5131b1448c342afb9e60b58183bb000c7eae2951 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5131b1448c342afb9e60b58183bb000c7eae2951 commit 5131b1448c342afb9e60b58183bb000c7eae2951 Author: John Baldwin AuthorDate: 2021-03-03 23:17:51 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28757 (cherry picked from commit 78991a93eb9dd3074a3fc19b88a7c3e34e1ec703) --- share/man/man4/ossl.4 | 2 + sys/crypto/openssl/ossl.c | 14 ++ sys/crypto/openssl/ossl.h | 4 + sys/crypto/openssl/ossl_chacha20.c | 306 +++++++++++++++++++++++++++++++++++++ sys/crypto/openssl/ossl_poly1305.c | 8 +- sys/crypto/openssl/ossl_poly1305.h | 5 + 6 files changed, 335 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ossl.4 b/share/man/man4/ossl.4 index 2aa4b69eda31..5929e46e9fe3 100644 --- a/share/man/man4/ossl.4 +++ b/share/man/man4/ossl.4 @@ -76,6 +76,8 @@ driver includes support for the following algorithms: .It ChaCha20 .It +ChaCha20-Poly1305 (RFC 8439) +.It Poly1305 .It SHA1 diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index 0c863429939c..ad9b93dd960d 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -165,6 +165,14 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); } break; + case CSP_MODE_AEAD: + switch (csp->csp_cipher_alg) { + case CRYPTO_CHACHA20_POLY1305: + break; + default: + return (EINVAL); + } + break; default: return (EINVAL); } @@ -314,6 +322,12 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) case CSP_MODE_CIPHER: error = ossl_chacha20(crp, csp); break; + case CSP_MODE_AEAD: + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) + error = ossl_chacha20_poly1305_encrypt(crp, csp); + else + error = ossl_chacha20_poly1305_decrypt(crp, csp); + break; default: __assert_unreachable(); } diff --git a/sys/crypto/openssl/ossl.h b/sys/crypto/openssl/ossl.h index b7c681d0fb1d..11793dca037a 100644 --- a/sys/crypto/openssl/ossl.h +++ b/sys/crypto/openssl/ossl.h @@ -39,6 +39,10 @@ struct crypto_session_params; int ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp); +int ossl_chacha20_poly1305_decrypt(struct cryptop *crp, + const struct crypto_session_params *csp); +int ossl_chacha20_poly1305_encrypt(struct cryptop *crp, + const struct crypto_session_params *csp); void ossl_cpuid(void); /* Needs to be big enough to hold any hash context. */ diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index 70a0a5718dbd..a2bfb52cacd6 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -37,6 +37,7 @@ #include #include +#include int ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) @@ -139,3 +140,308 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) explicit_bzero(key, sizeof(key)); return (0); } + +int +ossl_chacha20_poly1305_encrypt(struct cryptop *crp, + const struct crypto_session_params *csp) +{ + _Alignas(8) unsigned int key[CHACHA_KEY_SIZE / 4]; + unsigned int counter[CHACHA_CTR_SIZE / 4]; + _Alignas(8) unsigned char block[CHACHA_BLK_SIZE]; + unsigned char tag[POLY1305_HASH_LEN]; + POLY1305 auth_ctx; + struct crypto_buffer_cursor cc_in, cc_out; + const unsigned char *in, *inseg, *cipher_key; + unsigned char *out, *outseg; + size_t resid, todo, inlen, outlen; + uint32_t next_counter; + u_int i; + + if (crp->crp_cipher_key != NULL) + cipher_key = crp->crp_cipher_key; + else + cipher_key = csp->csp_cipher_key; + for (i = 0; i < nitems(key); i++) + key[i] = CHACHA_U8TOU32(cipher_key + i * 4); + + crypto_read_iv(crp, counter + 1); + for (i = 1; i < nitems(counter); i++) + counter[i] = le32toh(counter[i]); + + /* Block 0 is used to generate the poly1305 key. */ + counter[0] = 0; + + memset(block, 0, sizeof(block)); + ChaCha20_ctr32(block, block, sizeof(block), key, counter); + Poly1305_Init(&auth_ctx, block); + + /* MAC the AAD. */ + if (crp->crp_aad != NULL) + Poly1305_Update(&auth_ctx, crp->crp_aad, crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, + ossl_poly1305_update, &auth_ctx); + if (crp->crp_aad_length % 16 != 0) { + /* padding1 */ + memset(block, 0, 16); + Poly1305_Update(&auth_ctx, block, + 16 - crp->crp_aad_length % 16); + } + + /* Encryption starts with block 1. */ + counter[0] = 1; + + /* Do encryption with MAC */ + resid = crp->crp_payload_length; + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else + cc_out = cc_in; + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + while (resid >= CHACHA_BLK_SIZE) { + if (inlen < CHACHA_BLK_SIZE) { + crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); + in = block; + inlen = CHACHA_BLK_SIZE; + } else + in = inseg; + if (outlen < CHACHA_BLK_SIZE) { + out = block; + outlen = CHACHA_BLK_SIZE; + } else + out = outseg; + + /* Figure out how many blocks we can encrypt/decrypt at once. */ + todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + +#ifdef __LP64__ + /* ChaCha20_ctr32() assumes length is <= 4GB. */ + todo = (uint32_t)todo; +#endif + + /* Truncate if the 32-bit counter would roll over. */ + next_counter = counter[0] + todo / CHACHA_BLK_SIZE; + if (next_counter < counter[0]) { + todo -= next_counter * CHACHA_BLK_SIZE; + next_counter = 0; + } + + ChaCha20_ctr32(out, in, todo, key, counter); + Poly1305_Update(&auth_ctx, out, todo); + + counter[0] = next_counter; + if (counter[0] == 0) + counter[1]++; + + if (out == block) { + crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + } else { + crypto_cursor_advance(&cc_out, todo); + outseg += todo; + outlen -= todo; + } + if (in == block) { + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + } else { + crypto_cursor_advance(&cc_in, todo); + inseg += todo; + inlen -= todo; + } + resid -= todo; + } + + if (resid > 0) { + memset(block, 0, sizeof(block)); + crypto_cursor_copydata(&cc_in, resid, block); + ChaCha20_ctr32(block, block, CHACHA_BLK_SIZE, key, counter); + crypto_cursor_copyback(&cc_out, resid, block); + + /* padding2 */ + todo = roundup2(resid, 16); + memset(block + resid, 0, todo - resid); + Poly1305_Update(&auth_ctx, block, todo); + } + + /* lengths */ + le64enc(block, crp->crp_aad_length); + le64enc(block + 8, crp->crp_payload_length); + Poly1305_Update(&auth_ctx, block, sizeof(uint64_t) * 2); + + Poly1305_Final(&auth_ctx, tag); + crypto_copyback(crp, crp->crp_digest_start, csp->csp_auth_mlen == 0 ? + POLY1305_HASH_LEN : csp->csp_auth_mlen, tag); + + explicit_bzero(&auth_ctx, sizeof(auth_ctx)); + explicit_bzero(tag, sizeof(tag)); + explicit_bzero(block, sizeof(block)); + explicit_bzero(counter, sizeof(counter)); + explicit_bzero(key, sizeof(key)); + return (0); +} + + +int +ossl_chacha20_poly1305_decrypt(struct cryptop *crp, + const struct crypto_session_params *csp) +{ + _Alignas(8) unsigned int key[CHACHA_KEY_SIZE / 4]; + unsigned int counter[CHACHA_CTR_SIZE / 4]; + _Alignas(8) unsigned char block[CHACHA_BLK_SIZE]; + unsigned char tag[POLY1305_HASH_LEN], tag2[POLY1305_HASH_LEN]; + struct poly1305_context auth_ctx; + struct crypto_buffer_cursor cc_in, cc_out; + const unsigned char *in, *inseg, *cipher_key; + unsigned char *out, *outseg; + size_t resid, todo, inlen, outlen; + uint32_t next_counter; + int error; + u_int i, mlen; + + if (crp->crp_cipher_key != NULL) + cipher_key = crp->crp_cipher_key; + else + cipher_key = csp->csp_cipher_key; + for (i = 0; i < nitems(key); i++) + key[i] = CHACHA_U8TOU32(cipher_key + i * 4); + + crypto_read_iv(crp, counter + 1); + for (i = 1; i < nitems(counter); i++) + counter[i] = le32toh(counter[i]); + + /* Block 0 is used to generate the poly1305 key. */ + counter[0] = 0; + + memset(block, 0, sizeof(block)); + ChaCha20_ctr32(block, block, sizeof(block), key, counter); + Poly1305_Init(&auth_ctx, block); + + /* MAC the AAD. */ + if (crp->crp_aad != NULL) + Poly1305_Update(&auth_ctx, crp->crp_aad, crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, + ossl_poly1305_update, &auth_ctx); + if (crp->crp_aad_length % 16 != 0) { + /* padding1 */ + memset(block, 0, 16); + Poly1305_Update(&auth_ctx, block, + 16 - crp->crp_aad_length % 16); + } + + /* Mac the ciphertext. */ + crypto_apply(crp, crp->crp_payload_start, crp->crp_payload_length, + ossl_poly1305_update, &auth_ctx); + if (crp->crp_payload_length % 16 != 0) { + /* padding2 */ + memset(block, 0, 16); + Poly1305_Update(&auth_ctx, block, + 16 - crp->crp_payload_length % 16); + } + + /* lengths */ + le64enc(block, crp->crp_aad_length); + le64enc(block + 8, crp->crp_payload_length); + Poly1305_Update(&auth_ctx, block, sizeof(uint64_t) * 2); + + Poly1305_Final(&auth_ctx, tag); + mlen = csp->csp_auth_mlen == 0 ? POLY1305_HASH_LEN : csp->csp_auth_mlen; + crypto_copydata(crp, crp->crp_digest_start, mlen, tag2); + if (timingsafe_bcmp(tag, tag2, mlen) != 0) { + error = EBADMSG; + goto out; + } + + /* Decryption starts with block 1. */ + counter[0] = 1; + + resid = crp->crp_payload_length; + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else + cc_out = cc_in; + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + while (resid >= CHACHA_BLK_SIZE) { + if (inlen < CHACHA_BLK_SIZE) { + crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); + in = block; + inlen = CHACHA_BLK_SIZE; + } else + in = inseg; + if (outlen < CHACHA_BLK_SIZE) { + out = block; + outlen = CHACHA_BLK_SIZE; + } else + out = outseg; + + /* Figure out how many blocks we can encrypt/decrypt at once. */ + todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + +#ifdef __LP64__ + /* ChaCha20_ctr32() assumes length is <= 4GB. */ + todo = (uint32_t)todo; +#endif + + /* Truncate if the 32-bit counter would roll over. */ + next_counter = counter[0] + todo / CHACHA_BLK_SIZE; + if (next_counter < counter[0]) { + todo -= next_counter * CHACHA_BLK_SIZE; + next_counter = 0; + } + + ChaCha20_ctr32(out, in, todo, key, counter); + + counter[0] = next_counter; + if (counter[0] == 0) + counter[1]++; + + if (out == block) { + crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); + outseg = crypto_cursor_segbase(&cc_out); + outlen = crypto_cursor_seglen(&cc_out); + } else { + crypto_cursor_advance(&cc_out, todo); + outseg += todo; + outlen -= todo; + } + if (in == block) { + inseg = crypto_cursor_segbase(&cc_in); + inlen = crypto_cursor_seglen(&cc_in); + } else { + crypto_cursor_advance(&cc_in, todo); + inseg += todo; + inlen -= todo; + } + resid -= todo; + } + + if (resid > 0) { + memset(block, 0, sizeof(block)); + crypto_cursor_copydata(&cc_in, resid, block); + ChaCha20_ctr32(block, block, CHACHA_BLK_SIZE, key, counter); + crypto_cursor_copyback(&cc_out, resid, block); + } + + error = 0; +out: + explicit_bzero(&auth_ctx, sizeof(auth_ctx)); + explicit_bzero(tag, sizeof(tag)); + explicit_bzero(block, sizeof(block)); + explicit_bzero(counter, sizeof(counter)); + explicit_bzero(key, sizeof(key)); + return (error); +} diff --git a/sys/crypto/openssl/ossl_poly1305.c b/sys/crypto/openssl/ossl_poly1305.c index 8f8c5bc4b6e7..9d08e84ae5bf 100644 --- a/sys/crypto/openssl/ossl_poly1305.c +++ b/sys/crypto/openssl/ossl_poly1305.c @@ -46,7 +46,7 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, void poly1305_emit(void *ctx, unsigned char mac[16], const unsigned int nonce[4]); -static void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]) +void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]) { ctx->nonce[0] = U8TOU32(&key[16]); ctx->nonce[1] = U8TOU32(&key[20]); @@ -77,7 +77,7 @@ static void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]) # define poly1305_emit (*poly1305_emit_p) #endif -static void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) +void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM /* @@ -119,7 +119,7 @@ static void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) ctx->num = rem; } -static void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) +void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; @@ -152,7 +152,7 @@ ossl_poly1305_setkey(void *vctx, const uint8_t *key, u_int klen) Poly1305_Init(vctx, key); } -static int +int ossl_poly1305_update(void *vctx, const void *buf, u_int len) { Poly1305_Update(vctx, buf, len); diff --git a/sys/crypto/openssl/ossl_poly1305.h b/sys/crypto/openssl/ossl_poly1305.h index d1b2db6d5cba..d0811e0e3f06 100644 --- a/sys/crypto/openssl/ossl_poly1305.h +++ b/sys/crypto/openssl/ossl_poly1305.h @@ -33,3 +33,8 @@ struct poly1305_context { poly1305_emit_f emit; } func; }; + +int ossl_poly1305_update(void *vctx, const void *buf, u_int len); +void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]); +void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len); +void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]); From nobody Thu Oct 21 17:07:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BD7A61806E41; Thu, 21 Oct 2021 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6K6MTsz4hL5; Thu, 21 Oct 2021 17:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A233D1ED71; Thu, 21 Oct 2021 17:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH73Oc080351; Thu, 21 Oct 2021 17:07:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH73hO080350; Thu, 21 Oct 2021 17:07:03 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:03 GMT Message-Id: <202110211707.19LH73hO080350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: e3d927fac1da - stable/13 - ossl: Don't encryt/decrypt too much data for chacha20. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: e3d927fac1da765f40addb147e0bacb69a9236fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e3d927fac1da765f40addb147e0bacb69a9236fb commit e3d927fac1da765f40addb147e0bacb69a9236fb Author: John Baldwin AuthorDate: 2021-04-01 22:42:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 ossl: Don't encryt/decrypt too much data for chacha20. The loops for Chacha20 and Chacha20+Poly1305 which encrypted/decrypted full blocks of data used the minimum of the input and output segment lengths to determine the size of the next chunk ('todo') to pass to Chacha20_ctr32(). However, the input and output segments could extend past the end of the ciphertext region into the tag (e.g. if a "plain" single mbuf contained an entire TLS record). If the length of the tag plus the length of the last partial block together were at least as large as a full Chacha20 block (64 bytes), then an extra block was encrypted/decrypted overlapping with the tag. Fix this by also capping the amount of data to encrypt/decrypt by the amount of remaining data in the ciphertext region ('resid'). Reported by: gallatin Reviewed by: cem, gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29517 (cherry picked from commit d2e076c37b0963a8be89684a656c4e1640dc7a3e) --- sys/crypto/openssl/ossl_chacha20.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index a2bfb52cacd6..7fa1a297052e 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -88,7 +88,8 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ @@ -218,7 +219,8 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ @@ -389,7 +391,8 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ From nobody Thu Oct 21 17:07:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BF5151806E42; Thu, 21 Oct 2021 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6J5hnrz4h4F; Thu, 21 Oct 2021 17:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9987A1F020; Thu, 21 Oct 2021 17:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH72Qa080327; Thu, 21 Oct 2021 17:07:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH72Z2080326; Thu, 21 Oct 2021 17:07:02 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:02 GMT Message-Id: <202110211707.19LH72Z2080326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 06e1e115a9ae - stable/13 - Add Chacha20+Poly1035 to the list of AEAD algorithms. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 06e1e115a9ae872ff54a479f8082ada843a48c6e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=06e1e115a9ae872ff54a479f8082ada843a48c6e commit 06e1e115a9ae872ff54a479f8082ada843a48c6e Author: John Baldwin AuthorDate: 2021-03-18 20:31:39 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 Add Chacha20+Poly1035 to the list of AEAD algorithms. Sponsored by: Netflix (cherry picked from commit c853c53d024a3cc950854dfaade7f50303c5a022) --- share/man/man9/crypto.9 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man9/crypto.9 b/share/man/man9/crypto.9 index 0ea24356e975..69fe3339a757 100644 --- a/share/man/man9/crypto.9 +++ b/share/man/man9/crypto.9 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2020 +.Dd March 18, 2021 .Dt CRYPTO 9 .Os .Sh NAME @@ -136,9 +136,10 @@ The following encryption algorithms are supported: The following authenticated encryption with additional data (AEAD) algorithms are supported: .Pp -.Bl -tag -offset indent -width CRYPTO_AES_NIST_GCM_16 -compact +.Bl -tag -offset indent -width CRYPTO_CHACHA20_POLY1305 -compact .It Dv CRYPTO_AES_CCM_16 .It Dv CRYPTO_AES_NIST_GCM_16 +.It Dv CRYPTO_CHACHA20_POLY1305 .El .Pp The following compression algorithms are supported: From nobody Thu Oct 21 17:07:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D29C61806ED7; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6L5ptSz4h4P; Thu, 21 Oct 2021 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C825E1EF2C; Thu, 21 Oct 2021 17:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH74sW080375; Thu, 21 Oct 2021 17:07:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH74MS080374; Thu, 21 Oct 2021 17:07:04 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:04 GMT Message-Id: <202110211707.19LH74MS080374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d8b6a6559070 - stable/13 - cryptocheck: Expand the set of sizes tested by -z. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: d8b6a6559070a4d76f8c9e0660fff2ea5a573d65 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d8b6a6559070a4d76f8c9e0660fff2ea5a573d65 commit d8b6a6559070a4d76f8c9e0660fff2ea5a573d65 Author: John Baldwin AuthorDate: 2021-04-01 22:42:30 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:24 +0000 cryptocheck: Expand the set of sizes tested by -z. Test individual sizes up to the max encryption block length as well as a few sizes that include 1 full block and a partial block before doubling the size. Reviewed by: cem, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29518 (cherry picked from commit c86de1dab8e65bc9d11501ca51f2e152276cb94e) --- tools/tools/crypto/cryptocheck.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index bd075d24e0f5..502ea04cd661 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -228,7 +228,7 @@ static const struct alg { static bool verbose; static int requested_crid; -static size_t aad_sizes[48], sizes[128]; +static size_t aad_sizes[48], sizes[EALG_MAX_BLOCK_LEN * 2]; static u_int naad_sizes, nsizes; static void @@ -1729,12 +1729,18 @@ main(int ac, char **av) if (nsizes == 0) { if (testall) { - for (i = 1; i <= 32; i++) { + for (i = 1; i <= EALG_MAX_BLOCK_LEN; i++) { sizes[nsizes] = i; nsizes++; } - base_size = 32; + for (i = EALG_MAX_BLOCK_LEN + 8; + i <= EALG_MAX_BLOCK_LEN * 2; i += 8) { + sizes[nsizes] = i; + nsizes++; + } + + base_size = EALG_MAX_BLOCK_LEN * 2; while (base_size * 2 < 240 * 1024) { base_size *= 2; assert(nsizes < nitems(sizes)); From nobody Thu Oct 21 17:07:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 36FF31806EDA; Thu, 21 Oct 2021 17:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6M190Cz4hLK; Thu, 21 Oct 2021 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9F8F1EF2D; Thu, 21 Oct 2021 17:07:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH754M080399; Thu, 21 Oct 2021 17:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH75Ha080398; Thu, 21 Oct 2021 17:07:05 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:05 GMT Message-Id: <202110211707.19LH75Ha080398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 11db133ecad7 - stable/13 - cryptodev: Use 'csp' in the handlers for requests. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 11db133ecad7930dd4f289815e2a1b531390f124 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=11db133ecad7930dd4f289815e2a1b531390f124 commit 11db133ecad7930dd4f289815e2a1b531390f124 Author: John Baldwin AuthorDate: 2021-10-06 21:08:46 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:25 +0000 cryptodev: Use 'csp' in the handlers for requests. - Retire cse->mode and use csp->csp_mode instead. - Use csp->csp_cipher_algorithm instead of the ivsize when checking for the fixup for the IV length for AES-XTS. Reviewed by: markj Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32103 (cherry picked from commit b4e0a27c5be5090a9db16dd0ad417543b1fb0c4a) --- sys/opencrypto/cryptodev.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 81c6dcd01e2a..9f581e68fe92 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -3,13 +3,16 @@ /*- * Copyright (c) 2001 Theo de Raadt * Copyright (c) 2002-2006 Sam Leffler, Errno Consulting - * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2014-2021 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by John-Mark Gurney * under sponsorship of the FreeBSD Foundation and * Rubicon Communications, LLC (Netgate). * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -325,7 +328,6 @@ struct csession { struct enc_xform *txform; int hashsize; int ivsize; - int mode; void *key; void *mackey; @@ -679,7 +681,6 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) refcount_init(&cse->refs, 1); cse->key = key; cse->mackey = mackey; - cse->mode = csp.csp_mode; cse->cses = cses; cse->txform = txform; if (thash != NULL) @@ -808,6 +809,7 @@ cryptodev_cb(struct cryptop *crp) static int cryptodev_op(struct csession *cse, const struct crypt_op *cop) { + const struct crypto_session_params *csp; struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; char *dst; @@ -857,7 +859,8 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) if (cse->hashsize) crp->crp_digest_start = cop->len; - switch (cse->mode) { + csp = crypto_get_params(cse->cses); + switch (csp->csp_mode) { case CSP_MODE_COMPRESS: switch (cop->op) { case COP_ENCRYPT: @@ -1023,6 +1026,7 @@ bail: static int cryptodev_aead(struct csession *cse, struct crypt_aead *caead) { + const struct crypto_session_params *csp; struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; char *dst; @@ -1085,7 +1089,8 @@ cryptodev_aead(struct csession *cse, struct crypt_aead *caead) else crp->crp_digest_start = crp->crp_payload_start + caead->len; - switch (cse->mode) { + csp = crypto_get_params(cse->cses); + switch (csp->csp_mode) { case CSP_MODE_AEAD: case CSP_MODE_ETA: switch (caead->op) { @@ -1123,9 +1128,9 @@ cryptodev_aead(struct csession *cse, struct crypt_aead *caead) * Permit a 16-byte IV for AES-XTS, but only use the * first 8 bytes as a block number. */ - if (cse->mode == CSP_MODE_ETA && - caead->ivlen == AES_BLOCK_LEN && - cse->ivsize == AES_XTS_IV_LEN) + if (csp->csp_mode == CSP_MODE_ETA && + csp->csp_cipher_alg == CRYPTO_AES_XTS && + caead->ivlen == AES_BLOCK_LEN) caead->ivlen = AES_XTS_IV_LEN; if (cse->ivsize == 0) { From nobody Thu Oct 21 17:07:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0BB0318070A9; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6P0c5Tz4hCN; Thu, 21 Oct 2021 17:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16A2A1EFB5; Thu, 21 Oct 2021 17:07:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH76bS080429; Thu, 21 Oct 2021 17:07:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH765L080428; Thu, 21 Oct 2021 17:07:06 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:06 GMT Message-Id: <202110211707.19LH765L080428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 83b3e8e05ad9 - stable/13 - ccp, ccr: Simplify drivers to assume an AES-GCM IV length of 12. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 83b3e8e05ad9bab3f6cd79cc7842c37fa5f84951 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=83b3e8e05ad9bab3f6cd79cc7842c37fa5f84951 commit 83b3e8e05ad9bab3f6cd79cc7842c37fa5f84951 Author: John Baldwin AuthorDate: 2021-10-06 21:08:46 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:25 +0000 ccp, ccr: Simplify drivers to assume an AES-GCM IV length of 12. While here, use crypto_read_iv() in a few more places in ccr(4) that I missed previously. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32104 (cherry picked from commit cb128893b92994456107d6ca722fdf6e5028eacc) --- sys/crypto/ccp/ccp_hardware.c | 5 ++--- sys/dev/cxgbe/crypto/t4_crypto.c | 36 ++++++------------------------------ 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/sys/crypto/ccp/ccp_hardware.c b/sys/crypto/ccp/ccp_hardware.c index a2ca8e1cb71a..68f46a553f3c 100644 --- a/sys/crypto/ccp/ccp_hardware.c +++ b/sys/crypto/ccp/ccp_hardware.c @@ -1356,10 +1356,9 @@ ccp_collect_iv(struct cryptop *crp, const struct crypto_session_params *csp, crypto_read_iv(crp, iv); /* - * If the input IV is 12 bytes, append an explicit counter of 1. + * Append an explicit counter of 1 for GCM. */ - if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16 && - csp->csp_ivlen == 12) + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) *(uint32_t *)&iv[12] = htobe32(1); if (csp->csp_cipher_alg == CRYPTO_AES_XTS && diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index cdd14fcee2f9..a3c25eb7df47 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1133,26 +1133,7 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) else op_type = CHCR_DECRYPT_OP; - /* - * The IV handling for GCM in OCF is a bit more complicated in - * that IPSec provides a full 16-byte IV (including the - * counter), whereas the /dev/crypto interface sometimes - * provides a full 16-byte IV (if no IV is provided in the - * ioctl) and sometimes a 12-byte IV (if the IV was explicit). - * - * When provided a 12-byte IV, assume the IV is really 16 bytes - * with a counter in the last 4 bytes initialized to 1. - * - * While iv_len is checked below, the value is currently - * always set to 12 when creating a GCM session in this driver - * due to limitations in OCF (there is no way to know what the - * IV length of a given request will be). This means that the - * driver always assumes as 12-byte IV for now. - */ - if (s->blkcipher.iv_len == 12) - iv_len = AES_BLOCK_LEN; - else - iv_len = s->blkcipher.iv_len; + iv_len = AES_BLOCK_LEN; /* * GCM requests should always provide an explicit IV. @@ -1290,9 +1271,8 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr = wrtod(wr); memset(crwr, 0, wr_len); - memcpy(iv, crp->crp_iv, s->blkcipher.iv_len); - if (s->blkcipher.iv_len == 12) - *(uint32_t *)&iv[12] = htobe32(1); + crypto_read_iv(crp, iv); + *(uint32_t *)&iv[12] = htobe32(1); ccr_populate_wreq(sc, s, crwr, kctx_len, wr_len, imm_len, sgl_len, 0, crp); @@ -1445,15 +1425,11 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) if (error) goto out; - /* - * This assumes a 12-byte IV from the crp. See longer comment - * above in ccr_gcm() for more details. - */ if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) { error = EINVAL; goto out; } - memcpy(iv, crp->crp_iv, 12); + crypto_read_iv(crp, iv); *(uint32_t *)&iv[12] = htobe32(1); axf->Reinit(auth_ctx, iv, sizeof(iv)); @@ -1767,7 +1743,7 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) */ memset(iv, 0, iv_len); iv[0] = (15 - AES_CCM_IV_LEN) - 1; - memcpy(iv + 1, crp->crp_iv, AES_CCM_IV_LEN); + crypto_read_iv(crp, iv + 1); ccr_populate_wreq(sc, s, crwr, kctx_len, wr_len, imm_len, sgl_len, 0, crp); @@ -1940,7 +1916,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) error = EINVAL; goto out; } - memcpy(iv, crp->crp_iv, AES_CCM_IV_LEN); + crypto_read_iv(crp, iv); auth_ctx->aes_cbc_mac_ctx.authDataLength = crp->crp_aad_length; auth_ctx->aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; From nobody Thu Oct 21 17:07:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7E9DC1806E6E; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6Q2l3Yz4hNg; Thu, 21 Oct 2021 17:07:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EAED1EDB8; Thu, 21 Oct 2021 17:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH78bs080453; Thu, 21 Oct 2021 17:07:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH780s080452; Thu, 21 Oct 2021 17:07:08 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:08 GMT Message-Id: <202110211707.19LH780s080452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 2ba824366ca6 - stable/13 - Extend m_apply() to support unmapped mbufs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2ba824366ca60679c36296991582054116d2d4a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2ba824366ca60679c36296991582054116d2d4a7 commit 2ba824366ca60679c36296991582054116d2d4a7 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:25 +0000 Extend m_apply() to support unmapped mbufs. m_apply() invokes the callback function separately on each segment of an unmapped mbuf: the TLS header, individual pages, and the TLS trailer. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30132 (cherry picked from commit 3c7a01d773ac2d128eabb596eed7098f76966cc5) --- sys/kern/uipc_mbuf.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index f525c25d1431..8b5b83337d56 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1239,6 +1239,62 @@ m_append(struct mbuf *m0, int len, c_caddr_t cp) return (remainder == 0); } +static int +m_apply_extpg_one(struct mbuf *m, int off, int len, + int (*f)(void *, void *, u_int), void *arg) +{ + void *p; + u_int i, count, pgoff, pglen; + int rval; + + KASSERT(PMAP_HAS_DMAP, + ("m_apply_extpg_one does not support unmapped mbufs")); + off += mtod(m, vm_offset_t); + if (off < m->m_epg_hdrlen) { + count = min(m->m_epg_hdrlen - off, len); + rval = f(arg, m->m_epg_hdr + off, count); + if (rval) + return (rval); + len -= count; + off = 0; + } else + off -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs && len > 0; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (off < pglen) { + count = min(pglen - off, len); + p = (void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff); + rval = f(arg, p, count); + if (rval) + return (rval); + len -= count; + off = 0; + } else + off -= pglen; + pgoff = 0; + } + if (len > 0) { + KASSERT(off < m->m_epg_trllen, + ("m_apply_extpg_one: offset beyond trailer")); + KASSERT(len <= m->m_epg_trllen - off, + ("m_apply_extpg_one: length beyond trailer")); + return (f(arg, m->m_epg_trail + off, len)); + } + return (0); +} + +/* Apply function f to the data in a single mbuf. */ +static int +m_apply_one(struct mbuf *m, int off, int len, + int (*f)(void *, void *, u_int), void *arg) +{ + if ((m->m_flags & M_EXTPG) != 0) + return (m_apply_extpg_one(m, off, len, f, arg)); + else + return (f(arg, mtod(m, caddr_t) + off, len)); +} + /* * Apply function f to the data in an mbuf chain starting "off" bytes from * the beginning, continuing for "len" bytes. @@ -1262,7 +1318,7 @@ m_apply(struct mbuf *m, int off, int len, while (len > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); count = min(m->m_len - off, len); - rval = (*f)(arg, mtod(m, caddr_t) + off, count); + rval = m_apply_one(m, off, count, f, arg); if (rval) return (rval); len -= count; From nobody Thu Oct 21 17:07:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0D63518070D1; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6R46Zwz4hNp; Thu, 21 Oct 2021 17:07:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 504CC1EDB9; Thu, 21 Oct 2021 17:07:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH79n5080477; Thu, 21 Oct 2021 17:07:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH79pZ080476; Thu, 21 Oct 2021 17:07:09 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:09 GMT Message-Id: <202110211707.19LH79pZ080476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8efc88d0d6a0 - stable/13 - Extend m_copyback() to support unmapped mbufs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8efc88d0d6a044e5928bec64447fcbc24b8f01b2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8efc88d0d6a044e5928bec64447fcbc24b8f01b2 commit 8efc88d0d6a044e5928bec64447fcbc24b8f01b2 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:25 +0000 Extend m_copyback() to support unmapped mbufs. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30133 (cherry picked from commit 3f9dac85cc8f2963026fdc2d5477acb607176a89) --- sys/kern/uipc_mbuf.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 8b5b83337d56..b141cb5f43a2 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1139,6 +1139,29 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp, return (top); } +static void +m_copytounmapped(const struct mbuf *m, int off, int len, c_caddr_t cp) +{ + struct iovec iov; + struct uio uio; + int error; + + KASSERT(off >= 0, ("m_copytounmapped: negative off %d", off)); + KASSERT(len >= 0, ("m_copytounmapped: negative len %d", len)); + KASSERT(off < m->m_len, ("m_copytounmapped: len exceeds mbuf length")); + iov.iov_base = __DECONST(caddr_t, cp); + iov.iov_len = len; + uio.uio_resid = len; + uio.uio_iov = &iov; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_iovcnt = 1; + uio.uio_offset = 0; + uio.uio_rw = UIO_WRITE; + error = m_unmappedtouio(m, off, &uio, len); + KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + len)); +} + /* * Copy data from a buffer back into the indicated mbuf chain, * starting "off" bytes from the beginning, extending the mbuf @@ -1172,7 +1195,10 @@ m_copyback(struct mbuf *m0, int off, int len, c_caddr_t cp) M_TRAILINGSPACE(m)); } mlen = min (m->m_len - off, len); - bcopy(cp, off + mtod(m, caddr_t), (u_int)mlen); + if ((m->m_flags & M_EXTPG) != 0) + m_copytounmapped(m, off, mlen, cp); + else + bcopy(cp, off + mtod(m, caddr_t), (u_int)mlen); cp += mlen; len -= mlen; mlen += off; @@ -1870,7 +1896,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int align, int flags) } /* - * Copy data from an unmapped mbuf into a uio limited by len if set. + * Copy data to/from an unmapped mbuf into a uio limited by len if set. */ int m_unmappedtouio(const struct mbuf *m, int m_off, struct uio *uio, int len) From nobody Thu Oct 21 17:07:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AF1C71806FF5; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6S6q7Mz4h7B; Thu, 21 Oct 2021 17:07:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95F671EDBA; Thu, 21 Oct 2021 17:07:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7BcJ080525; Thu, 21 Oct 2021 17:07:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7Bs1080524; Thu, 21 Oct 2021 17:07:11 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:11 GMT Message-Id: <202110211707.19LH7Bs1080524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8460b90d28c0 - stable/13 - Support unmapped mbufs in crypto buffers. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8460b90d28c027f48427eb640c038598e7ba4c56 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8460b90d28c027f48427eb640c038598e7ba4c56 commit 8460b90d28c027f48427eb640c038598e7ba4c56 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:26 +0000 Support unmapped mbufs in crypto buffers. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30134 (cherry picked from commit 1c8f4b3c9f9e8ca5823d153d3b117246b3d18db4) --- sys/opencrypto/criov.c | 121 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 10 deletions(-) diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index b18a01faf26a..bf7965032084 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -239,6 +239,99 @@ cvm_page_copydata(vm_page_t *pages, int off, int len, caddr_t cp) } #endif /* CRYPTO_MAY_HAVE_VMPAGE */ +/* + * Given a starting page in an m_epg, determine the length of the + * current physically contiguous segment. + */ +static __inline size_t +m_epg_pages_extent(struct mbuf *m, int idx, u_int pglen) +{ + size_t len; + u_int i; + + len = pglen; + for (i = idx + 1; i < m->m_epg_npgs; i++) { + if (m->m_epg_pa[i - 1] + PAGE_SIZE != m->m_epg_pa[i]) + break; + len += m_epg_pagelen(m, i, 0); + } + return (len); +} + +static __inline void * +m_epg_segbase(struct mbuf *m, size_t offset) +{ + u_int i, pglen, pgoff; + + offset += mtod(m, vm_offset_t); + if (offset < m->m_epg_hdrlen) + return (m->m_epg_hdr + offset); + offset -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (offset < pglen) + return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + + offset)); + offset -= pglen; + pgoff = 0; + } + KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", + __func__)); + return (m->m_epg_trail + offset); +} + +static __inline size_t +m_epg_seglen(struct mbuf *m, size_t offset) +{ + u_int i, pglen, pgoff; + + offset += mtod(m, vm_offset_t); + if (offset < m->m_epg_hdrlen) + return (m->m_epg_hdrlen - offset); + offset -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (offset < pglen) + return (m_epg_pages_extent(m, i, pglen) - offset); + offset -= pglen; + pgoff = 0; + } + KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", + __func__)); + return (m->m_epg_trllen - offset); +} + +static __inline void * +m_epg_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) +{ + u_int i, pglen, pgoff; + + skip += mtod(m, vm_offset_t); + if (skip < m->m_epg_hdrlen) { + if (len > m->m_epg_hdrlen - skip) + return (NULL); + return (m->m_epg_hdr + skip); + } + skip -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (skip < pglen) { + if (len > m_epg_pages_extent(m, i, pglen) - skip) + return (NULL); + return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + + skip)); + } + skip -= pglen; + pgoff = 0; + } + KASSERT(skip <= m->m_epg_trllen && len <= m->m_epg_trllen - skip, + ("%s: segment beyond trailer", __func__)); + return (m->m_epg_trail + skip); +} + void crypto_cursor_init(struct crypto_buffer_cursor *cc, const struct crypto_buffer *cb) @@ -345,8 +438,8 @@ crypto_cursor_segbase(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_MBUF: if (cc->cc_mbuf == NULL) return (NULL); - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); + if (cc->cc_mbuf->m_flags & M_EXTPG) + return (m_epg_segbase(cc->cc_mbuf, cc->cc_offset)); return (mtod(cc->cc_mbuf, char *) + cc->cc_offset); case CRYPTO_BUF_VMPAGE: return ((char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -372,6 +465,8 @@ crypto_cursor_seglen(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_MBUF: if (cc->cc_mbuf == NULL) return (0); + if (cc->cc_mbuf->m_flags & M_EXTPG) + return (m_epg_seglen(cc->cc_mbuf, cc->cc_offset)); return (cc->cc_mbuf->m_len - cc->cc_offset); case CRYPTO_BUF_UIO: return (cc->cc_iov->iov_len - cc->cc_offset); @@ -401,12 +496,14 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, break; case CRYPTO_BUF_MBUF: for (;;) { - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); - dst = mtod(cc->cc_mbuf, char *) + cc->cc_offset; + /* + * This uses m_copyback() for individual + * mbufs so that cc_mbuf and cc_offset are + * updated. + */ remain = cc->cc_mbuf->m_len - cc->cc_offset; todo = MIN(remain, size); - memcpy(dst, src, todo); + m_copyback(cc->cc_mbuf, cc->cc_offset, todo, src); src += todo; if (todo < remain) { cc->cc_offset += todo; @@ -482,12 +579,14 @@ crypto_cursor_copydata(struct crypto_buffer_cursor *cc, int size, void *vdst) break; case CRYPTO_BUF_MBUF: for (;;) { - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); - src = mtod(cc->cc_mbuf, const char *) + cc->cc_offset; + /* + * This uses m_copydata() for individual + * mbufs so that cc_mbuf and cc_offset are + * updated. + */ remain = cc->cc_mbuf->m_len - cc->cc_offset; todo = MIN(remain, size); - memcpy(dst, src, todo); + m_copydata(cc->cc_mbuf, cc->cc_offset, todo, dst); dst += todo; if (todo < remain) { cc->cc_offset += todo; @@ -715,6 +814,8 @@ m_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) if (skip + len > m->m_len) return (NULL); + if (m->m_flags & M_EXTPG) + return (m_epg_contiguous_subsegment(m, skip, len)); return (mtod(m, char*) + skip); } From nobody Thu Oct 21 17:07:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A9735180729E; Thu, 21 Oct 2021 17:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6W43Xrz4hCn; Thu, 21 Oct 2021 17:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B056A1F021; Thu, 21 Oct 2021 17:07:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7C5w080553; Thu, 21 Oct 2021 17:07:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7Cd7080552; Thu, 21 Oct 2021 17:07:12 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:12 GMT Message-Id: <202110211707.19LH7Cd7080552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 60b9ce724518 - stable/13 - sglist: Add sglist_append_single_mbuf(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 60b9ce724518e6c5a594ae3d10507e0d4771fd8b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=60b9ce724518e6c5a594ae3d10507e0d4771fd8b commit 60b9ce724518e6c5a594ae3d10507e0d4771fd8b Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:26 +0000 sglist: Add sglist_append_single_mbuf(). This function appends the contents of a single mbuf to an sglist rather than an entire mbuf chain. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30135 (cherry picked from commit 6663f8a23e7cb60d798c5ffbd9c716b62b204f2a) --- share/man/man9/Makefile | 1 + share/man/man9/sglist.9 | 12 +++++++++++- sys/kern/subr_sglist.c | 15 +++++++++++++++ sys/sys/sglist.h | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ae5efa65bd0b..acdfa7cc6d8e 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1946,6 +1946,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_append_mbuf_epg.9 \ sglist.9 sglist_append_phys.9 \ sglist.9 sglist_append_sglist.9 \ + sglist.9 sglist_append_single_mbuf.9 \ sglist.9 sglist_append_uio.9 \ sglist.9 sglist_append_user.9 \ sglist.9 sglist_append_vmpages.9 \ diff --git a/share/man/man9/sglist.9 b/share/man/man9/sglist.9 index b1d781b84d63..408d23573489 100644 --- a/share/man/man9/sglist.9 +++ b/share/man/man9/sglist.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2020 +.Dd May 25, 2021 .Dt SGLIST 9 .Os .Sh NAME @@ -38,6 +38,7 @@ .Nm sglist_append_mbuf_epg, .Nm sglist_append_phys , .Nm sglist_append_sglist , +.Nm sglist_append_single_mbuf , .Nm sglist_append_uio , .Nm sglist_append_user , .Nm sglist_append_vmpages , @@ -74,6 +75,8 @@ .Ft int .Fn sglist_append_sglist "struct sglist *sg" "struct sglist *source" "size_t offset" "size_t len" .Ft int +.Fn sglist_append_single_mbuf "struct sglist *sg" "struct mbuf *m" +.Ft int .Fn sglist_append_uio "struct sglist *sg" "struct uio *uio" .Ft int .Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct thread *td" @@ -284,6 +287,13 @@ to the scatter/gather list .Fa sg . .Pp The +.Nm sglist_append_mbuf +function appends the physical address ranges described by a single mbuf +.Fa m +to the scatter/gather list +.Fa sg . +.Pp +The .Nm sglist_append_phys function appends a single physical address range to the scatter/gather list .Fa sg . diff --git a/sys/kern/subr_sglist.c b/sys/kern/subr_sglist.c index 71be45b4231d..7c520fda00f5 100644 --- a/sys/kern/subr_sglist.c +++ b/sys/kern/subr_sglist.c @@ -466,6 +466,21 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) return (0); } +/* + * Append the segments that describe a single mbuf to a scatter/gather + * list. If there are insufficient segments, then this fails with + * EFBIG. + */ +int +sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m) +{ + if ((m->m_flags & M_EXTPG) != 0) + return (sglist_append_mbuf_epg(sg, m, + mtod(m, vm_offset_t), m->m_len)); + else + return (sglist_append(sg, m->m_data, m->m_len)); +} + /* * Append the segments that describe a buffer spanning an array of VM * pages. The buffer begins at an offset of 'pgoff' in the first diff --git a/sys/sys/sglist.h b/sys/sys/sglist.h index 82a3ac6ed6ac..bf8aa482e3ce 100644 --- a/sys/sys/sglist.h +++ b/sys/sys/sglist.h @@ -94,6 +94,7 @@ int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len); int sglist_append_sglist(struct sglist *sg, struct sglist *source, size_t offset, size_t length); +int sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m); int sglist_append_uio(struct sglist *sg, struct uio *uio); int sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td); From nobody Thu Oct 21 17:07:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1D88E1807132; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6S163fz4hNt; Thu, 21 Oct 2021 17:07:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71CCD1ED72; Thu, 21 Oct 2021 17:07:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7AjA080501; Thu, 21 Oct 2021 17:07:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7Afe080500; Thu, 21 Oct 2021 17:07:10 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:10 GMT Message-Id: <202110211707.19LH7Afe080500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: da557f2fe654 - stable/13 - Rename m_unmappedtouio() to m_unmapped_uiomove(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: da557f2fe654b703bb7fe3f72d225bc78d08173d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=da557f2fe654b703bb7fe3f72d225bc78d08173d commit da557f2fe654b703bb7fe3f72d225bc78d08173d Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:26 +0000 Rename m_unmappedtouio() to m_unmapped_uiomove(). This function doesn't only copy data into a uio but instead is a variant of uiomove() similar to uiomove_fromphys(). Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30444 (cherry picked from commit aa341db39b6373c5e242f376a3cabe6a6b99141e) --- sys/kern/uipc_mbuf.c | 12 ++++++------ sys/kern/uipc_socket.c | 3 ++- sys/sys/mbuf.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index b141cb5f43a2..1a2098c7c536 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -628,8 +628,8 @@ m_copyfromunmapped(const struct mbuf *m, int off, int len, caddr_t cp) uio.uio_iovcnt = 1; uio.uio_offset = 0; uio.uio_rw = UIO_READ; - error = m_unmappedtouio(m, off, &uio, len); - KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + error = m_unmapped_uiomove(m, off, &uio, len); + KASSERT(error == 0, ("m_unmapped_uiomove failed: off %d, len %d", off, len)); } @@ -1157,8 +1157,8 @@ m_copytounmapped(const struct mbuf *m, int off, int len, c_caddr_t cp) uio.uio_iovcnt = 1; uio.uio_offset = 0; uio.uio_rw = UIO_WRITE; - error = m_unmappedtouio(m, off, &uio, len); - KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + error = m_unmapped_uiomove(m, off, &uio, len); + KASSERT(error == 0, ("m_unmapped_uiomove failed: off %d, len %d", off, len)); } @@ -1899,7 +1899,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int align, int flags) * Copy data to/from an unmapped mbuf into a uio limited by len if set. */ int -m_unmappedtouio(const struct mbuf *m, int m_off, struct uio *uio, int len) +m_unmapped_uiomove(const struct mbuf *m, int m_off, struct uio *uio, int len) { vm_page_t pg; int error, i, off, pglen, pgoff, seglen, segoff; @@ -1970,7 +1970,7 @@ m_mbuftouio(struct uio *uio, const struct mbuf *m, int len) length = min(m->m_len, total - progress); if ((m->m_flags & M_EXTPG) != 0) - error = m_unmappedtouio(m, 0, uio, length); + error = m_unmapped_uiomove(m, 0, uio, length); else error = uiomove(mtod(m, void *), length, uio); if (error) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 0ba8387763e1..92ee7e1f97d0 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2199,7 +2199,8 @@ dontblock: SBLASTMBUFCHK(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); if ((m->m_flags & M_EXTPG) != 0) - error = m_unmappedtouio(m, moff, uio, (int)len); + error = m_unmapped_uiomove(m, moff, uio, + (int)len); else error = uiomove(mtod(m, char *) + moff, (int)len, uio); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index bb6bf9f62b7a..640856016e0e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -834,7 +834,6 @@ struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); u_int m_length(struct mbuf *, struct mbuf **); int m_mbuftouio(struct uio *, const struct mbuf *, int); -int m_unmappedtouio(const struct mbuf *, int, struct uio *, int); void m_move_pkthdr(struct mbuf *, struct mbuf *); int m_pkthdr_init(struct mbuf *, int); struct mbuf *m_prepend(struct mbuf *, int, int); @@ -844,6 +843,8 @@ struct mbuf *m_pullup(struct mbuf *, int); int m_sanity(struct mbuf *, int); struct mbuf *m_split(struct mbuf *, int, int); struct mbuf *m_uiotombuf(struct uio *, int, int, int, int); +int m_unmapped_uiomove(const struct mbuf *, int, struct uio *, + int); struct mbuf *m_unshare(struct mbuf *, int); int m_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); From nobody Thu Oct 21 17:07:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8A98D1807429; Thu, 21 Oct 2021 17:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6X5lwlz4hJs; Thu, 21 Oct 2021 17:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C83281EF2E; Thu, 21 Oct 2021 17:07:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7DtK080579; Thu, 21 Oct 2021 17:07:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7DVf080578; Thu, 21 Oct 2021 17:07:13 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:13 GMT Message-Id: <202110211707.19LH7DVf080578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 58d69f4ecfee - stable/13 - crypto: Add a new type of crypto buffer for a single mbuf. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 58d69f4ecfeef7cc811c21ac1d3901c4fdc4f610 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=58d69f4ecfeef7cc811c21ac1d3901c4fdc4f610 commit 58d69f4ecfeef7cc811c21ac1d3901c4fdc4f610 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:26 +0000 crypto: Add a new type of crypto buffer for a single mbuf. This is intended for use in KTLS transmit where each TLS record is described by a single mbuf that is itself queued in the socket buffer. Using the existing CRYPTO_BUF_MBUF would result in bus_dmamap_load_crp() walking additional mbufs in the socket buffer that are not relevant, but generating a S/G list that potentially exceeds the limit of the tag (while also wasting CPU cycles). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30136 (cherry picked from commit 883a0196b629a07e52562b4103cc0f6391083080) --- share/man/man9/crypto_buffer.9 | 11 ++++++++--- sys/crypto/ccp/ccp.c | 3 +++ sys/dev/cxgbe/crypto/t4_crypto.c | 3 +++ sys/dev/sec/sec.c | 3 +++ sys/kern/subr_bus_dma.c | 25 +++++++++++++++++++++++++ sys/mips/nlm/dev/sec/nlmsec.c | 3 +++ sys/mips/nlm/dev/sec/nlmseclib.c | 3 +++ sys/opencrypto/criov.c | 21 +++++++++++++++++++++ sys/opencrypto/crypto.c | 2 ++ sys/opencrypto/cryptodev.h | 22 +++++++++++++++++++++- sys/opencrypto/cryptosoft.c | 1 + 11 files changed, 93 insertions(+), 4 deletions(-) diff --git a/share/man/man9/crypto_buffer.9 b/share/man/man9/crypto_buffer.9 index 333fc5ec449f..df6128650cd4 100644 --- a/share/man/man9/crypto_buffer.9 +++ b/share/man/man9/crypto_buffer.9 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2020 +.Dd May 25, 2021 .Dt CRYPTO_BUFFER 9 .Os .Sh NAME @@ -195,7 +195,10 @@ An array of bytes mapped into the kernel's address space. A scatter/gather list of kernel buffers as described in .Xr uio 9 . .It Dv CRYPTO_BUF_MBUF -A network memory buffer as described in +A chain of network memory buffers as described in +.Xr mbuf 9 . +.It Dv CRYPTO_BUF_SINGLE_MBUF +A single network memory buffer as described in .Xr mbuf 9 . .It Dv CRYPTO_BUF_VMPAGE A scatter/gather list of @@ -220,7 +223,9 @@ data buffer A pointer to a .Vt struct mbuf for -.Dv CRYPTO_BUF_MBUF . +.Dv CRYPTO_BUF_MBUF +and +.Dv CRYPTO_BUF_SINGLE_MBUF . .It Fa cb_uio A pointer to a .Vt struct uio diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c index 63967d7f8e3c..7cc38b14f3fd 100644 --- a/sys/crypto/ccp/ccp.c +++ b/sys/crypto/ccp/ccp.c @@ -101,6 +101,9 @@ ccp_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) case CRYPTO_BUF_MBUF: error = sglist_append_mbuf(sg, cb->cb_mbuf); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = sglist_append_single_mbuf(sg, cb->cb_mbuf); + break; case CRYPTO_BUF_UIO: error = sglist_append_uio(sg, cb->cb_uio); break; diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index a3c25eb7df47..ea1272758eaf 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -271,6 +271,9 @@ ccr_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) case CRYPTO_BUF_MBUF: error = sglist_append_mbuf(sg, cb->cb_mbuf); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = sglist_append_single_mbuf(sg, cb->cb_mbuf); + break; case CRYPTO_BUF_UIO: error = sglist_append_uio(sg, cb->cb_uio); break; diff --git a/sys/dev/sec/sec.c b/sys/dev/sec/sec.c index fa3e20806124..f485d932727b 100644 --- a/sys/dev/sec/sec.c +++ b/sys/dev/sec/sec.c @@ -850,6 +850,9 @@ sec_desc_map_dma(struct sec_softc *sc, struct sec_dma_mem *dma_mem, case CRYPTO_BUF_MBUF: size = m_length(crp->crp_buf.cb_mbuf, NULL); break; + case CRYPTO_BUF_SINGLE_MBUF: + size = crp->crp_buf.cb_mbuf->m_len; + break; case CRYPTO_BUF_VMPAGE: size = PAGE_SIZE - crp->crp_buf.cb_vm_page_offset; break; diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c index 6248dd520511..a7ad30e77715 100644 --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -172,6 +172,27 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmamap_t map, return (error); } +/* + * Load a single mbuf. + */ +static int +_bus_dmamap_load_single_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, + struct mbuf *m, bus_dma_segment_t *segs, int *nsegs, int flags) +{ + int error; + + error = 0; + if ((m->m_flags & M_EXTPG) != 0) + error = _bus_dmamap_load_mbuf_epg(dmat, map, m, segs, nsegs, + flags); + else + error = _bus_dmamap_load_buffer(dmat, map, m->m_data, m->m_len, + kernel_pmap, flags | BUS_DMA_LOAD_MBUF, segs, nsegs); + CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", + __func__, dmat, flags, error, *nsegs); + return (error); +} + /* * Load an mbuf chain. */ @@ -658,6 +679,10 @@ bus_dmamap_load_crp_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, error = _bus_dmamap_load_mbuf_sg(dmat, map, cb->cb_mbuf, NULL, &nsegs, flags); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = _bus_dmamap_load_single_mbuf(dmat, map, cb->cb_mbuf, + NULL, &nsegs, flags); + break; case CRYPTO_BUF_UIO: error = _bus_dmamap_load_uio(dmat, map, cb->cb_uio, &nsegs, flags); diff --git a/sys/mips/nlm/dev/sec/nlmsec.c b/sys/mips/nlm/dev/sec/nlmsec.c index c28eaf334613..d5d83ba796bd 100644 --- a/sys/mips/nlm/dev/sec/nlmsec.c +++ b/sys/mips/nlm/dev/sec/nlmsec.c @@ -468,12 +468,15 @@ xlp_get_nsegs(struct cryptop *crp, unsigned int *nsegs) switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: { struct mbuf *m = NULL; m = crp->crp_buf.cb_mbuf; while (m != NULL) { *nsegs += NLM_CRYPTO_NUM_SEGS_REQD(m->m_len); + if (crp->crp_buf.cb_type == CRYPTO_BUF_SINGLE_MBUF) + break; m = m->m_next; } break; diff --git a/sys/mips/nlm/dev/sec/nlmseclib.c b/sys/mips/nlm/dev/sec/nlmseclib.c index bb154b5d3d79..6e5e715c28f8 100644 --- a/sys/mips/nlm/dev/sec/nlmseclib.c +++ b/sys/mips/nlm/dev/sec/nlmseclib.c @@ -112,6 +112,7 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cmd, switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: { struct mbuf *m = NULL; @@ -123,6 +124,8 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cmd, dstseg = nlm_crypto_fill_dst_seg(cmd->paramp, dstseg, mtod(m,caddr_t), m->m_len); } + if (crp->crp_buf.cb_type == CRYPTO_BUF_SINGLE_MBUF) + break; m = m->m_next; } break; diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index bf7965032084..df053b314d41 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -344,6 +344,7 @@ crypto_cursor_init(struct crypto_buffer_cursor *cc, cc->cc_buf_len = cb->cb_buf_len; break; case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: cc->cc_mbuf = cb->cb_mbuf; break; case CRYPTO_BUF_VMPAGE: @@ -389,6 +390,10 @@ crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount) break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + amount); + cc->cc_offset += amount; + break; case CRYPTO_BUF_VMPAGE: for (;;) { SDT_PROBE2(opencrypto, criov, cursor_advance, vmpage, @@ -436,6 +441,7 @@ crypto_cursor_segbase(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_CONTIG: return (cc->cc_buf); case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: if (cc->cc_mbuf == NULL) return (NULL); if (cc->cc_mbuf->m_flags & M_EXTPG) @@ -463,6 +469,7 @@ crypto_cursor_seglen(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_VMPAGE: return (PAGE_SIZE - cc->cc_offset); case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: if (cc->cc_mbuf == NULL) return (0); if (cc->cc_mbuf->m_flags & M_EXTPG) @@ -516,6 +523,11 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + size); + m_copyback(cc->cc_mbuf, cc->cc_offset, size, src); + cc->cc_offset += size; + break; case CRYPTO_BUF_VMPAGE: for (;;) { dst = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -599,6 +611,11 @@ crypto_cursor_copydata(struct crypto_buffer_cursor *cc, int size, void *vdst) break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + size); + m_copydata(cc->cc_mbuf, cc->cc_offset, size, dst); + cc->cc_offset += size; + break; case CRYPTO_BUF_VMPAGE: for (;;) { src = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -699,6 +716,7 @@ crypto_copyback(struct cryptop *crp, int off, int size, const void *src) cb = &crp->crp_buf; switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: m_copyback(cb->cb_mbuf, off, size, src); break; #if CRYPTO_MAY_HAVE_VMPAGE @@ -731,6 +749,7 @@ crypto_copydata(struct cryptop *crp, int off, int size, void *dst) switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: m_copydata(crp->crp_buf.cb_mbuf, off, size, dst); break; #if CRYPTO_MAY_HAVE_VMPAGE @@ -765,6 +784,7 @@ crypto_apply_buf(struct crypto_buffer *cb, int off, int len, switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: error = m_apply(cb->cb_mbuf, off, len, (int (*)(void *, void *, u_int))f, arg); break; @@ -843,6 +863,7 @@ crypto_buffer_contiguous_subsegment(struct crypto_buffer *cb, size_t skip, switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: return (m_contiguous_subsegment(cb->cb_mbuf, skip, len)); case CRYPTO_BUF_UIO: return (cuio_contiguous_segment(cb->cb_uio, skip, len)); diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 704077043bb8..bcde910728e1 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1224,6 +1224,8 @@ crypto_buffer_len(struct crypto_buffer *cb) if (cb->cb_mbuf->m_flags & M_PKTHDR) return (cb->cb_mbuf->m_pkthdr.len); return (m_length(cb->cb_mbuf, NULL)); + case CRYPTO_BUF_SINGLE_MBUF: + return (cb->cb_mbuf->m_len); case CRYPTO_BUF_VMPAGE: return (cb->cb_vm_page_len); case CRYPTO_BUF_UIO: diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 277867734841..f60f4e63735a 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -392,7 +392,8 @@ enum crypto_buffer_type { CRYPTO_BUF_UIO, CRYPTO_BUF_MBUF, CRYPTO_BUF_VMPAGE, - CRYPTO_BUF_LAST = CRYPTO_BUF_VMPAGE + CRYPTO_BUF_SINGLE_MBUF, + CRYPTO_BUF_LAST = CRYPTO_BUF_SINGLE_MBUF }; /* @@ -524,6 +525,13 @@ _crypto_use_mbuf(struct crypto_buffer *cb, struct mbuf *m) cb->cb_type = CRYPTO_BUF_MBUF; } +static __inline void +_crypto_use_single_mbuf(struct crypto_buffer *cb, struct mbuf *m) +{ + cb->cb_mbuf = m; + cb->cb_type = CRYPTO_BUF_SINGLE_MBUF; +} + static __inline void _crypto_use_vmpage(struct crypto_buffer *cb, vm_page_t *pages, int len, int offset) @@ -553,6 +561,12 @@ crypto_use_mbuf(struct cryptop *crp, struct mbuf *m) _crypto_use_mbuf(&crp->crp_buf, m); } +static __inline void +crypto_use_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_buf, m); +} + static __inline void crypto_use_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) { @@ -577,6 +591,12 @@ crypto_use_output_mbuf(struct cryptop *crp, struct mbuf *m) _crypto_use_mbuf(&crp->crp_obuf, m); } +static __inline void +crypto_use_output_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_obuf, m); +} + static __inline void crypto_use_output_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index a09f085a1eef..4040a014881e 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1105,6 +1105,7 @@ swcr_compdec(struct swcr_session *ses, struct cryptop *crp) if (result < crp->crp_payload_length) { switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: adj = result - crp->crp_payload_length; m_adj(crp->crp_buf.cb_mbuf, adj); break; From nobody Thu Oct 21 17:07:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8E7B61807346; Thu, 21 Oct 2021 17:07:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6Y4bNVz4hB4; Thu, 21 Oct 2021 17:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E04861ED73; Thu, 21 Oct 2021 17:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7Ej9080603; Thu, 21 Oct 2021 17:07:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7ELC080602; Thu, 21 Oct 2021 17:07:14 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:14 GMT Message-Id: <202110211707.19LH7ELC080602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a017868e2818 - stable/13 - crypto: Add crypto_cursor_segment() to fetch both base and length. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: a017868e281874261a560ba1e3069b4e14b7483e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a017868e281874261a560ba1e3069b4e14b7483e commit a017868e281874261a560ba1e3069b4e14b7483e Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:26 +0000 crypto: Add crypto_cursor_segment() to fetch both base and length. This function combines crypto_cursor_segbase() and crypto_cursor_seglen() into a single function. This is mostly beneficial in the unmapped mbuf case where back to back calls of these two functions have to iterate over the sub-components of unmapped mbufs twice. Bump __FreeBSD_version for crypto drivers in ports. Suggested by: markj Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30445 (cherry picked from commit beb817edfe22cdea91e19a60c42caabd9404da48) --- share/man/man9/Makefile | 1 + share/man/man9/crypto_buffer.9 | 11 ++++- sys/opencrypto/criov.c | 109 ++++++++++++++--------------------------- sys/opencrypto/cryptodev.h | 1 + sys/sys/param.h | 2 +- 5 files changed, 50 insertions(+), 74 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index acdfa7cc6d8e..c180742bdb4b 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -929,6 +929,7 @@ MLINKS+=crypto_buffer.9 crypto_apply.9 \ crypto_buffer.9 crypto_cursor_copydata_noadv.9 \ crypto_buffer.9 crypto_cursor_segbase.9 \ crypto_buffer.9 crypto_cursor_seglen.9 \ + crypto_buffer.9 crypto_cursor_segment.9 \ crypto_buffer.9 CRYPTO_HAS_OUTPUT_BUFFER.9 MLINKS+=crypto_driver.9 crypto_copyback.9 \ crypto_driver.9 crypto_copydata.9 \ diff --git a/share/man/man9/crypto_buffer.9 b/share/man/man9/crypto_buffer.9 index df6128650cd4..a16206e8e607 100644 --- a/share/man/man9/crypto_buffer.9 +++ b/share/man/man9/crypto_buffer.9 @@ -94,6 +94,8 @@ .Fa "void *dst" .Fc .Ft void * +.Fn crypto_cursor_segment "struct crypto_buffer_cursor *cc" "size_t *len" +.Ft void * .Fn crypto_cursor_segbase "struct crypto_buffer_cursor *cc" .Ft size_t .Fn crypto_cursor_seglen "struct crypto_buffer_cursor *cc" @@ -293,6 +295,12 @@ is similar to except that it does not change the current position of .Fa cc . .Pp +.Fn crypto_cursor_segment +returns the start of the virtually-contiguous segment at the current position of +.Fa cc . +The length of the segment is stored in +.Fa len . +.Pp .Fn crypto_cursor_segbase and .Fn crypto_cursor_seglen @@ -307,8 +315,9 @@ return the return value from the caller-supplied callback function. .Pp .Fn crypto_buffer_contiguous_subsegment , .Fn crypto_contiguous_subsegment , -and .Fn crypto_cursor_segbase , +and +.Fn crypto_cursor_segment return a pointer to a contiguous segment or .Dv NULL . .Pp diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index df053b314d41..25702e3592fe 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -258,78 +258,44 @@ m_epg_pages_extent(struct mbuf *m, int idx, u_int pglen) return (len); } -static __inline void * -m_epg_segbase(struct mbuf *m, size_t offset) +static void * +m_epg_segment(struct mbuf *m, size_t offset, size_t *len) { u_int i, pglen, pgoff; offset += mtod(m, vm_offset_t); - if (offset < m->m_epg_hdrlen) + if (offset < m->m_epg_hdrlen) { + *len = m->m_epg_hdrlen - offset; return (m->m_epg_hdr + offset); + } offset -= m->m_epg_hdrlen; pgoff = m->m_epg_1st_off; for (i = 0; i < m->m_epg_npgs; i++) { pglen = m_epg_pagelen(m, i, pgoff); - if (offset < pglen) + if (offset < pglen) { + *len = m_epg_pages_extent(m, i, pglen) - offset; return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + offset)); + } offset -= pglen; pgoff = 0; } KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", __func__)); + *len = m->m_epg_trllen - offset; return (m->m_epg_trail + offset); } -static __inline size_t -m_epg_seglen(struct mbuf *m, size_t offset) -{ - u_int i, pglen, pgoff; - - offset += mtod(m, vm_offset_t); - if (offset < m->m_epg_hdrlen) - return (m->m_epg_hdrlen - offset); - offset -= m->m_epg_hdrlen; - pgoff = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++) { - pglen = m_epg_pagelen(m, i, pgoff); - if (offset < pglen) - return (m_epg_pages_extent(m, i, pglen) - offset); - offset -= pglen; - pgoff = 0; - } - KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", - __func__)); - return (m->m_epg_trllen - offset); -} - static __inline void * m_epg_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) { - u_int i, pglen, pgoff; + void *base; + size_t seglen; - skip += mtod(m, vm_offset_t); - if (skip < m->m_epg_hdrlen) { - if (len > m->m_epg_hdrlen - skip) - return (NULL); - return (m->m_epg_hdr + skip); - } - skip -= m->m_epg_hdrlen; - pgoff = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++) { - pglen = m_epg_pagelen(m, i, pgoff); - if (skip < pglen) { - if (len > m_epg_pages_extent(m, i, pglen) - skip) - return (NULL); - return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + - skip)); - } - skip -= pglen; - pgoff = 0; - } - KASSERT(skip <= m->m_epg_trllen && len <= m->m_epg_trllen - skip, - ("%s: segment beyond trailer", __func__)); - return (m->m_epg_trail + skip); + base = m_epg_segment(m, skip, &seglen); + if (len > seglen) + return (NULL); + return (base); } void @@ -435,54 +401,53 @@ crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount) } void * -crypto_cursor_segbase(struct crypto_buffer_cursor *cc) +crypto_cursor_segment(struct crypto_buffer_cursor *cc, size_t *len) { switch (cc->cc_type) { case CRYPTO_BUF_CONTIG: + *len = cc->cc_buf_len; return (cc->cc_buf); case CRYPTO_BUF_MBUF: case CRYPTO_BUF_SINGLE_MBUF: - if (cc->cc_mbuf == NULL) + if (cc->cc_mbuf == NULL) { + *len = 0; return (NULL); + } if (cc->cc_mbuf->m_flags & M_EXTPG) - return (m_epg_segbase(cc->cc_mbuf, cc->cc_offset)); + return (m_epg_segment(cc->cc_mbuf, cc->cc_offset, len)); + *len = cc->cc_mbuf->m_len - cc->cc_offset; return (mtod(cc->cc_mbuf, char *) + cc->cc_offset); case CRYPTO_BUF_VMPAGE: + *len = PAGE_SIZE - cc->cc_offset; return ((char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( *cc->cc_vmpage)) + cc->cc_offset); case CRYPTO_BUF_UIO: + *len = cc->cc_iov->iov_len - cc->cc_offset; return ((char *)cc->cc_iov->iov_base + cc->cc_offset); default: #ifdef INVARIANTS panic("%s: invalid buffer type %d", __func__, cc->cc_type); #endif + *len = 0; return (NULL); } } +void * +crypto_cursor_segbase(struct crypto_buffer_cursor *cc) +{ + size_t len; + + return (crypto_cursor_segment(cc, &len)); +} + size_t crypto_cursor_seglen(struct crypto_buffer_cursor *cc) { - switch (cc->cc_type) { - case CRYPTO_BUF_CONTIG: - return (cc->cc_buf_len); - case CRYPTO_BUF_VMPAGE: - return (PAGE_SIZE - cc->cc_offset); - case CRYPTO_BUF_MBUF: - case CRYPTO_BUF_SINGLE_MBUF: - if (cc->cc_mbuf == NULL) - return (0); - if (cc->cc_mbuf->m_flags & M_EXTPG) - return (m_epg_seglen(cc->cc_mbuf, cc->cc_offset)); - return (cc->cc_mbuf->m_len - cc->cc_offset); - case CRYPTO_BUF_UIO: - return (cc->cc_iov->iov_len - cc->cc_offset); - default: -#ifdef INVARIANTS - panic("%s: invalid buffer type %d", __func__, cc->cc_type); -#endif - return (0); - } + size_t len; + + crypto_cursor_segment(cc, &len); + return (len); } void diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index f60f4e63735a..4d9b735366b8 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -726,6 +726,7 @@ size_t crypto_buffer_len(struct crypto_buffer *cb); void crypto_cursor_init(struct crypto_buffer_cursor *cc, const struct crypto_buffer *cb); void crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount); +void *crypto_cursor_segment(struct crypto_buffer_cursor *cc, size_t *len); void *crypto_cursor_segbase(struct crypto_buffer_cursor *cc); size_t crypto_cursor_seglen(struct crypto_buffer_cursor *cc); void crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, diff --git a/sys/sys/param.h b/sys/sys/param.h index 799ba1a9af42..fd177d5a23a1 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300517 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300518 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Thu Oct 21 17:07:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F4BB180753D; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6b5QMxz4hPf; Thu, 21 Oct 2021 17:07:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F2081ED74; Thu, 21 Oct 2021 17:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7FNc080627; Thu, 21 Oct 2021 17:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7FQP080626; Thu, 21 Oct 2021 17:07:15 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:15 GMT Message-Id: <202110211707.19LH7FQP080626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: bb8cda12a9c9 - stable/13 - cryptosoft: Use crypto_cursor_segment(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: bb8cda12a9c99f31b0ae334e0037e2ea07761484 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bb8cda12a9c99f31b0ae334e0037e2ea07761484 commit bb8cda12a9c99f31b0ae334e0037e2ea07761484 Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:51:57 +0000 cryptosoft: Use crypto_cursor_segment(). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30446 (cherry picked from commit 86be314d09bc2857bb63d0a1e34945c63daa0008) --- sys/opencrypto/cryptosoft.c | 107 +++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 61 deletions(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 4040a014881e..9e551ba9652b 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -105,7 +105,8 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) const struct crypto_session_params *csp; struct swcr_encdec *sw; struct enc_xform *exf; - int i, blks, inlen, ivlen, outlen, resid; + size_t inlen, outlen; + int i, blks, ivlen, resid; struct crypto_buffer_cursor cc_in, cc_out; const unsigned char *inblk; unsigned char *outblk; @@ -153,15 +154,13 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inlen = crypto_cursor_seglen(&cc_in); - inblk = crypto_cursor_segbase(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outlen = crypto_cursor_seglen(&cc_out); - outblk = crypto_cursor_segbase(&cc_out); + outblk = crypto_cursor_segment(&cc_out, &outlen); resid = crp->crp_payload_length; encrypting = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); @@ -225,8 +224,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) } if (inlen < blks) { - inlen = crypto_cursor_seglen(&cc_in); - inblk = crypto_cursor_segbase(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, blks); inlen -= blks; @@ -235,8 +233,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) if (outlen < blks) { crypto_cursor_copyback(&cc_out, blks, blk); - outlen = crypto_cursor_seglen(&cc_out); - outblk = crypto_cursor_segbase(&cc_out); + outblk = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, blks); outlen -= blks; @@ -256,17 +253,14 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) __func__, exf->name)); KASSERT(resid < blks, ("%s: partial block too big", __func__)); - inlen = crypto_cursor_seglen(&cc_in); - outlen = crypto_cursor_seglen(&cc_out); + inblk = crypto_cursor_segment(&cc_in, &inlen); + outblk = crypto_cursor_segment(&cc_out, &outlen); if (inlen < resid) { crypto_cursor_copydata(&cc_in, resid, blk); inblk = blk; - } else - inblk = crypto_cursor_segbase(&cc_in); + } if (outlen < resid) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); if (encrypting) exf->encrypt_last(sw->sw_kschedule, inblk, outblk, resid); @@ -397,7 +391,8 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *crp) struct swcr_auth *swa; struct auth_hash *axf; uint32_t *blkp; - int blksz, error, ivlen, len, resid; + size_t len; + int blksz, error, ivlen, resid; swa = &ses->swcr_auth; axf = swa->sw_axf; @@ -415,9 +410,8 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_init(&cc, &crp->crp_buf); crypto_cursor_advance(&cc, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid >= blksz; resid -= len) { - len = crypto_cursor_seglen(&cc); + inblk = crypto_cursor_segment(&cc, &len); if (len >= blksz) { - inblk = crypto_cursor_segbase(&cc); len = rounddown(MIN(len, resid), blksz); crypto_cursor_advance(&cc, len); } else { @@ -477,7 +471,8 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) struct auth_hash *axf; struct enc_xform *exf; uint32_t *blkp; - int blksz, error, ivlen, len, r, resid; + size_t len; + int blksz, error, ivlen, r, resid; swa = &ses->swcr_auth; axf = swa->sw_axf; @@ -518,9 +513,8 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_aad_start); for (resid = crp->crp_aad_length; resid >= blksz; resid -= len) { - len = crypto_cursor_seglen(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &len); if (len >= blksz) { - inblk = crypto_cursor_segbase(&cc_in); len = rounddown(MIN(len, resid), blksz); crypto_cursor_advance(&cc_in, len); } else { @@ -551,18 +545,17 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; } else { - inblk = crypto_cursor_segbase(&cc_in); crypto_cursor_advance(&cc_in, blksz); } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->encrypt(swe->sw_kschedule, inblk, outblk); axf->Update(&ctx, outblk, blksz); if (outblk == blk) @@ -612,17 +605,15 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); @@ -717,6 +708,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) struct swcr_encdec *swe; struct auth_hash *axf; struct enc_xform *exf; + size_t len; int blksz, error, ivlen, r, resid; swa = &ses->swcr_auth; @@ -772,18 +764,16 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); axf->Update(&ctx, inblk, blksz); exf->encrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) @@ -839,17 +829,15 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); @@ -889,6 +877,7 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) struct swcr_encdec *swe; struct auth_hash *axf; struct enc_xform *exf; + size_t len; int blksz, error, r, resid; swa = &ses->swcr_auth; @@ -937,18 +926,16 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->encrypt(swe->sw_kschedule, inblk, outblk); axf->Update(&ctx, outblk, blksz); if (outblk == blk) @@ -1001,17 +988,15 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); From nobody Thu Oct 21 17:07:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C3FA01807465; Thu, 21 Oct 2021 17:07: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv6f1bd3z4hRS; Thu, 21 Oct 2021 17:07:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30CB11EF2F; Thu, 21 Oct 2021 17:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH7HrS080651; Thu, 21 Oct 2021 17:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH7Het080650; Thu, 21 Oct 2021 17:07:17 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:07:17 GMT Message-Id: <202110211707.19LH7Het080650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 757d96ade64c - stable/13 - ossl: Use crypto_cursor_segment(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 757d96ade64c0488512147bcd07117f3b0f9c91c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=757d96ade64c0488512147bcd07117f3b0f9c91c commit 757d96ade64c0488512147bcd07117f3b0f9c91c Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-10-21 15:52:13 +0000 ossl: Use crypto_cursor_segment(). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30447 (cherry picked from commit 1c09320d5833fef8a4b6cc0091883fd47ea1eb1b) --- sys/crypto/openssl/ossl_chacha20.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index 7fa1a297052e..a6f56aca1f8f 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -65,15 +65,13 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -111,16 +109,14 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; @@ -196,15 +192,13 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -243,16 +237,14 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; @@ -368,15 +360,13 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -414,16 +404,14 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; From nobody Thu Oct 21 17:08:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0BD73180A9C2; Thu, 21 Oct 2021 17:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv8T313Bz4jxs; Thu, 21 Oct 2021 17:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD6451ED79; Thu, 21 Oct 2021 17:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH8u4w081045; Thu, 21 Oct 2021 17:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH8ukn081044; Thu, 21 Oct 2021 17:08:56 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:08:56 GMT Message-Id: <202110211708.19LH8ukn081044@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: 96668a81aef7 - main - ktls: Always create a software backend for receive sessions. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 96668a81aef7e9be74386820f1583961eee43ea6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=96668a81aef7e9be74386820f1583961eee43ea6 commit 96668a81aef7e9be74386820f1583961eee43ea6 Author: John Baldwin AuthorDate: 2021-10-21 16:37:17 +0000 Commit: John Baldwin CommitDate: 2021-10-21 16:37:17 +0000 ktls: Always create a software backend for receive sessions. A future change to TOE TLS will require a software fallback for the first few TLS records received. Future support for NIC TLS on receive will also require a software fallback for certain cases. Reviewed by: gallatin, hselasky Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32566 --- sys/kern/uipc_ktls.c | 36 ++++++++++++++++++++++-------------- sys/sys/ktls.h | 6 ++---- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index eb1f8dec8c1e..f97bf9d1117f 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -784,7 +784,6 @@ ktls_cleanup(struct ktls_session *tls) counter_u64_add(ktls_sw_chacha20, -1); break; } - ktls_ocf_free(tls); break; case TCP_TLS_MODE_IFNET: switch (tls->params.cipher_algorithm) { @@ -817,6 +816,8 @@ ktls_cleanup(struct ktls_session *tls) break; #endif } + if (tls->ocf_session != NULL) + ktls_ocf_free(tls); if (tls->params.auth_key != NULL) { zfree(tls->params.auth_key, M_KTLS); tls->params.auth_key = NULL; @@ -1004,14 +1005,9 @@ ktls_try_ifnet(struct socket *so, struct ktls_session *tls, bool force) return (error); } -static int -ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) +static void +ktls_use_sw(struct ktls_session *tls) { - int error; - - error = ktls_ocf_try(so, tls, direction); - if (error) - return (error); tls->mode = TCP_TLS_MODE_SW; switch (tls->params.cipher_algorithm) { case CRYPTO_AES_CBC: @@ -1024,6 +1020,17 @@ ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) counter_u64_add(ktls_sw_chacha20, 1); break; } +} + +static int +ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) +{ + int error; + + error = ktls_ocf_try(so, tls, direction); + if (error) + return (error); + ktls_use_sw(tls); return (0); } @@ -1184,17 +1191,18 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) if (error) return (error); -#ifdef TCP_OFFLOAD - error = ktls_try_toe(so, tls, KTLS_RX); - if (error) -#endif - error = ktls_try_sw(so, tls, KTLS_RX); - + error = ktls_ocf_try(so, tls, KTLS_RX); if (error) { ktls_cleanup(tls); return (error); } +#ifdef TCP_OFFLOAD + error = ktls_try_toe(so, tls, KTLS_RX); + if (error) +#endif + ktls_use_sw(tls); + /* Mark the socket as using TLS offload. */ SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_tls_seqno = be64dec(en->rec_seq); diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index aea13d2d8ce1..a3eac69b5eeb 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -184,10 +184,8 @@ struct ktls_session { const struct tls_record_layer *hdr, struct mbuf *m, uint64_t seqno, int *trailer_len); }; - union { - struct ktls_ocf_session *ocf_session; - struct m_snd_tag *snd_tag; - }; + struct ktls_ocf_session *ocf_session; + struct m_snd_tag *snd_tag; struct tls_session_params params; u_int wq_index; volatile u_int refcount; From nobody Thu Oct 21 17:08:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F6BE180A95F; Thu, 21 Oct 2021 17:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv8S1HQHz4jkC; Thu, 21 Oct 2021 17:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EFD1F211; Thu, 21 Oct 2021 17:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH8thb081021; Thu, 21 Oct 2021 17:08:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH8t0R081020; Thu, 21 Oct 2021 17:08:55 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:08:55 GMT Message-Id: <202110211708.19LH8t0R081020@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: b33ff94123a6 - main - ktls: Change struct ktls_session.cipher to an OCF-specific type. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: b33ff94123a666d0f38541f97f1c64c512f90a56 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b33ff94123a666d0f38541f97f1c64c512f90a56 commit b33ff94123a666d0f38541f97f1c64c512f90a56 Author: John Baldwin AuthorDate: 2021-10-21 16:36:53 +0000 Commit: John Baldwin CommitDate: 2021-10-21 16:36:53 +0000 ktls: Change struct ktls_session.cipher to an OCF-specific type. As a followup to SW KTLS assuming an OCF backend, rename struct ocf_session to struct ktls_ocf_session and forward declare it in to use as the type of struct ktls_session.cipher. Reviewed by: gallatin, hselasky Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32565 --- sys/opencrypto/ktls_ocf.c | 30 +++++++++++++++--------------- sys/sys/ktls.h | 3 ++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index a3b9ab49e4f0..0753f4bafb1a 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -struct ocf_session { +struct ktls_ocf_session { crypto_session_t sid; crypto_session_t mac_sid; struct mtx lock; @@ -64,7 +64,7 @@ struct ocf_session { }; struct ocf_operation { - struct ocf_session *os; + struct ktls_ocf_session *os; bool done; }; @@ -142,7 +142,7 @@ ktls_ocf_callback_async(struct cryptop *crp) } static int -ktls_ocf_dispatch(struct ocf_session *os, struct cryptop *crp) +ktls_ocf_dispatch(struct ktls_ocf_session *os, struct cryptop *crp) { struct ocf_operation oo; int error; @@ -228,7 +228,7 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_mac_data *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; struct iovec iov[m->m_epg_npgs + 2]; u_int pgoff; int i, error; @@ -237,7 +237,7 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_ocf_encrypt_state *state, MPASS(outiovcnt + 1 <= nitems(iov)); - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -376,11 +376,11 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_aead_data *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; int error; uint16_t tls_comp_len; - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -457,12 +457,12 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, { struct tls_aead_data ad; struct cryptop crp; - struct ocf_session *os; + struct ktls_ocf_session *os; struct ocf_operation oo; int error; uint16_t tls_comp_len; - os = tls->cipher; + os = tls->ocf_session; oo.os = os; oo.done = false; @@ -526,11 +526,11 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_aead_data_13 *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; char nonce[12]; int error; - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -598,9 +598,9 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_ocf_encrypt_state *state, void ktls_ocf_free(struct ktls_session *tls) { - struct ocf_session *os; + struct ktls_ocf_session *os; - os = tls->cipher; + os = tls->ocf_session; crypto_freesession(os->sid); mtx_destroy(&os->lock); zfree(os, M_KTLS_OCF); @@ -610,7 +610,7 @@ int ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) { struct crypto_session_params csp, mac_csp; - struct ocf_session *os; + struct ktls_ocf_session *os; int error, mac_len; memset(&csp, 0, sizeof(csp)); @@ -745,7 +745,7 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) } mtx_init(&os->lock, "ktls_ocf", NULL, MTX_DEF); - tls->cipher = os; + tls->ocf_session = os; if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16 || tls->params.cipher_algorithm == CRYPTO_CHACHA20_POLY1305) { if (direction == KTLS_TX) { diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 4258d2c342dc..aea13d2d8ce1 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -167,6 +167,7 @@ struct tls_session_params { #define KTLS_RX 2 struct iovec; +struct ktls_ocf_session; struct ktls_ocf_encrypt_state; struct ktls_session; struct m_snd_tag; @@ -184,7 +185,7 @@ struct ktls_session { uint64_t seqno, int *trailer_len); }; union { - void *cipher; + struct ktls_ocf_session *ocf_session; struct m_snd_tag *snd_tag; }; struct tls_session_params params; From nobody Thu Oct 21 17:08:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E989F180A956; Thu, 21 Oct 2021 17:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv8Q5X8qz4jvY; Thu, 21 Oct 2021 17:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B7F61F20F; Thu, 21 Oct 2021 17:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH8sG6080997; Thu, 21 Oct 2021 17:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH8sDX080996; Thu, 21 Oct 2021 17:08:54 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:08:54 GMT Message-Id: <202110211708.19LH8sDX080996@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: c57dbec69a6c - main - ktls: Add a routine to query information in a receive socket buffer. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: c57dbec69a6cb20098b691b9cd5246f390d83e80 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c57dbec69a6cb20098b691b9cd5246f390d83e80 commit c57dbec69a6cb20098b691b9cd5246f390d83e80 Author: John Baldwin AuthorDate: 2021-10-21 16:36:29 +0000 Commit: John Baldwin CommitDate: 2021-10-21 16:36:29 +0000 ktls: Add a routine to query information in a receive socket buffer. In particular, ktls_pending_rx_info() determines which TLS record is at the end of the current receive socket buffer (including not-yet-decrypted data) along with how much data in that TLS record is not yet present in the socket buffer. This is useful for future changes to support NIC TLS receive offload and enhancements to TOE TLS receive offload. Those use cases need a way to synchronize a state machine on the NIC with the TLS record boundaries in the TCP stream. Reviewed by: gallatin, hselasky Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32564 --- sys/kern/uipc_ktls.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/ktls.h | 1 + 2 files changed, 64 insertions(+) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 1d3321fd4ff6..eb1f8dec8c1e 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1082,6 +1082,69 @@ sb_mark_notready(struct sockbuf *sb) sb->sb_ccc)); } +/* + * Return information about the pending TLS data in a socket + * buffer. On return, 'seqno' is set to the sequence number + * of the next TLS record to be received, 'resid' is set to + * the amount of bytes still needed for the last pending + * record. The function returns 'false' if the last pending + * record contains a partial TLS header. In that case, 'resid' + * is the number of bytes needed to complete the TLS header. + */ +bool +ktls_pending_rx_info(struct sockbuf *sb, uint64_t *seqnop, size_t *residp) +{ + struct tls_record_layer hdr; + struct mbuf *m; + uint64_t seqno; + size_t resid; + u_int offset, record_len; + + SOCKBUF_LOCK_ASSERT(sb); + MPASS(sb->sb_flags & SB_TLS_RX); + seqno = sb->sb_tls_seqno; + resid = sb->sb_tlscc; + m = sb->sb_mtls; + offset = 0; + + if (resid == 0) { + *seqnop = seqno; + *residp = 0; + return (true); + } + + for (;;) { + seqno++; + + if (resid < sizeof(hdr)) { + *seqnop = seqno; + *residp = sizeof(hdr) - resid; + return (false); + } + + m_copydata(m, offset, sizeof(hdr), (void *)&hdr); + + record_len = sizeof(hdr) + ntohs(hdr.tls_length); + if (resid <= record_len) { + *seqnop = seqno; + *residp = record_len - resid; + return (true); + } + resid -= record_len; + + while (record_len != 0) { + if (m->m_len - offset > record_len) { + offset += record_len; + break; + } + + record_len -= (m->m_len - offset); + offset = 0; + m = m->m_next; + } + } +} + int ktls_enable_rx(struct socket *so, struct tls_enable *en) { diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index cd0a786bb345..4258d2c342dc 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -224,6 +224,7 @@ int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls); #ifdef RATELIMIT int ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate); #endif +bool ktls_pending_rx_info(struct sockbuf *sb, uint64_t *seqnop, size_t *residp); static inline struct ktls_session * ktls_hold(struct ktls_session *tls) From nobody Thu Oct 21 17:10:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 51388180DB1A; Thu, 21 Oct 2021 17:10:24 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZvB75754z4l8d; Thu, 21 Oct 2021 17:10:23 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19LHAIug010675 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 21 Oct 2021 10:10:18 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19LHAIVd010674; Thu, 21 Oct 2021 10:10:18 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 21 Oct 2021 10:10:18 -0700 From: Gleb Smirnoff To: Emmanuel Vadot Cc: Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021094000.58097dbece05fcd445aa3d87@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211021094000.58097dbece05fcd445aa3d87@bidouilliste.com> X-Rspamd-Queue-Id: 4HZvB75754z4l8d X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 09:40:00AM +0200, Emmanuel Vadot wrote: E> > E> sane default that most users agrees on in base FreeBSD. If you don't E> > E> agree with the defaults we have a way to change them. E> > E> > To me this looks like abuse of committer priveleges. I got commit bit, E> > so I can change the defaults. E> E> Oh common ... This is not the answer I'd like to hear. :( I'd rather hear why your opinion matters more than for example Slawa's. E> Except that FreeBSD doesn't include drm drivers or graphical env by E> default so the first thing that a user (new or not) have to deal with E> is vt(4). So they will login, do a bunch of command to configure the E> machine and will probably use tab for completion, and what will they E> hear when multiple commands are possible ? The bell. What will they E> hear if they try to go left or right in the shell and arrive at one of E> the ends ? The bell. And they will hear it in a bunch of other E> situation. So the problem is that we are forcing people to go through painful graphics setup, rather than in the bell. E> Again it's clearly user preference and as you can see I really hate E> this bell. I'm sure that more people than the one who answered this E> commit like the bell but the question is do more people wants it on be E> default or not ? E> The non-scientific method that is twitter seems to agree with me E> (https://twitter.com/FreeBSDHelp/status/1450955125002887170). E> So, do we really want to make a poll so users can vote on what to do E> with a freaking bell ??? Well, if you put it like that, I can compose a 100% symmetrical answer: As you see I really LOVE the bell. And I'm looking forward to upgrade my desktop past your commit and expecting my BELOVED bell to be turned off. Just like you, I hate idea of tweaking configuration, I want it ON by default as it used to be from the beginning of times. Unlike Slawa, I got commit bit, so I can go and turn it back on. So, yeah, looks like creating a poll about a precious bell could be a solution of this dispute. -- Gleb Smirnoff From nobody Thu Oct 21 17:16:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D225718120D4 for ; Thu, 21 Oct 2021 17:16:37 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.3 with cipher TLS_AES_256_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 4HZvKJ0kxBz4sJZ for ; Thu, 21 Oct 2021 17:16:35 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1634836589; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=QQTJo8aIpalQhSXqU642oBFeMbU+/MrZuPmYpyYW7T5hioSq9e1nSDXuRi3W/m5FfD3aCUvqtPZX3 wUEVD4vWKQoOm9H5gNudSli8nwwi6zSeu/E1jPcB9+19QTfQvRCaR7wglv4FNbMm2npcP+I0k4s6kG DBGo6O4iBAUvagJchJqfZAbTovNaSQr9j402apOXZ6renKOO6Q54r+r+A+Sw046gYBlvXl+C+oC3tV e8mnMcMJTZiBnMuWCI3e7ufqbfEmvqoVNLUXjTJt+AgoicGSqaJCQ4TNhEuECILLGK2j5bm7zh3mJg 7+gvqy9Te6piIbdyFIQ+TenSuq1uW8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=vU7aKlrLSvToiOF+SnfI/O+VbzkbkF/JstCSuvYTwv8=; b=e03zGjhUDIGqPP5Qv/yo6ObNYXJ1q7XX9hx2ctwm//tG5xUHd/Yp+6OvO3eQIFrSeypg2RAebNWk0 L1clWH56hhhXCNEJGSnAHCyXndIm7E/NNXYoMMQ91p2llDcD3BarnE9IFDbvL33ML0aE4zzcJQxtdl ceYMUbSolKqZZVA9AexBdlzhOvf/c3SLoYt4SowpN9hoJiyihQMlsyikHisgDGCU+dypFN6glFmK4a F2V6WA1Jr7/4gzG9+KJvbLjvdU52feYnvh+lyPmJCco5Cy1a/46KANTr5YWCXK667lzDHf2xBFNOPv 8VHiFWXJWSjMj0wNtZZAR0dqsVvT1xw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=vU7aKlrLSvToiOF+SnfI/O+VbzkbkF/JstCSuvYTwv8=; b=YQOus3qdszRu4W8j+H78NU9Xl9LItSJ1Gz3MsOOs2Ya/6vEWfdZMxOscgHwaTRrsBGy72Vmcw9oYT r/QQ9DMAXF2SGubhHdkiuZYr7lQdhfFaN4B+EeRaJ8MR7c7olTub2ZaaSBRSf6+rbwjNhV5f38PFO6 eGgNBetiqwNfVv+tP1wa7mJfVdLx+lUAgoK48QpaIvoBbdnMDXCMcBWR7PiSApQbZu3ja2BXB3zO4e jb9jmqi7TEFEiYFEnxichUIoxHhb1ye1a2z9LX6umO4j9S3ZNDIO1FLxXbvJAyFLiP1qeb0S4cVJpv wS5OS41gDoDu049W1KbJcqW+ILX8atA== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: 9e3543af-3292-11ec-9e1e-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 9e3543af-3292-11ec-9e1e-bf9d68d023b6; Thu, 21 Oct 2021 17:16:28 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19LHGNfw079281; Thu, 21 Oct 2021 11:16:23 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <5df6d661f6bbc4952398a1c6f1f2d6a36fae2cc2.camel@freebsd.org> Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default From: Ian Lepore To: Gleb Smirnoff , Emmanuel Vadot Cc: Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Date: Thu, 21 Oct 2021 11:16:23 -0600 In-Reply-To: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021094000.58097dbece05fcd445aa3d87@bidouilliste.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HZvKJ0kxBz4sJZ X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:16509, ipnet:54.200.0.0/15, country:US]; local_wl_from(0.00)[freebsd.org] X-ThisMailContainsUnwantedMimeParts: N On Thu, 2021-10-21 at 10:10 -0700, Gleb Smirnoff wrote: > On Thu, Oct 21, 2021 at 09:40:00AM +0200, Emmanuel Vadot wrote: > E> > E> sane default that most users agrees on in base FreeBSD. If > you don't > E> > E> agree with the defaults we have a way to change them. > E> > > E> > To me this looks like abuse of committer priveleges. I got > commit bit, > E> > so I can change the defaults. > E> > E>  Oh common ... > > This is not the answer I'd like to hear. :( > > I'd rather hear why your opinion matters more than for example > Slawa's. > > E>  Except that FreeBSD doesn't include drm drivers or graphical env > by > E> default so the first thing that a user (new or not) have to deal > with > E> is vt(4). So they will login, do a bunch of command to configure > the > E> machine and will probably use tab for completion, and what will > they > E> hear when multiple commands are possible ? The bell. What will > they > E> hear if they try to go left or right in the shell and arrive at > one of > E> the ends ? The bell. And they will hear it in a bunch of other > E> situation. > > So the problem is that we are forcing people to go through painful > graphics setup, rather than in the bell. > > E>  Again it's clearly user preference and as you can see I really > hate > E> this bell. I'm sure that more people than the one who answered > this > E> commit like the bell but the question is do more people wants it > on be > E> default or not ? > E>  The non-scientific method that is twitter seems to agree with me > E> (https://twitter.com/FreeBSDHelp/status/1450955125002887170). > E>  So, do we really want to make a poll so users can vote on what to > do > E> with a freaking bell ??? > > Well, if you put it like that, I can compose a 100% symmetrical > answer: > > As you see I really LOVE the bell. And I'm looking forward to upgrade > my desktop past your commit and expecting my BELOVED bell to be > turned > off. Just like you, I hate idea of tweaking configuration, I want it > ON > by default as it used to be from the beginning of times. Unlike > Slawa, > I got commit bit, so I can go and turn it back on. > > So, yeah, looks like creating a poll about a precious bell could be a > solution of this dispute. > I can't believe this conversation is still going on. It's not 1983 anymore. We don't use TTY devices that simply stop and overwrite the last position on a line repeatedly if you write too many characters without a return, so we don't need an audible alarm to warn us of that condition. I agree 100% with whoever said earlier something like: POLA cannot be a reason for blocking every change. This change makes sense in the modern world. For the few people (and I'm sure it is a VERY few people) left who like the noise, there is an option to keep hearing it. Can we just move on? -- Ian From nobody Thu Oct 21 17:20:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5FADC1813FD7; Thu, 21 Oct 2021 17:20:27 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZvPk064Rz3DJ8; Thu, 21 Oct 2021 17:20:25 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x531.google.com with SMTP id w14so3930241edv.11; Thu, 21 Oct 2021 10:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=vvKaL823Ach/szHN3EIWTQ+FXeQJXnfZihlB5cTWU7Y=; b=BwuTKb29bFAJ71Md6qOSGrjvGZK5QS+gJEXskWKT2o9MA8db6P81crRh5tvps1bR2/ JQIiHmxwfTA8UqOSKiKJAEuPIdi4ZK6WjyViCvFuYfOHMR7U5qXCB8z9p35QYQHsueBA Dme/AQiW200KGCa9my8PbD4J4bWLhUe39vC1liyza5aphyDVM++v3a4hDkwN/iGGSC9g vNGMye3sIWiqxYIYvskLVsn6m95LXGz0m6D56PLW8NOa5R7UiQjuqyZ4C9MDVZP9FedA 1Fa3w1fIdqqotaXZVRYEcLtKyCizvSHnz3/FSadD9R49MqcBzZzB7bS3ttMnXKPFrUJa gnRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=vvKaL823Ach/szHN3EIWTQ+FXeQJXnfZihlB5cTWU7Y=; b=buLt+c7pUuALwT9J/6XvOfZU8TY3ijvtQHg72UcW55fpMWlERkRn2Us16vbX+Tdh1x TpkaZnHaLzbBS5W8zp4g+uJ/BChsflakCKPrKiOMvliAZAXTtObyWLCsKXqme4/5LMUK 8wPNB5p3yFmHFi7qfw5RO+9ze6SSCmzPxA7C2wjlKDTF9q0f4jZjnuEiVmHH9+MzwqPN rNRDcBa6U+AAeTFfW2SJZmVfgV2CPOHCFGf/gLG12RiLGgq8nEaAA3+DFXwh3EXDMVrd YL9ofi8ki2X1ox1axb6b/vHutcOhjqgOXPoqWsmt8q0p7PfdoRoc8A6Q74EUdJo6p6k9 C+bQ== X-Gm-Message-State: AOAM533DXIJtzopeuAP2PwVfzj2d142GyMtjENxKmR+xd9KsahlBJtpr aULts7fjoAdn1yuUxvDjxyNhXy3x114= X-Google-Smtp-Source: ABdhPJzTZMCqYxA4le4VqA5UmPZp6q7cMRGu/I8CIpELNz7mF3kR/Eq86bEh1mZuhJADlXguJm96iw== X-Received: by 2002:a17:907:da8:: with SMTP id go40mr8829532ejc.240.1634836822652; Thu, 21 Oct 2021 10:20:22 -0700 (PDT) Received: from ernst.home (p5b3becad.dip0.t-ipconnect.de. [91.59.236.173]) by smtp.gmail.com with ESMTPSA id a1sm3152978edu.43.2021.10.21.10.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 10:20:22 -0700 (PDT) Date: Thu, 21 Oct 2021 19:20:20 +0200 From: Gary Jennejohn To: Gleb Smirnoff Cc: Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211021192020.6dcb95c1@ernst.home> In-Reply-To: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HZvPk064Rz3DJ8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, 21 Oct 2021 10:03:05 -0700 Gleb Smirnoff wrote: > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > S> > S> This change disable bell in X11 too. > S> This is completly disable speaker bell. > > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. > How is that possible that vt(4) affects X11? > He could be right. I don't use vt, but syscons also has a bell setting: sysctl -d hw.syscons.bell hw.syscons.bell: enable bell With this set to 1 a ^G in xterm results in a beep. After setting the sysctl to 0 a ^G in xterm produces no sound at all. -- Gary Jennejohn From nobody Thu Oct 21 17:56:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 339451803494; Thu, 21 Oct 2021 17:56:33 +0000 (UTC) (envelope-from jkim@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZwCP0xXmz3PVs; Thu, 21 Oct 2021 17:56:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id D3BBC2727D; Thu, 21 Oct 2021 17:56:32 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <23455738-85b6-604d-de67-157474811248@FreeBSD.org> Date: Thu, 21 Oct 2021 13:56:32 -0400 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Content-Language: en-US To: gljennjohn@gmail.com, Gleb Smirnoff Cc: Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <20211021192020.6dcb95c1@ernst.home> From: Jung-uk Kim Organization: FreeBSD.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default In-Reply-To: <20211021192020.6dcb95c1@ernst.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 21. 10. 21., Gary Jennejohn wrote: > On Thu, 21 Oct 2021 10:03:05 -0700 > Gleb Smirnoff wrote: > >> On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: >> S> > laptops. If somebody is using vt(4) instead of X on a laptop, then >> S> >> S> This change disable bell in X11 too. >> S> This is completly disable speaker bell. >> >> Are you sure? I haven't yet upgraded my desktop to this point, so can't test. >> How is that possible that vt(4) affects X11? >> > > He could be right. I don't use vt, but syscons also has a bell setting: > sysctl -d hw.syscons.bell hw.syscons.bell: enable bell > > With this set to 1 a ^G in xterm results in a beep. After setting the > sysctl to 0 a ^G in xterm produces no sound at all. FYI, Xorg server beeps via xf86OSRingBell(), i.e., https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xfree86/os-support/bsd/bsd_bell.c#L61 IOW, if console cannot beep, xterm does not beep. Jung-uk Kim From nobody Thu Oct 21 18:41:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C1B1E18172AD; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCL56YBz3s7q; Thu, 21 Oct 2021 18:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FACB20325; Thu, 21 Oct 2021 18:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfYWt010298; Thu, 21 Oct 2021 18:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfYBU010297; Thu, 21 Oct 2021 18:41:34 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:34 GMT Message-Id: <202110211841.19LIfYBU010297@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: 2030ee0e1b17 - main - ufs: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2030ee0e1b17e45a162bba6a636e07886a9eb67c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2030ee0e1b17e45a162bba6a636e07886a9eb67c commit 2030ee0e1b17e45a162bba6a636e07886a9eb67c Author: Konstantin Belousov AuthorDate: 2021-10-20 01:42:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 ufs: remove write-only variables Mark variables as __diagused for invariant-only vars Reviewed by: imp, mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32577 --- sys/ufs/ffs/ffs_inode.c | 6 ++---- sys/ufs/ffs/ffs_softdep.c | 12 ++++-------- sys/ufs/ffs/ffs_vfsops.c | 5 ++--- sys/ufs/ffs/ffs_vnops.c | 4 ---- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 17a9dceeb654..4b31b4febcbd 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -244,8 +244,8 @@ ffs_truncate(vp, length, flags, cred) ufs2_daddr_t bn, lbn, lastblock, lastiblock[UFS_NIADDR]; ufs2_daddr_t indir_lbn[UFS_NIADDR], oldblks[UFS_NDADDR + UFS_NIADDR]; ufs2_daddr_t newblks[UFS_NDADDR + UFS_NIADDR]; - ufs2_daddr_t count, blocksreleased = 0, datablocks, blkno; - struct bufobj *bo; + ufs2_daddr_t count, blocksreleased = 0, blkno; + struct bufobj *bo __diagused; struct fs *fs; struct buf *bp; struct ufsmount *ump; @@ -297,10 +297,8 @@ ffs_truncate(vp, length, flags, cred) if (journaltrunc == 0 && DOINGSOFTDEP(vp) && length == 0) softdeptrunc = !softdep_slowdown(vp); extblocks = 0; - datablocks = DIP(ip, i_blocks); if (fs->fs_magic == FS_UFS2_MAGIC && ip->i_din2->di_extsize > 0) { extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); - datablocks -= extblocks; } if ((flags & IO_EXT) && extblocks > 0) { if (length != 0) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index ff55a918ade5..969f7554dd0a 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -5064,7 +5064,7 @@ softdep_setup_create(dp, ip) struct inode *ip; { struct inodedep *inodedep; - struct jaddref *jaddref; + struct jaddref *jaddref __diagused; struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, @@ -5205,11 +5205,9 @@ softdep_setup_rmdir(dp, ip) struct inode *dp; struct inode *ip; { - struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, ("softdep_setup_rmdir called on non-softdep filesystem")); - dvp = ITOV(dp); ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); @@ -5225,11 +5223,9 @@ softdep_setup_unlink(dp, ip) struct inode *dp; struct inode *ip; { - struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, ("softdep_setup_unlink called on non-softdep filesystem")); - dvp = ITOV(dp); ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); @@ -6424,7 +6420,7 @@ setup_allocindir_phase2(bp, ip, inodedep, aip, lbn) struct allocindir *aip; /* allocindir allocated by the above routines */ ufs_lbn_t lbn; /* Logical block number for this block. */ { - struct fs *fs; + struct fs *fs __diagused; struct indirdep *indirdep; struct allocindir *oldaip; struct freefrag *freefrag; @@ -10626,7 +10622,7 @@ initiate_write_inodeblock_ufs1(inodedep, bp) #ifdef INVARIANTS ufs_lbn_t prevlbn = 0; #endif - int deplist; + int deplist __diagused; if (inodedep->id_state & IOSTARTED) panic("initiate_write_inodeblock_ufs1: already started"); @@ -10798,7 +10794,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp) #ifdef INVARIANTS ufs_lbn_t prevlbn = 0; #endif - int deplist; + int deplist __diagused; if (inodedep->id_state & IOSTARTED) panic("initiate_write_inodeblock_ufs2: already started"); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 94afcae05ba6..d1773402002e 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -347,7 +347,8 @@ ffs_mount(struct mount *mp) struct thread *td; struct ufsmount *ump = NULL; struct fs *fs; - int error, error1, flags; + int error, flags; + int error1 __diagused; uint64_t mntorflags, saved_mnt_flag; accmode_t accmode; struct nameidata ndp; @@ -1613,11 +1614,9 @@ ffs_sync_lazy(mp) { struct vnode *mvp, *vp; struct inode *ip; - struct thread *td; int allerror, error; allerror = 0; - td = curthread; if ((mp->mnt_flag & MNT_NOATIME) != 0) { #ifdef QUOTA qsync(mp); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index a1657db9ece2..24bb39a3d48f 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1399,7 +1399,6 @@ static int ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) { struct inode *ip; - struct ufs2_dinode *dp; int error; ip = VTOI(vp); @@ -1410,7 +1409,6 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) ffs_unlock_ea(vp); return (0); } - dp = ip->i_din2; error = ffs_rdextattr(&ip->i_ea_area, vp, td); if (error) { ffs_unlock_ea(vp); @@ -1994,7 +1992,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) struct inode *dp, *ip; ino_t ip_ino; u_int64_t ip_gen; - off_t old_size; int error, vp_locked; dvp = ap->a_dvp; @@ -2031,7 +2028,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) VNASSERT(I_ENDOFF(dp) != 0 && I_ENDOFF(dp) < dp->i_size, dvp, ("IN_ENDOFF set but I_ENDOFF() is not")); dp->i_flag &= ~IN_ENDOFF; - old_size = dp->i_size; error = UFS_TRUNCATE(dvp, (off_t)I_ENDOFF(dp), IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), curthread->td_ucred); if (error != 0 && error != ERELOOKUP) { From nobody Thu Oct 21 18:41:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2541A181717A; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCM6r7qz3sJr; Thu, 21 Oct 2021 18:41:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B49B12016C; Thu, 21 Oct 2021 18:41:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfZ1U010328; Thu, 21 Oct 2021 18:41:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfZCD010327; Thu, 21 Oct 2021 18:41:35 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:35 GMT Message-Id: <202110211841.19LIfZCD010327@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: bded8fa3009a - main - umtxq_requeue: remove write-only variable uh2 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bded8fa3009aa76c4a8255ebe884cff44cc6142c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bded8fa3009aa76c4a8255ebe884cff44cc6142c commit bded8fa3009aa76c4a8255ebe884cff44cc6142c Author: Konstantin Belousov AuthorDate: 2021-10-21 17:10:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 umtxq_requeue: remove write-only variable uh2 umtxq_queue_lookup() does not change state. It is redone inside umtxq_insert() later, anyway. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_umtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index ea87259161c8..c738cf178866 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -641,7 +641,7 @@ int umtxq_requeue(struct umtx_key *key, int n_wake, struct umtx_key *key2, int n_requeue) { - struct umtxq_queue *uh, *uh2; + struct umtxq_queue *uh; struct umtx_q *uq, *uq_temp; int ret; @@ -649,7 +649,6 @@ umtxq_requeue(struct umtx_key *key, int n_wake, struct umtx_key *key2, UMTXQ_LOCKED_ASSERT(umtxq_getchain(key)); UMTXQ_LOCKED_ASSERT(umtxq_getchain(key2)); uh = umtxq_queue_lookup(key, UMTX_SHARED_QUEUE); - uh2 = umtxq_queue_lookup(key2, UMTX_SHARED_QUEUE); if (uh == NULL) return (0); TAILQ_FOREACH_SAFE(uq, &uh->head, uq_link, uq_temp) { From nobody Thu Oct 21 18:41:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 693131817444; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCP0870z3sK4; Thu, 21 Oct 2021 18:41:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D339220526; Thu, 21 Oct 2021 18:41:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfa0G010352; Thu, 21 Oct 2021 18:41:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfaAJ010351; Thu, 21 Oct 2021 18:41:36 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:36 GMT Message-Id: <202110211841.19LIfaAJ010351@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: 661bd70bd72d - main - DMAR: clean up warnings about write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 661bd70bd72d510ad7153df530d55a300046d619 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=661bd70bd72d510ad7153df530d55a300046d619 commit 661bd70bd72d510ad7153df530d55a300046d619 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:23:45 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 DMAR: clean up warnings about write-only variables For some of them, used only when KTR or KMSAN are configured, apply __unused attribute directly. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/iommu/busdma_iommu.c | 5 +++-- sys/dev/iommu/iommu_gas.c | 4 ++-- sys/x86/iommu/intel_ctx.c | 4 ++-- sys/x86/iommu/intel_drv.c | 2 -- sys/x86/iommu/intel_idpgtbl.c | 3 +-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index 75835d7484e5..d32beee19be7 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -398,7 +398,8 @@ iommu_bus_dma_tag_set_domain(bus_dma_tag_t dmat) static int iommu_bus_dma_tag_destroy(bus_dma_tag_t dmat1) { - struct bus_dma_tag_iommu *dmat, *dmat_copy, *parent; + struct bus_dma_tag_iommu *dmat, *parent; + struct bus_dma_tag_iommu *dmat_copy __unused; int error; error = 0; @@ -920,7 +921,7 @@ static void iommu_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map1, bus_dmasync_op_t op) { - struct bus_dmamap_iommu *map; + struct bus_dmamap_iommu *map __unused; map = (struct bus_dmamap_iommu *)map1; kmsan_bus_dmamap_sync(&map->kmsan_mem, op); diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index ae54f41953c8..c4faebec9d08 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -354,7 +354,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg, static void iommu_gas_match_insert(struct iommu_gas_match_args *a) { - bool found; + bool found __diagused; /* * The prev->end is always aligned on the page size, which @@ -475,7 +475,7 @@ iommu_gas_alloc_region(struct iommu_domain *domain, struct iommu_map_entry *entr u_int flags) { struct iommu_map_entry *next, *prev; - bool found; + bool found __diagused; IOMMU_DOMAIN_ASSERT_LOCKED(domain); diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index dc8ee4e2f9a2..34730306000b 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -521,7 +521,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid, { struct dmar_domain *domain, *domain1; struct dmar_ctx *ctx, *ctx1; - struct iommu_unit *unit; + struct iommu_unit *unit __diagused; dmar_ctx_entry_t *ctxp; struct sf_buf *sf; int bus, slot, func, error; @@ -904,7 +904,7 @@ dmar_domain_unload(struct dmar_domain *domain, struct dmar_unit *unit; struct iommu_domain *iodom; struct iommu_map_entry *entry, *entry1; - int error; + int error __diagused; iodom = DOM2IODOM(domain); unit = DOM2DMAR(domain); diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index a19084eb3e66..0b470d7bbf7a 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -762,7 +762,6 @@ dmar_find_by_scope(int dev_domain, int dev_busno, struct dmar_unit * dmar_find(device_t dev, bool verbose) { - device_t dmar_dev; struct dmar_unit *unit; const char *banner; int i, dev_domain, dev_busno, dev_path_len; @@ -774,7 +773,6 @@ dmar_find(device_t dev, bool verbose) devclass_find("pci")) return (NULL); - dmar_dev = NULL; dev_domain = pci_get_domain(dev); dev_path_len = dmar_dev_depth(dev); ACPI_DMAR_PCI_PATH dev_path[dev_path_len]; diff --git a/sys/x86/iommu/intel_idpgtbl.c b/sys/x86/iommu/intel_idpgtbl.c index 2346640ce015..be421fee7aa9 100644 --- a/sys/x86/iommu/intel_idpgtbl.c +++ b/sys/x86/iommu/intel_idpgtbl.c @@ -425,7 +425,7 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base, { dmar_pte_t *pte; struct sf_buf *sf; - iommu_gaddr_t pg_sz, base1, size1; + iommu_gaddr_t pg_sz, base1; vm_pindex_t pi, c, idx, run_sz; int lvl; bool superpage; @@ -433,7 +433,6 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base, DMAR_DOMAIN_ASSERT_PGLOCKED(domain); base1 = base; - size1 = size; flags |= IOMMU_PGF_OBJL; TD_PREP_PINNED_ASSERT; From nobody Thu Oct 21 18:41:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 23370181751D; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCQ2VNZz3sPk; Thu, 21 Oct 2021 18:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0121B203A7; Thu, 21 Oct 2021 18:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfbuF010376; Thu, 21 Oct 2021 18:41:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfbev010375; Thu, 21 Oct 2021 18:41:37 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:37 GMT Message-Id: <202110211841.19LIfbev010375@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: 993446638ce7 - main - alq_open_flags(): mark local td variable as unused List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 993446638ce701109d29c520b85d7ca31b5c5fe8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=993446638ce701109d29c520b85d7ca31b5c5fe8 commit 993446638ce701109d29c520b85d7ca31b5c5fe8 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:39:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 alq_open_flags(): mark local td variable as unused It is passed to the NDINIT() macro which ignores the thread argument for some time. Sponsored by: The FreeBSD Foundation --- sys/kern/kern_alq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 6db4ab300828..4b30e519d335 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -431,7 +431,7 @@ int alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode, int size, int flags) { - struct thread *td; + struct thread *td __unused; struct nameidata nd; struct alq *alq; int oflags; From nobody Thu Oct 21 18:41:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 96DBC1817259; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCS0ffYz3s8M; Thu, 21 Oct 2021 18:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 187C1205B1; Thu, 21 Oct 2021 18:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfddO010400; Thu, 21 Oct 2021 18:41:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfdAc010399; Thu, 21 Oct 2021 18:41:39 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:39 GMT Message-Id: <202110211841.19LIfdAc010399@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: 6776747a0e0b - main - subr_firmware.c::unloadentry(): remote write-only variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6776747a0e0b1c0e3fb916685ac2180ca4ce2f3d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6776747a0e0b1c0e3fb916685ac2180ca4ce2f3d commit 6776747a0e0b1c0e3fb916685ac2180ca4ce2f3d Author: Konstantin Belousov AuthorDate: 2021-10-21 17:40:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 subr_firmware.c::unloadentry(): remote write-only variable The function ignores result returned by linker_release_module(). The FW_UNLOAD flag on the file is cleared, so even on error it would not be tried again. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/subr_firmware.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/subr_firmware.c b/sys/kern/subr_firmware.c index 0465f2a88483..aafb2a2ba265 100644 --- a/sys/kern/subr_firmware.c +++ b/sys/kern/subr_firmware.c @@ -412,7 +412,6 @@ static void unloadentry(void *unused1, int unused2) { struct priv_fw *fp; - int err; mtx_lock(&firmware_mtx); restart: @@ -434,7 +433,7 @@ restart: * on unload to actually free the entry. */ mtx_unlock(&firmware_mtx); - err = linker_release_module(NULL, NULL, fp->file); + (void)linker_release_module(NULL, NULL, fp->file); mtx_lock(&firmware_mtx); /* From nobody Thu Oct 21 18:41:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 713D318173C4; Thu, 21 Oct 2021 18:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCS5TB7z3sKZ; Thu, 21 Oct 2021 18:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47E50205B2; Thu, 21 Oct 2021 18:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfeZE010424; Thu, 21 Oct 2021 18:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIfeua010423; Thu, 21 Oct 2021 18:41:40 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:40 GMT Message-Id: <202110211841.19LIfeua010423@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: 3d2778515aa4 - main - sig_ast_checksusp(): mark the local p as __diagused List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d2778515aa4748f5d561a282d44c7a8c8acfe35 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2778515aa4748f5d561a282d44c7a8c8acfe35 commit 3d2778515aa4748f5d561a282d44c7a8c8acfe35 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:43:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 sig_ast_checksusp(): mark the local p as __diagused It is only used to assert that the (current) process is locked Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index d6826e8dc507..15d509eca52d 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3262,7 +3262,7 @@ postsig(int sig) int sig_ast_checksusp(struct thread *td) { - struct proc *p; + struct proc *p __diagused; int ret; p = td->td_proc; From nobody Thu Oct 21 18:41:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BD6E518174E3; Thu, 21 Oct 2021 18:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxCV6bYvz3sFq; Thu, 21 Oct 2021 18:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D31620256; Thu, 21 Oct 2021 18:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LIfffP010448; Thu, 21 Oct 2021 18:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LIffSI010447; Thu, 21 Oct 2021 18:41:41 GMT (envelope-from git) Date: Thu, 21 Oct 2021 18:41:41 GMT Message-Id: <202110211841.19LIffSI010447@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: 3b5331dd8d41 - main - uipc_shm: silent warnings about write-only variables in largepage code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b5331dd8d413807cf1d6cb26630ccf9028168e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3b5331dd8d413807cf1d6cb26630ccf9028168e6 commit 3b5331dd8d413807cf1d6cb26630ccf9028168e6 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:46:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-21 18:40:46 +0000 uipc_shm: silent warnings about write-only variables in largepage code In shm_largepage_phys_populate(), the result from vm_page_grab() is only needed for assertion. In shm_dotruncate_largepage(), there is a commented-out prototype code for managed largepages. The oldobjsz is saved for its sake, so mark the variable as __unused directly. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/uipc_shm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 14d808bfc166..6fb083498e18 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -267,7 +267,7 @@ static int shm_largepage_phys_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) { - vm_page_t m; + vm_page_t m __diagused; int psind; psind = object->un_pager.phys.data_val; @@ -751,7 +751,8 @@ shm_dotruncate_largepage(struct shmfd *shmfd, off_t length, void *rl_cookie) { vm_object_t object; vm_page_t m; - vm_pindex_t newobjsz, oldobjsz; + vm_pindex_t newobjsz; + vm_pindex_t oldobjsz __unused; int aflags, error, i, psind, try; KASSERT(length >= 0, ("shm_dotruncate: length < 0")); From nobody Thu Oct 21 18:58:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A68CD17F1473; Thu, 21 Oct 2021 18:59:17 +0000 (UTC) (envelope-from wulf@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZxbn3WmCz4Wtd; Thu, 21 Oct 2021 18:59:17 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from [192.168.0.30] (unknown [176.120.247.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: wulf) by smtp.freebsd.org (Postfix) with ESMTPSA id 693FB2857D; Thu, 21 Oct 2021 18:59:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) To: Gleb Smirnoff , Slawa Olhovchenkov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> From: Vladimir Kondratyev Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> Date: Thu, 21 Oct 2021 21:58:31 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-ThisMailContainsUnwantedMimeParts: N On 21.10.2021 20:03, Gleb Smirnoff wrote: > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then= > S>=20 > S> This change disable bell in X11 too. > S> This is completly disable speaker bell. > > Are you sure? I haven't yet upgraded my desktop to this point, so can't= test. > How is that possible that vt(4) affects X11? > pre-evdev X11 got keyboard input from tty subsystem and post-evdev X11 still affected by it. We have local X11 patch which disables bell on ttyv8, otherwise you'll hear annoying sound as soon as tty buffer get filled up. But you have to have custom X11 build to hear bell under X11 --=20 WBR Vladimir Kondratyev From nobody Thu Oct 21 19:24:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B438918044A2; Thu, 21 Oct 2021 19:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZy8T4jPpz4fqn; Thu, 21 Oct 2021 19:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 812D320AE1; Thu, 21 Oct 2021 19:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LJO9UE066276; Thu, 21 Oct 2021 19:24:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LJO9j5066275; Thu, 21 Oct 2021 19:24:09 GMT (envelope-from git) Date: Thu, 21 Oct 2021 19:24:09 GMT Message-Id: <202110211924.19LJO9j5066275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: d677560dd071 - main - arswitch(4): Hook new manpage to build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d677560dd0711d49ab00c6c54a017cca581e15c0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d677560dd0711d49ab00c6c54a017cca581e15c0 commit d677560dd0711d49ab00c6c54a017cca581e15c0 Author: Guangyuan Yang AuthorDate: 2021-10-21 19:22:34 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-21 19:23:48 +0000 arswitch(4): Hook new manpage to build PR: 211668 Fixes: 262717e270c3e8a28fa2937db750ba946be8c836 Reported by: jhb --- share/man/man4/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 421de8728a05..af3ad94c9e2e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -50,6 +50,7 @@ MAN= aac.4 \ ${_aout.4} \ ${_apic.4} \ arcmsr.4 \ + arswitch.4 \ ${_asmc.4} \ at45d.4 \ ata.4 \ From nobody Thu Oct 21 19:25:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9E6321805D5D; Thu, 21 Oct 2021 19:25:38 +0000 (UTC) (envelope-from ygy@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZyBB3nhtz4h0h; Thu, 21 Oct 2021 19:25:38 +0000 (UTC) (envelope-from ygy@freebsd.org) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: ygy) by smtp.freebsd.org (Postfix) with ESMTPSA id 5D35B28A80; Thu, 21 Oct 2021 19:25:38 +0000 (UTC) (envelope-from ygy@freebsd.org) Received: by mail-wm1-f44.google.com with SMTP id y22-20020a1c7d16000000b003231ea3d705so787365wmc.4; Thu, 21 Oct 2021 12:25:38 -0700 (PDT) X-Gm-Message-State: AOAM530Zq6iYRS/p/wFdmNuhDRnjsIJgJg3CImBUBl3jigKmP2XAX6Yj sByzaW9OQkjUA8hLxwE5KOOjVjwCg7+IhToB4k0= X-Google-Smtp-Source: ABdhPJx9yrDNITWKLXty2ZV9utZkKEy01oQxw8tEsvWQwj/JdIlP7pJ9mgDzwibED0Y/23TWZ7H/op/hlbZAwpc+go4= X-Received: by 2002:a1c:2246:: with SMTP id i67mr23922716wmi.72.1634844337211; Thu, 21 Oct 2021 12:25:37 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110200335.19K3ZdfS070860@gitrepo.freebsd.org> <35663cb8-bddb-e108-48f8-9d09a2b2345d@FreeBSD.org> In-Reply-To: <35663cb8-bddb-e108-48f8-9d09a2b2345d@FreeBSD.org> From: Guangyuan Yang Date: Thu, 21 Oct 2021 15:25:26 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 262717e270c3 - main - arswitch(4): Add new manpage To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N John Baldwin =E4=BA=8E2021=E5=B9=B410=E6=9C=8820=E6=97=A5= =E5=91=A8=E4=B8=89 =E4=B8=8A=E5=8D=8811:59=E5=86=99=E9=81=93=EF=BC=9A > > On 10/19/21 8:35 PM, Guangyuan Yang wrote: > > The branch main has been updated by ygy (doc, ports committer): > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D262717e270c3e8a28fa2937d= b750ba946be8c836 > > > > commit 262717e270c3e8a28fa2937db750ba946be8c836 > > Author: Felix Johnson > > AuthorDate: 2021-10-20 03:29:11 +0000 > > Commit: Guangyuan Yang > > CommitDate: 2021-10-20 03:35:04 +0000 > > > > arswitch(4): Add new manpage > > > > PR: 211668 > > Reported by: O. Hartmann > > Reviewed by: adrian, debdrup, imp > > Differential Revision: https://reviews.freebsd.org/D32476 > > --- > > share/man/man4/arswitch.4 | 91 ++++++++++++++++++++++++++++++++++++++= +++++++++ > > 1 file changed, 91 insertions(+) > > Do you need to add this to the Makefile so it is installed? > My bad. Fixed in https://cgit.freebsd.org/src/commit/?id=3Dd677560dd0711d49ab00c6c54a017cca5= 81e15c0. Thank you! --=20 Guangyuan Yang ygy@FreeBSD.org From nobody Thu Oct 21 19:52:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ADB661812A3F for ; Thu, 21 Oct 2021 19:52:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZynR5F7Vz4pk8 for ; Thu, 21 Oct 2021 19:52:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92b.google.com with SMTP id h4so3490610uaw.1 for ; Thu, 21 Oct 2021 12:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:cc; bh=ICc5wgmrnOMCHNvrmYZsE1ybluZ6cen2ce4HR2sjgi4=; b=FDeL0VWjoFpr0NQ+AYi1//vh9bNaR3tD5jxgAVVAiW5if1U9h1Ce7BVHR/DxxJcj94 3XfUFThSJi7emMT4lwLRYUguNk6axcVB4o7ALinQenLvJceaFfm3CNcJZO8Ic/alO/hJ /azgYMiOG165zt/x2nFEO4a9g3H2BRUiJqa3t/WUegMlm2YyRWZWSXGs0z0AvFGtaoTf DpGxesRzeg0nqfHw/6ibpZNXVKMpl2wbXHA64yIJ/GLP67aRNHGQOo2VBU5ETO25KA3L DMciMdCcsGrqCKZHUcBTc3cUhNAxRu5aOA0wUpF01EUSIqgkxsZwPXBDVOFAMj8r6vni ojIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:cc; bh=ICc5wgmrnOMCHNvrmYZsE1ybluZ6cen2ce4HR2sjgi4=; b=WftM50Z38gOnR6YOrCg1ebpu5rmo2rXW9ivKKyuzx8kpNJUcWA40kagDlJcw7s1Qt2 2a5bezlmfdZiF5C4ir/vjo8DrRuRohHCvkZkwv4/UbYlqQ+IohCCS9hUFI1igCaT5ufV Yph1kgsB4j8nFwrjUjuqa/uEVcteyaNVldVvhmTQo9Y34rPXpRyOmjB55HTdRskbf4mQ 69hom4oHjgFPvxavygxSEqtx2VfaV2yWO9DZigjaw3HK9dcD7t9Eund3KtzqgkGzAP9j OE3MPh468butZmE3aBUR6Ioui0/W0vqstwj3LsJgj9ooefFLjcjfNwfojJqhgSWqwbar Hyog== X-Gm-Message-State: AOAM531WZsySt7B9WSMYhdJszYBtgxrowTBC7DjTBUjehP4snO6kKDvJ dpsrMIZpL2M6+pkYNbmceC4EdpfqHjCRtZCtaMAxdg== X-Received: by 2002:a9f:2c97:: with SMTP id w23mt4139946uaj.69.1634845957055; Thu, 21 Oct 2021 12:52:37 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> In-Reply-To: <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> From: Warner Losh Date: Thu, 21 Oct 2021 13:52:26 -0600 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000089c35d05cee23c21" X-Rspamd-Queue-Id: 4HZynR5F7Vz4pk8 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=FDeL0VWj; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::92b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-0.33 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; NEURAL_HAM_LONG(-0.33)[-0.331]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::92b:from]; MISSING_TO(2.00)[]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --00000000000089c35d05cee23c21 Content-Type: text/plain; charset="UTF-8" This discussion to date has been data free. I created a poll... https://twitter.com/bsdimp/status/1451274644439265308 On Thu, Oct 21, 2021 at 12:59 PM Vladimir Kondratyev wrote: > On 21.10.2021 20:03, Gleb Smirnoff wrote: > > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > > S> > > S> This change disable bell in X11 too. > > S> This is completly disable speaker bell. > > > > Are you sure? I haven't yet upgraded my desktop to this point, so can't > test. > > How is that possible that vt(4) affects X11? > > > pre-evdev X11 got keyboard input from tty subsystem > > and post-evdev X11 still affected by it. We have local X11 patch which > disables bell on ttyv8, otherwise you'll hear annoying sound as soon as > tty buffer get filled up. > > But you have to have custom X11 build to hear bell under X11 > > -- > WBR > Vladimir Kondratyev > > > --00000000000089c35d05cee23c21-- From nobody Thu Oct 21 20:18:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 081D6181AAFE; Thu, 21 Oct 2021 20:18:10 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZzLn61Hvz4v3N; Thu, 21 Oct 2021 20:18:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mdeVp-000MxJ-K8; Thu, 21 Oct 2021 23:18:05 +0300 Date: Thu, 21 Oct 2021 23:18:05 +0300 From: Slawa Olhovchenkov To: Gleb Smirnoff Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211021201804.GY33191@zxy.spb.ru> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HZzLn61Hvz4v3N X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 10:03:05AM -0700, Gleb Smirnoff wrote: > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > S> > S> This change disable bell in X11 too. > S> This is completly disable speaker bell. > > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. You don't need to any upgrade. Just do `sysctl kern.vt.enable_bell=0` > How is that possible that vt(4) affects X11? MB bell controlled by vt(4) Any ^G from X11 routed to MB speeker (vt bell). From nobody Thu Oct 21 20:18:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9723E181ADA2; Thu, 21 Oct 2021 20:18: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZzLv2Rlvz4tv5; Thu, 21 Oct 2021 20:18:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA25021460; Thu, 21 Oct 2021 20:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LKIExQ033623; Thu, 21 Oct 2021 20:18:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LKIE8E033622; Thu, 21 Oct 2021 20:18:14 GMT (envelope-from git) Date: Thu, 21 Oct 2021 20:18:14 GMT Message-Id: <202110212018.19LKIE8E033622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 6fa58bfb3ecf - main - uefi(8): loader.efi does not search for loader.efi List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fa58bfb3ecfad4aece948fd7e6a8ca3d60a18c2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=6fa58bfb3ecfad4aece948fd7e6a8ca3d60a18c2 commit 6fa58bfb3ecfad4aece948fd7e6a8ca3d60a18c2 Author: Colin Percival AuthorDate: 2021-10-21 20:15:57 +0000 Commit: Colin Percival CommitDate: 2021-10-21 20:17:33 +0000 uefi(8): loader.efi does not search for loader.efi This man page formerly referred to boot1.efi searching for loader.efi; when boot1.efi was obsoleted in favour of having loader.efi launched directly, this was left claiming that loader.efi searched for loader.efi. Reviewed by: bcran Fixes: db8b56134506 Rework UEFI ESP generation Differential Revision: https://reviews.freebsd.org/D32334 --- share/man/man8/uefi.8 | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/share/man/man8/uefi.8 b/share/man/man8/uefi.8 index 64bc30139f97..76fcedbfff16 100644 --- a/share/man/man8/uefi.8 +++ b/share/man/man8/uefi.8 @@ -88,24 +88,6 @@ or .Pa /boot/config . .It .Pa loader.efi -searches partitions of type -.Li freebsd-ufs -and -.Li freebsd-zfs -for -.Pa loader.efi . -The search begins with partitions on the device from which -.Pa loader.efi -was loaded, and continues with other available partitions. -If both -.Li freebsd-ufs -and -.Li freebsd-zfs -partitions exist on the same device the -.Li freebsd-zfs -partition is preferred. -.It -.Pa loader.efi loads and boots the kernel, as described in .Xr loader 8 . .El From nobody Thu Oct 21 22:04:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 45FF91800E5A; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1j61BDJz3tV7; Thu, 21 Oct 2021 22:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07D7622F19; Thu, 21 Oct 2021 22:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM49UD079379; Thu, 21 Oct 2021 22:04:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM49bd079378; Thu, 21 Oct 2021 22:04:09 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:09 GMT Message-Id: <202110212204.19LM49bd079378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: de705beeef63 - stable/13 - crypto: Permit variable-sized IVs for ciphers with a reinit hook. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: de705beeef63413ca56807a5df810135c7ddf925 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=de705beeef63413ca56807a5df810135c7ddf925 commit de705beeef63413ca56807a5df810135c7ddf925 Author: John Baldwin AuthorDate: 2021-10-06 21:08:46 +0000 Commit: John Baldwin CommitDate: 2021-10-21 20:47:58 +0000 crypto: Permit variable-sized IVs for ciphers with a reinit hook. Add a 'len' argument to the reinit hook in 'struct enc_xform' to permit support for AEAD ciphers such as AES-CCM and Chacha20-Poly1305 which support different nonce lengths. Reviewed by: markj Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32105 (cherry picked from commit 1833d6042c9a0116e8a1198256fd8fbc99cb11ad) (cherry picked from commit d586c978b9b4216869e589daa5bbcc33225a0e35) --- stand/libsa/geli/geliboot.c | 2 +- stand/libsa/geli/geliboot_crypto.c | 7 ++++--- stand/libsa/geli/geliboot_internal.h | 2 +- sys/crypto/chacha20/chacha-sw.c | 5 +++-- sys/dev/cxgbe/crypto/t4_crypto.c | 10 +++++++--- sys/opencrypto/cryptosoft.c | 20 +++++++++++--------- sys/opencrypto/xform_aes_icm.c | 22 ++++++++++++++-------- sys/opencrypto/xform_aes_xts.c | 9 +++++++-- sys/opencrypto/xform_chacha20_poly1305.c | 5 ++++- sys/opencrypto/xform_enc.h | 2 +- 10 files changed, 53 insertions(+), 31 deletions(-) diff --git a/stand/libsa/geli/geliboot.c b/stand/libsa/geli/geliboot.c index 954a3ec34044..56499e96b295 100644 --- a/stand/libsa/geli/geliboot.c +++ b/stand/libsa/geli/geliboot.c @@ -345,7 +345,7 @@ geli_io(struct geli_dev *gdev, geli_op_t enc, off_t offset, u_char *buf, g_eli_key_fill(&gdev->sc, &gkey, keyno); error = geliboot_crypt(gdev->sc.sc_ealgo, enc, pbuf, secsize, - gkey.gek_key, gdev->sc.sc_ekeylen, iv); + gkey.gek_key, gdev->sc.sc_ekeylen, iv, sizeof(iv)); if (error != 0) { explicit_bzero(&gkey, sizeof(gkey)); diff --git a/stand/libsa/geli/geliboot_crypto.c b/stand/libsa/geli/geliboot_crypto.c index 8478d2754d6f..fcc5d7bcd7fb 100644 --- a/stand/libsa/geli/geliboot_crypto.c +++ b/stand/libsa/geli/geliboot_crypto.c @@ -36,7 +36,7 @@ int geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize, - const u_char *key, size_t keysize, u_char *iv) + const u_char *key, size_t keysize, u_char *iv, size_t ivlen) { keyInstance aeskey; cipherInstance cipher; @@ -81,7 +81,7 @@ geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize, ctxp = &xtsctx; enc_xform_aes_xts.setkey(ctxp, key, xts_len / 8); - enc_xform_aes_xts.reinit(ctxp, iv); + enc_xform_aes_xts.reinit(ctxp, iv, ivlen); switch (enc) { case GELI_DECRYPT: @@ -113,7 +113,8 @@ g_eli_crypto_cipher(u_int algo, geli_op_t enc, u_char *data, size_t datasize, u_char iv[keysize]; explicit_bzero(iv, sizeof(iv)); - return (geliboot_crypt(algo, enc, data, datasize, key, keysize, iv)); + return (geliboot_crypt(algo, enc, data, datasize, key, keysize, iv, + sizeof(iv))); } int diff --git a/stand/libsa/geli/geliboot_internal.h b/stand/libsa/geli/geliboot_internal.h index 2af74466179f..2318690297f8 100644 --- a/stand/libsa/geli/geliboot_internal.h +++ b/stand/libsa/geli/geliboot_internal.h @@ -68,6 +68,6 @@ struct geli_dev { }; int geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize, - const u_char *key, size_t keysize, u_char *iv); + const u_char *key, size_t keysize, u_char *iv, size_t ivlen); #endif /* _GELIBOOT_INTERNAL_H_ */ diff --git a/sys/crypto/chacha20/chacha-sw.c b/sys/crypto/chacha20/chacha-sw.c index 2c28b9a0c459..ef62e67316c0 100644 --- a/sys/crypto/chacha20/chacha-sw.c +++ b/sys/crypto/chacha20/chacha-sw.c @@ -18,9 +18,10 @@ chacha20_xform_setkey(void *ctx, const uint8_t *key, int len) } static void -chacha20_xform_reinit(void *ctx, const uint8_t *iv) +chacha20_xform_reinit(void *ctx, const uint8_t *iv, size_t ivlen) { - + KASSERT(ivlen == CHACHA_NONCELEN + CHACHA_CTRLEN, + ("%s: invalid IV length", __func__)); chacha_ivsetup(ctx, iv + 8, iv); } diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index ea1272758eaf..9d410da6e030 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1,8 +1,12 @@ /*- * Copyright (c) 2017 Chelsio Communications, Inc. + * Copyright (c) 2021 The FreeBSD Foundation * All rights reserved. * Written by: John Baldwin * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -1458,7 +1462,7 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) } } - exf->reinit(kschedule, iv); + exf->reinit(kschedule, iv, sizeof(iv)); /* Do encryption with MAC */ for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { @@ -1935,7 +1939,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) if (error) goto out; - exf->reinit(kschedule, iv); + exf->reinit(kschedule, iv, sizeof(iv)); /* Do encryption/decryption with MAC */ for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { @@ -1970,7 +1974,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) error = 0; /* Tag matches, decrypt data. */ - exf->reinit(kschedule, iv); + exf->reinit(kschedule, iv, sizeof(iv)); for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { len = imin(crp->crp_payload_length - i, diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 9e551ba9652b..a85d7d6d3b7b 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -9,13 +9,16 @@ * supported the development of this code. * * Copyright (c) 2000, 2001 Angelos D. Keromytis - * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2014-2021 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by John-Mark Gurney * under sponsorship of the FreeBSD Foundation and * Rubicon Communications, LLC (Netgate). * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all source code copies of any software which is or includes a copy or @@ -106,7 +109,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) struct swcr_encdec *sw; struct enc_xform *exf; size_t inlen, outlen; - int i, blks, ivlen, resid; + int i, blks, resid; struct crypto_buffer_cursor cc_in, cc_out; const unsigned char *inblk; unsigned char *outblk; @@ -117,7 +120,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) sw = &ses->swcr_encdec; exf = sw->sw_exf; - ivlen = exf->ivsize; + csp = crypto_get_params(crp->crp_session); if (exf->native_blocksize == 0) { /* Check for non-padded data */ @@ -133,7 +136,6 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) return (EINVAL); if (crp->crp_cipher_key != NULL) { - csp = crypto_get_params(crp->crp_session); error = exf->setkey(sw->sw_kschedule, crp->crp_cipher_key, csp->csp_cipher_klen); if (error) @@ -147,7 +149,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) * xforms that provide a reinit method perform all IV * handling themselves. */ - exf->reinit(sw->sw_kschedule, iv); + exf->reinit(sw->sw_kschedule, iv, csp->csp_ivlen); } ivp = iv; @@ -534,7 +536,7 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, crypto_get_params(crp->crp_session)->csp_cipher_klen); - exf->reinit(swe->sw_kschedule, iv); + exf->reinit(swe->sw_kschedule, iv, ivlen); /* Do encryption with MAC */ crypto_cursor_init(&cc_in, &crp->crp_buf); @@ -753,7 +755,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, crypto_get_params(crp->crp_session)->csp_cipher_klen); - exf->reinit(swe->sw_kschedule, iv); + exf->reinit(swe->sw_kschedule, iv, ivlen); /* Do encryption/decryption with MAC */ crypto_cursor_init(&cc_in, &crp->crp_buf); @@ -824,7 +826,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) } /* tag matches, decrypt data */ - exf->reinit(swe->sw_kschedule, iv); + exf->reinit(swe->sw_kschedule, iv, ivlen); crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; @@ -915,7 +917,7 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, csp->csp_cipher_klen); - exf->reinit(swe->sw_kschedule, crp->crp_iv); + exf->reinit(swe->sw_kschedule, crp->crp_iv, csp->csp_ivlen); /* Do encryption with MAC */ crypto_cursor_init(&cc_in, &crp->crp_buf); diff --git a/sys/opencrypto/xform_aes_icm.c b/sys/opencrypto/xform_aes_icm.c index 5f81f8df8a87..45da8267ca7d 100644 --- a/sys/opencrypto/xform_aes_icm.c +++ b/sys/opencrypto/xform_aes_icm.c @@ -55,9 +55,9 @@ __FBSDID("$FreeBSD$"); static int aes_icm_setkey(void *, const uint8_t *, int); static void aes_icm_crypt(void *, const uint8_t *, uint8_t *); static void aes_icm_crypt_last(void *, const uint8_t *, uint8_t *, size_t); -static void aes_icm_reinit(void *, const uint8_t *); -static void aes_gcm_reinit(void *, const uint8_t *); -static void aes_ccm_reinit(void *, const uint8_t *); +static void aes_icm_reinit(void *, const uint8_t *, size_t); +static void aes_gcm_reinit(void *, const uint8_t *, size_t); +static void aes_ccm_reinit(void *, const uint8_t *, size_t); /* Encryption instances */ struct enc_xform enc_xform_aes_icm = { @@ -114,20 +114,24 @@ struct enc_xform enc_xform_ccm = { * Encryption wrapper routines. */ static void -aes_icm_reinit(void *key, const uint8_t *iv) +aes_icm_reinit(void *key, const uint8_t *iv, size_t ivlen) { struct aes_icm_ctx *ctx; ctx = key; - bcopy(iv, ctx->ac_block, AESICM_BLOCKSIZE); + KASSERT(ivlen <= sizeof(ctx->ac_block), + ("%s: ivlen too large", __func__)); + bcopy(iv, ctx->ac_block, ivlen); } static void -aes_gcm_reinit(void *key, const uint8_t *iv) +aes_gcm_reinit(void *key, const uint8_t *iv, size_t ivlen) { struct aes_icm_ctx *ctx; - aes_icm_reinit(key, iv); + KASSERT(ivlen == AES_GCM_IV_LEN, + ("%s: invalid IV length", __func__)); + aes_icm_reinit(key, iv, ivlen); ctx = key; /* GCM starts with 2 as counter 1 is used for final xor of tag. */ @@ -136,10 +140,12 @@ aes_gcm_reinit(void *key, const uint8_t *iv) } static void -aes_ccm_reinit(void *key, const uint8_t *iv) +aes_ccm_reinit(void *key, const uint8_t *iv, size_t ivlen) { struct aes_icm_ctx *ctx; + KASSERT(ivlen == AES_CCM_IV_LEN, + ("%s: invalid IV length", __func__)); ctx = key; /* CCM has flags, then the IV, then the counter, which starts at 1 */ diff --git a/sys/opencrypto/xform_aes_xts.c b/sys/opencrypto/xform_aes_xts.c index 0b415f1d6346..d7f807752aa6 100644 --- a/sys/opencrypto/xform_aes_xts.c +++ b/sys/opencrypto/xform_aes_xts.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); static int aes_xts_setkey(void *, const uint8_t *, int); static void aes_xts_encrypt(void *, const uint8_t *, uint8_t *); static void aes_xts_decrypt(void *, const uint8_t *, uint8_t *); -static void aes_xts_reinit(void *, const uint8_t *); +static void aes_xts_reinit(void *, const uint8_t *, size_t); /* Encryption instances */ struct enc_xform enc_xform_aes_xts = { @@ -77,12 +77,17 @@ struct enc_xform enc_xform_aes_xts = { * Encryption wrapper routines. */ static void -aes_xts_reinit(void *key, const uint8_t *iv) +aes_xts_reinit(void *key, const uint8_t *iv, size_t ivlen) { struct aes_xts_ctx *ctx = key; uint64_t blocknum; u_int i; +#ifndef _STANDALONE + KASSERT(ivlen == sizeof(blocknum), + ("%s: invalid IV length", __func__)); +#endif + /* * Prepare tweak as E_k2(IV). IV is specified as LE representation * of a 64-bit block number which we allow to be passed in directly. diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index 3a72c06f931b..e893287145f2 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -50,10 +50,13 @@ chacha20_poly1305_setkey(void *vctx, const uint8_t *key, int len) } static void -chacha20_poly1305_reinit(void *vctx, const uint8_t *iv) +chacha20_poly1305_reinit(void *vctx, const uint8_t *iv, size_t ivlen) { struct chacha20_poly1305_cipher_ctx *ctx = vctx; + KASSERT(ivlen == sizeof(ctx->nonce), + ("%s: invalid nonce length", __func__)); + /* Block 0 is used for the poly1305 key. */ memcpy(ctx->nonce, iv, sizeof(ctx->nonce)); ctx->ic = 1; diff --git a/sys/opencrypto/xform_enc.h b/sys/opencrypto/xform_enc.h index e8325f20917b..1c800ed428fe 100644 --- a/sys/opencrypto/xform_enc.h +++ b/sys/opencrypto/xform_enc.h @@ -62,7 +62,7 @@ struct enc_xform { void (*encrypt) (void *, const uint8_t *, uint8_t *); void (*decrypt) (void *, const uint8_t *, uint8_t *); int (*setkey) (void *, const uint8_t *, int len); - void (*reinit) (void *, const uint8_t *); + void (*reinit) (void *, const uint8_t *, size_t); /* * For stream ciphers, encrypt/decrypt the final partial block From nobody Thu Oct 21 22:04:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8C3CA1801206; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1j72R1dz3tKb; Thu, 21 Oct 2021 22:04:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B9EC22F9E; Thu, 21 Oct 2021 22:04:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4BlK079403; Thu, 21 Oct 2021 22:04:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4BAo079402; Thu, 21 Oct 2021 22:04:11 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:11 GMT Message-Id: <202110212204.19LM4BAo079402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d1d4ac2dbd70 - stable/13 - cryptosoft, ccr: Use crp_iv directly for AES-CCM and AES-GCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: d1d4ac2dbd70e6f71be236cec3e9d743e6d54692 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d1d4ac2dbd70e6f71be236cec3e9d743e6d54692 commit d1d4ac2dbd70e6f71be236cec3e9d743e6d54692 Author: John Baldwin AuthorDate: 2021-10-06 21:08:46 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:03:45 +0000 cryptosoft, ccr: Use crp_iv directly for AES-CCM and AES-GCM. Rather than copying crp_iv to a local array on the stack that is then passed to xform reinit routines, pass crp_iv directly and remove the local copy. Reviewed by: markj Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32106 (cherry picked from commit 5ae5ed5b8fd2955378ab67ba127cad8c981678ab) --- sys/dev/cxgbe/crypto/t4_crypto.c | 17 +++++------------ sys/opencrypto/cryptosoft.c | 18 +++++------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 9d410da6e030..33c03c3903e5 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1391,7 +1391,6 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) void *auth_ctx, *kschedule; char block[GMAC_BLOCK_LEN]; char digest[GMAC_DIGEST_LEN]; - char iv[AES_BLOCK_LEN]; int error, i, len; auth_ctx = NULL; @@ -1436,10 +1435,8 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) error = EINVAL; goto out; } - crypto_read_iv(crp, iv); - *(uint32_t *)&iv[12] = htobe32(1); - axf->Reinit(auth_ctx, iv, sizeof(iv)); + axf->Reinit(auth_ctx, crp->crp_iv, AES_GCM_IV_LEN); /* MAC the AAD. */ if (crp->crp_aad != NULL) { @@ -1462,7 +1459,7 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) } } - exf->reinit(kschedule, iv, sizeof(iv)); + exf->reinit(kschedule, crp->crp_iv, AES_GCM_IV_LEN); /* Do encryption with MAC */ for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { @@ -1522,7 +1519,6 @@ out: zfree(kschedule, M_CCR); zfree(auth_ctx, M_CCR); explicit_bzero(block, sizeof(block)); - explicit_bzero(iv, sizeof(iv)); explicit_bzero(digest, sizeof(digest)); crp->crp_etype = error; crypto_done(crp); @@ -1878,7 +1874,6 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) void *kschedule; char block[CCM_CBC_BLOCK_LEN]; char digest[AES_CBC_MAC_HASH_LEN]; - char iv[AES_CCM_IV_LEN]; int error, i, len; auth_ctx = NULL; @@ -1923,11 +1918,10 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) error = EINVAL; goto out; } - crypto_read_iv(crp, iv); auth_ctx->aes_cbc_mac_ctx.authDataLength = crp->crp_aad_length; auth_ctx->aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; - axf->Reinit(auth_ctx, iv, sizeof(iv)); + axf->Reinit(auth_ctx, crp->crp_iv, AES_CCM_IV_LEN); /* MAC the AAD. */ if (crp->crp_aad != NULL) @@ -1939,7 +1933,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) if (error) goto out; - exf->reinit(kschedule, iv, sizeof(iv)); + exf->reinit(kschedule, crp->crp_iv, AES_CCM_IV_LEN); /* Do encryption/decryption with MAC */ for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { @@ -1974,7 +1968,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) error = 0; /* Tag matches, decrypt data. */ - exf->reinit(kschedule, iv, sizeof(iv)); + exf->reinit(kschedule, crp->crp_iv, AES_CCM_IV_LEN); for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { len = imin(crp->crp_payload_length - i, @@ -1995,7 +1989,6 @@ out: zfree(kschedule, M_CCR); zfree(auth_ctx, M_CCR); explicit_bzero(block, sizeof(block)); - explicit_bzero(iv, sizeof(iv)); explicit_bzero(digest, sizeof(digest)); crp->crp_etype = error; crypto_done(crp); diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index a85d7d6d3b7b..77df37420bf5 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -463,7 +463,6 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; u_char tag[GMAC_DIGEST_LEN]; - u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc_in, cc_out; const u_char *inblk; u_char *outblk; @@ -492,12 +491,10 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) return (EINVAL); - /* Initialize the IV */ ivlen = AES_GCM_IV_LEN; - bcopy(crp->crp_iv, iv, ivlen); /* Supply MAC with IV */ - axf->Reinit(&ctx, iv, ivlen); + axf->Reinit(&ctx, crp->crp_iv, ivlen); /* Supply MAC with AAD */ if (crp->crp_aad != NULL) { @@ -536,7 +533,7 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, crypto_get_params(crp->crp_session)->csp_cipher_klen); - exf->reinit(swe->sw_kschedule, iv, ivlen); + exf->reinit(swe->sw_kschedule, crp->crp_iv, ivlen); /* Do encryption with MAC */ crypto_cursor_init(&cc_in, &crp->crp_buf); @@ -635,7 +632,6 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) out: explicit_bzero(blkbuf, sizeof(blkbuf)); explicit_bzero(tag, sizeof(tag)); - explicit_bzero(iv, sizeof(iv)); return (error); } @@ -701,7 +697,6 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; u_char tag[AES_CBC_MAC_HASH_LEN]; - u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc_in, cc_out; const u_char *inblk; u_char *outblk; @@ -729,9 +724,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) return (EINVAL); - /* Initialize the IV */ ivlen = AES_CCM_IV_LEN; - bcopy(crp->crp_iv, iv, ivlen); /* * AES CCM-CBC-MAC needs to know the length of both the auth @@ -741,7 +734,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) ctx.aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; /* Supply MAC with IV */ - axf->Reinit(&ctx, iv, ivlen); + axf->Reinit(&ctx, crp->crp_iv, ivlen); /* Supply MAC with AAD */ if (crp->crp_aad != NULL) @@ -755,7 +748,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, crypto_get_params(crp->crp_session)->csp_cipher_klen); - exf->reinit(swe->sw_kschedule, iv, ivlen); + exf->reinit(swe->sw_kschedule, crp->crp_iv, ivlen); /* Do encryption/decryption with MAC */ crypto_cursor_init(&cc_in, &crp->crp_buf); @@ -826,7 +819,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) } /* tag matches, decrypt data */ - exf->reinit(swe->sw_kschedule, iv, ivlen); + exf->reinit(swe->sw_kschedule, crp->crp_iv, ivlen); crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; @@ -859,7 +852,6 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) out: explicit_bzero(blkbuf, sizeof(blkbuf)); explicit_bzero(tag, sizeof(tag)); - explicit_bzero(iv, sizeof(iv)); return (error); } From nobody Thu Oct 21 22:04:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D2D421800EE2; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1j841nLz3tHX; Thu, 21 Oct 2021 22:04:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A149230A2; Thu, 21 Oct 2021 22:04:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4C83079429; Thu, 21 Oct 2021 22:04:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4CcP079428; Thu, 21 Oct 2021 22:04:12 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:12 GMT Message-Id: <202110212204.19LM4CcP079428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 38b8a2be5c48 - stable/13 - cryptodev: Permit explicit IV/nonce and MAC/tag lengths. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 38b8a2be5c48436a5db059080b97ff0f8c02ef27 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=38b8a2be5c48436a5db059080b97ff0f8c02ef27 commit 38b8a2be5c48436a5db059080b97ff0f8c02ef27 Author: John Baldwin AuthorDate: 2021-10-06 21:08:46 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:05:11 +0000 cryptodev: Permit explicit IV/nonce and MAC/tag lengths. Add 'ivlen' and 'maclen' fields to the structure used for CIOGSESSION2 to specify the explicit IV/nonce and MAC/tag lengths for crypto sessions. If these fields are zero, the default lengths are used. This permits selecting an alternate nonce length for AEAD ciphers such as AES-CCM which support multiple nonce leengths. It also supports truncated MACs as input to AEAD or ETA requests. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32107 (cherry picked from commit 16676123fc85233334983e0071cb446357abec8d) --- share/man/man4/crypto.4 | 24 ++++++++++++++++++++---- sys/opencrypto/cryptodev.c | 29 +++++++++++++++++++++++++++-- sys/opencrypto/cryptodev.h | 9 +++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/share/man/man4/crypto.4 b/share/man/man4/crypto.4 index f146b50ecd4b..83d00050af28 100644 --- a/share/man/man4/crypto.4 +++ b/share/man/man4/crypto.4 @@ -1,13 +1,16 @@ .\" $NetBSD: crypto.4,v 1.24 2014/01/27 21:23:59 pgoyette Exp $ .\" .\" Copyright (c) 2008 The NetBSD Foundation, Inc. -.\" Copyright (c) 2014 The FreeBSD Foundation +.\" Copyright (c) 2014-2021 The FreeBSD Foundation .\" All rights reserved. .\" .\" Portions of this documentation were written by John-Mark Gurney .\" under sponsorship of the FreeBSD Foundation and .\" Rubicon Communications, LLC (Netgate). .\" +.\" Portions of this documentation were written by Ararat River +.\" Consulting, LLC under sponsorship of the FreeBSD Foundation. +.\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Coyote Point Systems, Inc. .\" @@ -60,7 +63,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2020 +.Dd October 6, 2021 .Dt CRYPTO 4 .Os .Sh NAME @@ -265,14 +268,27 @@ struct session2_op { uint32_t ses; /* returns: ses # */ int crid; /* driver id + flags (rw) */ - int pad[4]; /* for future expansion */ + int ivlen; /* length of nonce/IV */ + int maclen; /* length of MAC/tag */ + int pad[2]; /* for future expansion */ }; .Ed -This request is similar to CIOGSESSION except that +This request is similar to CIOGSESSION but adds additional fields. +.Pp .Fa sessp-\*[Gt]crid requests either a specific crypto device or a class of devices (software vs hardware). +.Pp +.Fa sessp-\*[Gt]ivlen +specifies the length of the IV or nonce supplied with each request. +If this field is set to zero, the default IV or nonce length is used. +.Pp +.Fa sessp-\*[Gt]maclen +specifies the length of the MAC or authentication tag supplied or computed by +each request. +If this field is set to zero, the full MAC is used. +.Pp The .Fa sessp-\*[Gt]pad field must be initialized to zero. diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 9f581e68fe92..ffdf4c67d2f0 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -103,7 +103,9 @@ struct session2_op32 { uint32_t mackey; uint32_t ses; int crid; - int pad[4]; + int ivlen; + int maclen; + int pad[2]; }; struct crypt_op32 { @@ -172,6 +174,8 @@ session2_op_from_32(const struct session2_op32 *from, struct session2_op *to) session_op_from_32((const struct session_op32 *)from, to); CP(*from, *to, crid); + CP(*from, *to, ivlen); + CP(*from, *to, maclen); } static void @@ -662,6 +666,25 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) csp.csp_ivlen = AES_CCM_IV_LEN; } + if (sop->ivlen != 0) { + if (csp.csp_ivlen == 0) { + CRYPTDEB("does not support an IV"); + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + csp.csp_ivlen = sop->ivlen; + } + if (sop->maclen != 0) { + if (!(thash != NULL || csp.csp_mode == CSP_MODE_AEAD)) { + CRYPTDEB("does not support a MAC"); + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + csp.csp_auth_mlen = sop->maclen; + } + crid = sop->crid; error = checkforsoftware(&crid); if (error) { @@ -683,7 +706,9 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) cse->mackey = mackey; cse->cses = cses; cse->txform = txform; - if (thash != NULL) + if (sop->maclen != 0) + cse->hashsize = sop->maclen; + else if (thash != NULL) cse->hashsize = thash->hashsize; else if (csp.csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) cse->hashsize = AES_GMAC_HASH_LEN; diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 4d9b735366b8..046f67de418e 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -23,13 +23,16 @@ * PURPOSE. * * Copyright (c) 2001 Theo de Raadt - * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2014-2021 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by John-Mark Gurney * under sponsorship of the FreeBSD Foundation and * Rubicon Communications, LLC (Netgate). * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -246,7 +249,9 @@ struct session2_op { uint32_t ses; /* returns: session # */ int crid; /* driver id + flags (rw) */ - int pad[4]; /* for future expansion */ + int ivlen; /* length of nonce/IV */ + int maclen; /* length of MAC/tag */ + int pad[2]; /* for future expansion */ }; struct crypt_op { From nobody Thu Oct 21 22:04:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 880AF1800E6D; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1j953JGz3tKq; Thu, 21 Oct 2021 22:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72C512303D; Thu, 21 Oct 2021 22:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4D5R079457; Thu, 21 Oct 2021 22:04:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4D16079456; Thu, 21 Oct 2021 22:04:13 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:13 GMT Message-Id: <202110212204.19LM4D16079456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ac648e3affe3 - stable/13 - cryptodev: Permit CIOCCRYPT for AEAD ciphers. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ac648e3affe358fb373cf369fb2ea46daceba250 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ac648e3affe358fb373cf369fb2ea46daceba250 commit ac648e3affe358fb373cf369fb2ea46daceba250 Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:11 +0000 cryptodev: Permit CIOCCRYPT for AEAD ciphers. A request without AAD for an AEAD cipher can be submitted via CIOCCRYPT rather than CIOCCRYPTAEAD. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32108 (cherry picked from commit 70dbebea124236184a66a30175ba307793971f00) --- sys/opencrypto/cryptodev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index ffdf4c67d2f0..b449c7a12d9f 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -929,6 +929,13 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) goto bail; } break; + case CSP_MODE_AEAD: + if (cse->ivsize != 0 && cop->iv == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + error = EINVAL; + goto bail; + } + /* FALLTHROUGH */ case CSP_MODE_ETA: switch (cop->op) { case COP_ENCRYPT: From nobody Thu Oct 21 22:04:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 618BE180121D; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jC0KKlz3t87; Thu, 21 Oct 2021 22:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98199230A3; Thu, 21 Oct 2021 22:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4EEb079481; Thu, 21 Oct 2021 22:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4ENt079480; Thu, 21 Oct 2021 22:04:14 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:14 GMT Message-Id: <202110212204.19LM4ENt079480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5f9a61203779 - stable/13 - cryptodev: Allow some CIOCCRYPT operations with an empty payload. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f9a612037793b51c70e26846334d0e0c4232950 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5f9a612037793b51c70e26846334d0e0c4232950 commit 5f9a612037793b51c70e26846334d0e0c4232950 Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:18 +0000 cryptodev: Allow some CIOCCRYPT operations with an empty payload. If an operation would generate a MAC output (e.g. for digest operation or for an AEAD or EtA operation), then an empty payload buffer is valid. Only reject requests with an empty buffer for "plain" cipher sessions. Some of the AES-CCM NIST KAT vectors use an empty payload. While here, don't advance crp_payload_start for requests that use an empty payload with an inline IV. (*) Reported by: syzbot+d4b94fbd9a44b032f428@syzkaller.appspotmail.com (*) Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32109 (cherry picked from commit a0cbcbb7917b0b8566ec0853425a73d7958ddbed) --- sys/opencrypto/cryptodev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index b449c7a12d9f..7e4cecff3980 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -846,7 +846,7 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) } if (cse->txform) { - if (cop->len == 0 || (cop->len % cse->txform->blocksize) != 0) { + if ((cop->len % cse->txform->blocksize) != 0) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } @@ -901,6 +901,12 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) } break; case CSP_MODE_CIPHER: + if (cop->len == 0 || + (cop->iv == NULL && cop->len == cse->ivsize)) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + error = EINVAL; + goto bail; + } switch (cop->op) { case COP_ENCRYPT: crp->crp_op = CRYPTO_OP_ENCRYPT; @@ -984,8 +990,9 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) goto bail; } crp->crp_iv_start = 0; - crp->crp_payload_start += cse->ivsize; crp->crp_payload_length -= cse->ivsize; + if (crp->crp_payload_length != 0) + crp->crp_payload_start = cse->ivsize; dst += cse->ivsize; } From nobody Thu Oct 21 22:04:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 92BDF18012E0; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jH5NHqz3tcY; Thu, 21 Oct 2021 22:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 289722303E; Thu, 21 Oct 2021 22:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4JW8079578; Thu, 21 Oct 2021 22:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4JAj079577; Thu, 21 Oct 2021 22:04:19 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:19 GMT Message-Id: <202110212204.19LM4JAj079577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a5d3890803e6 - stable/13 - aesni: Handle requests with an empty payload. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: a5d3890803e6f8d6624976645ae456e754cc9d2c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a5d3890803e6f8d6624976645ae456e754cc9d2c commit a5d3890803e6f8d6624976645ae456e754cc9d2c Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:56 +0000 aesni: Handle requests with an empty payload. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32113 (cherry picked from commit d718c2d3c805001db0b0ae0cc0c8a811b8a90a95) --- sys/crypto/aesni/aesni.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 67dcef123429..7d4dbd2c1604 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -700,28 +700,36 @@ aesni_cipher_crypt(struct aesni_session *ses, struct cryptop *crp, int error; bool encflag, allocated, authallocated, outallocated, outcopy; - buf = aesni_cipher_alloc(crp, crp->crp_payload_start, - crp->crp_payload_length, &allocated); - if (buf == NULL) - return (ENOMEM); + if (crp->crp_payload_length == 0) { + buf = NULL; + allocated = false; + } else { + buf = aesni_cipher_alloc(crp, crp->crp_payload_start, + crp->crp_payload_length, &allocated); + if (buf == NULL) + return (ENOMEM); + } outallocated = false; authallocated = false; authbuf = NULL; if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16 || csp->csp_cipher_alg == CRYPTO_AES_CCM_16) { - if (crp->crp_aad != NULL) + if (crp->crp_aad_length == 0) { + authbuf = NULL; + } else if (crp->crp_aad != NULL) { authbuf = crp->crp_aad; - else + } else { authbuf = aesni_cipher_alloc(crp, crp->crp_aad_start, crp->crp_aad_length, &authallocated); - if (authbuf == NULL) { - error = ENOMEM; - goto out; + if (authbuf == NULL) { + error = ENOMEM; + goto out; + } } } - if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + if (CRYPTO_HAS_OUTPUT_BUFFER(crp) && crp->crp_payload_length > 0) { outbuf = crypto_buffer_contiguous_subsegment(&crp->crp_obuf, crp->crp_payload_output_start, crp->crp_payload_length); if (outbuf == NULL) { From nobody Thu Oct 21 22:04:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BE97C1801469; Thu, 21 Oct 2021 22:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jG3dRFz3tf8; Thu, 21 Oct 2021 22:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0502522C5E; Thu, 21 Oct 2021 22:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4HpN079554; Thu, 21 Oct 2021 22:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4HV3079553; Thu, 21 Oct 2021 22:04:17 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:17 GMT Message-Id: <202110212204.19LM4HV3079553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4cce6043c7d9 - stable/13 - aesni: Support multiple nonce lengths for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4cce6043c7d9be191883ad3a7ed46e8e4a1709af Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4cce6043c7d9be191883ad3a7ed46e8e4a1709af commit 4cce6043c7d9be191883ad3a7ed46e8e4a1709af Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:45 +0000 aesni: Support multiple nonce lengths for AES-CCM. Reviewed by: sef Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32112 (cherry picked from commit 8e6af6adfc2cc3d0ea89c20eaa5914e453c48b49) --- sys/crypto/aesni/aesni.c | 13 +++++++++---- sys/crypto/aesni/aesni_ccm.c | 32 ++++++++------------------------ 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 4debbae12c2b..67dcef123429 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -1,7 +1,7 @@ /*- * Copyright (c) 2005-2008 Pawel Jakub Dawidek * Copyright (c) 2010 Konstantin Belousov - * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2014-2021 The FreeBSD Foundation * Copyright (c) 2017 Conrad Meyer * All rights reserved. * @@ -9,6 +9,9 @@ * under sponsorship of the FreeBSD Foundation and * Rubicon Communications, LLC (Netgate). * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -319,8 +322,7 @@ aesni_probesession(device_t dev, const struct crypto_session_params *csp) if (csp->csp_auth_mlen != 0 && csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN) return (EINVAL); - if (csp->csp_ivlen != AES_CCM_IV_LEN || - !sc->has_aes) + if (!sc->has_aes) return (EINVAL); break; default: @@ -639,9 +641,12 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) csp = crypto_get_params(crp->crp_session); switch (csp->csp_cipher_alg) { + case CRYPTO_AES_CCM_16: + if (crp->crp_payload_length > ccm_max_payload_length(csp)) + return (EMSGSIZE); + /* FALLTHROUGH */ case CRYPTO_AES_ICM: case CRYPTO_AES_NIST_GCM_16: - case CRYPTO_AES_CCM_16: if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) return (EINVAL); break; diff --git a/sys/crypto/aesni/aesni_ccm.c b/sys/crypto/aesni/aesni_ccm.c index fc01e92c697f..9e2fa317b2ed 100644 --- a/sys/crypto/aesni/aesni_ccm.c +++ b/sys/crypto/aesni/aesni_ccm.c @@ -1,11 +1,15 @@ /*- - * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2014-2021 The FreeBSD Foundation * Copyright (c) 2018 iXsystems, Inc * All rights reserved. * - * This software was developed by John-Mark Gurney under - * the sponsorship of the FreeBSD Foundation and + * Portions of this software were developed by John-Mark Gurney + * under the sponsorship of the FreeBSD Foundation and * Rubicon Communications, LLC (Netgate). + * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -185,12 +189,7 @@ cbc_mac_start(const unsigned char *auth_data, size_t auth_len, * however, they're always truncated from 16 bytes, and the tag * length isn't passed in. (This could be fixed by changing the * code in aesni.c:aesni_cipher_crypt().) - * Similarly, although the nonce length is passed in, the - * OpenCrypto API that calls us doesn't have a way to set the nonce - * other than by having different crypto algorithm types. As a result, - * this is currently always called with nlen=12; this means that we - * also have a maximum message length of 16 megabytes. And similarly, - * since abytes is limited to a 32 bit value here, the AAD is + * Since abytes is limited to a 32 bit value here, the AAD is * limited to 4 gigabytes or less. */ void @@ -222,14 +221,6 @@ AES_CCM_encrypt(const unsigned char *in, unsigned char *out, */ L = sizeof(__m128i) - 1 - nlen; - /* - * Now, this shouldn't happen, but let's make sure that - * the data length isn't too big. - */ - KASSERT(nbytes <= ((1 << (8 * L)) - 1), - ("%s: nbytes is %u, but length field is %d bytes", - __FUNCTION__, nbytes, L)); - /* * Clear out the blocks */ @@ -399,13 +390,6 @@ AES_CCM_decrypt(const unsigned char *in, unsigned char *out, */ L = sizeof(__m128i) - 1 - nlen; - /* - * Now, this shouldn't happen, but let's make sure that - * the data length isn't too big. - */ - if (nbytes > ((1 << (8 * L)) - 1)) - panic("%s: nbytes is %u, but length field is %d bytes", - __FUNCTION__, nbytes, L); /* * Clear out the blocks */ From nobody Thu Oct 21 22:04:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAB66180137F; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jK20Jxz3tn5; Thu, 21 Oct 2021 22:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51BEB22F9F; Thu, 21 Oct 2021 22:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4Ksv079602; Thu, 21 Oct 2021 22:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4K0E079601; Thu, 21 Oct 2021 22:04:20 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:20 GMT Message-Id: <202110212204.19LM4K0E079601@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: aacfe3bb52b7 - stable/13 - aesni: Permit AES-CCM requests with neither payload nor AAD. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: aacfe3bb52b7c489eab02d8bed49bd1b4da6f669 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=aacfe3bb52b7c489eab02d8bed49bd1b4da6f669 commit aacfe3bb52b7c489eab02d8bed49bd1b4da6f669 Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:08:02 +0000 aesni: Permit AES-CCM requests with neither payload nor AAD. Reviewed by: sef Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32114 (cherry picked from commit c09c379c7aa7337680ff3cb73691ce12d627128b) --- sys/crypto/aesni/aesni_ccm.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/crypto/aesni/aesni_ccm.c b/sys/crypto/aesni/aesni_ccm.c index 9e2fa317b2ed..34b61a633907 100644 --- a/sys/crypto/aesni/aesni_ccm.c +++ b/sys/crypto/aesni/aesni_ccm.c @@ -205,9 +205,6 @@ AES_CCM_encrypt(const unsigned char *in, unsigned char *out, uint8_t *byte_ptr; __m128i s0, rolling_mac, s_x, staging_block; - if (nbytes == 0 && abytes == 0) - return; - /* NIST 800-38c section A.1 says n is [7, 13]. */ if (nlen < 7 || nlen > 13) panic("%s: bad nonce length %d", __FUNCTION__, nlen); @@ -377,8 +374,6 @@ AES_CCM_decrypt(const unsigned char *in, unsigned char *out, __m128i s0, rolling_mac, staging_block; uint8_t *byte_ptr; - if (nbytes == 0 && abytes == 0) - return (1); // No message means no decryption! if (nlen < 0 || nlen > 15) panic("%s: bad nonce length %d", __FUNCTION__, nlen); From nobody Thu Oct 21 22:04:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3E39F180178A; Thu, 21 Oct 2021 22:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jL3rkMz3thF; Thu, 21 Oct 2021 22:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 708A622F1A; Thu, 21 Oct 2021 22:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4L7T079632; Thu, 21 Oct 2021 22:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4LFg079631; Thu, 21 Oct 2021 22:04:21 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:21 GMT Message-Id: <202110212204.19LM4LFg079631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 082e7569cc89 - stable/13 - aesni: Support AES-CCM requests with a truncated tag. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 082e7569cc897fe28a537349691567f19e261ff1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=082e7569cc897fe28a537349691567f19e261ff1 commit 082e7569cc897fe28a537349691567f19e261ff1 Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:08:12 +0000 aesni: Support AES-CCM requests with a truncated tag. Reviewed by: sef Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32115 (cherry picked from commit 655eb762c31044a791e8c8c6355515e7c89c07ef) --- sys/crypto/aesni/aesni.c | 18 +++++++++++------- sys/crypto/aesni/aesni.h | 8 ++++---- sys/crypto/aesni/aesni_ccm.c | 10 ++-------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 7d4dbd2c1604..de797abd1af5 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -319,9 +319,6 @@ aesni_probesession(device_t dev, const struct crypto_session_params *csp) CRYPTDEB("invalid CCM key length"); return (EINVAL); } - if (csp->csp_auth_mlen != 0 && - csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN) - return (EINVAL); if (!sc->has_aes) return (EINVAL); break; @@ -610,6 +607,11 @@ aesni_cipher_setup(struct aesni_session *ses, error = aesni_authprepare(ses, csp->csp_auth_klen); if (error != 0) return (error); + } else if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) { + if (csp->csp_auth_mlen == 0) + ses->mlen = AES_CBC_MAC_HASH_LEN; + else + ses->mlen = csp->csp_auth_mlen; } kt = is_fpu_kern_thread(0) || (csp->csp_cipher_alg == 0); @@ -809,15 +811,17 @@ aesni_cipher_crypt(struct aesni_session *ses, struct cryptop *crp, memset(tag, 0, sizeof(tag)); AES_CCM_encrypt(buf, outbuf, authbuf, iv, tag, crp->crp_payload_length, crp->crp_aad_length, - csp->csp_ivlen, ses->enc_schedule, ses->rounds); - crypto_copyback(crp, crp->crp_digest_start, sizeof(tag), + csp->csp_ivlen, ses->mlen, ses->enc_schedule, + ses->rounds); + crypto_copyback(crp, crp->crp_digest_start, ses->mlen, tag); } else { - crypto_copydata(crp, crp->crp_digest_start, sizeof(tag), + crypto_copydata(crp, crp->crp_digest_start, ses->mlen, tag); if (!AES_CCM_decrypt(buf, outbuf, authbuf, iv, tag, crp->crp_payload_length, crp->crp_aad_length, - csp->csp_ivlen, ses->enc_schedule, ses->rounds)) + csp->csp_ivlen, ses->mlen, ses->enc_schedule, + ses->rounds)) error = EBADMSG; } break; diff --git a/sys/crypto/aesni/aesni.h b/sys/crypto/aesni/aesni.h index 284bf6fba0fc..77ceec7b382a 100644 --- a/sys/crypto/aesni/aesni.h +++ b/sys/crypto/aesni/aesni.h @@ -112,12 +112,12 @@ int AES_GCM_decrypt(const unsigned char *in, unsigned char *out, /* CCM + CBC-MAC functions */ void AES_CCM_encrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *ivec, - unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, - const unsigned char *key, int nr); + unsigned char *tag, uint32_t nbytes, uint32_t abytes, int nlen, + int tag_length, const unsigned char *key, int nr); int AES_CCM_decrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *ivec, - const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, - const unsigned char *key, int nr); + const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int nlen, + int tag_length, const unsigned char *key, int nr); void aesni_cipher_setup_common(struct aesni_session *ses, const struct crypto_session_params *csp, const uint8_t *key, int keylen); diff --git a/sys/crypto/aesni/aesni_ccm.c b/sys/crypto/aesni/aesni_ccm.c index 34b61a633907..c7edaa0b9d5c 100644 --- a/sys/crypto/aesni/aesni_ccm.c +++ b/sys/crypto/aesni/aesni_ccm.c @@ -185,10 +185,6 @@ cbc_mac_start(const unsigned char *auth_data, size_t auth_len, * Implement AES CCM+CBC-MAC encryption and authentication. * * A couple of notes: - * The specification allows for a different number of tag lengths; - * however, they're always truncated from 16 bytes, and the tag - * length isn't passed in. (This could be fixed by changing the - * code in aesni.c:aesni_cipher_crypt().) * Since abytes is limited to a 32 bit value here, the AAD is * limited to 4 gigabytes or less. */ @@ -196,9 +192,8 @@ void AES_CCM_encrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *nonce, unsigned char *tag, uint32_t nbytes, uint32_t abytes, int nlen, - const unsigned char *key, int nr) + int tag_length, const unsigned char *key, int nr) { - static const int tag_length = 16; /* 128 bits */ int L; int counter = 1; /* S0 has 0, S1 has 1 */ size_t copy_amt, total = 0; @@ -367,9 +362,8 @@ int AES_CCM_decrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *nonce, const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int nlen, - const unsigned char *key, int nr) + int tag_length, const unsigned char *key, int nr) { - static const int tag_length = 16; /* 128 bits */ int L; __m128i s0, rolling_mac, staging_block; uint8_t *byte_ptr; From nobody Thu Oct 21 22:04:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0B9DD180139B; Thu, 21 Oct 2021 22:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jF1Km1z3tkT; Thu, 21 Oct 2021 22:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB21D230A5; Thu, 21 Oct 2021 22:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4GIN079530; Thu, 21 Oct 2021 22:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4GiR079529; Thu, 21 Oct 2021 22:04:16 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:16 GMT Message-Id: <202110212204.19LM4GiR079529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: fd464d2f78f3 - stable/13 - crypto: Support multiple nonce lengths for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: fd464d2f78f3b3ff6cf8197b95a952c2db29ec5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fd464d2f78f3b3ff6cf8197b95a952c2db29ec5c commit fd464d2f78f3b3ff6cf8197b95a952c2db29ec5c Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:36 +0000 crypto: Support multiple nonce lengths for AES-CCM. Permit nonces of lengths 7 through 13 in the OCF framework and the cryptosoft driver. A helper function (ccm_max_payload_length) can be used in OCF drivers to reject CCM requests which are too large for the specified nonce length. Reviewed by: sef Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32111 (cherry picked from commit ae18720d2792287c9ec658404f1a3173014d4979) --- share/man/man7/crypto.7 | 18 +++++++++----- sys/opencrypto/crypto.c | 56 ++++++++++++++++++++++++++++++++++++------ sys/opencrypto/cryptodev.h | 29 ++++++++++++++++++++++ sys/opencrypto/cryptosoft.c | 17 +++++++------ sys/opencrypto/xform_aes_icm.c | 7 +++--- 5 files changed, 102 insertions(+), 25 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index 6e5bd83621aa..d75daa62adcb 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -1,9 +1,13 @@ -.\" Copyright (c) 2014 The FreeBSD Foundation +.\" Copyright (c) 2014-2021 The FreeBSD Foundation .\" All rights reserved. .\" -.\" This documentation was written by John-Mark Gurney under -.\" the sponsorship of the FreeBSD Foundation and +.\" Portions of this documentation were written by John-Mark Gurney +.\" under the sponsorship of the FreeBSD Foundation and .\" Rubicon Communications, LLC (Netgate). +.\" +.\" Portions of this documentation were written by Ararat River +.\" Consulting, LLC under sponsorship of the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -27,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2021 +.Dd October 6, 2021 .Dt CRYPTO 7 .Os .Sh NAME @@ -153,13 +157,15 @@ This nonce must be provided in via the .Dv CRYPTO_F_IV_SEPARATE flag. +Some AEAD algorithms support multiple nonce sizes. +The first size listed is the default nonce size. .Pp The following AEAD algorithms are supported: -.Bl -column "CRYPTO_AES_NIST_GCM_16" "Nonce" "16, 24, 32" "Tag" +.Bl -column "CRYPTO_AES_NIST_GCM_16" "12, 7-13" "16, 24, 32" "Tag" .It Sy Name Ta Sy Nonce Ta Sy Key Sizes Ta Sy Tag Ta Sy Description .It Dv CRYPTO_AES_NIST_GCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta AES Galois/Counter Mode -.It Dv CRYPTO_AES_CCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta +.It Dv CRYPTO_AES_CCM_16 Ta 12, 7-13 Ta 16, 24, 32 Ta 16 Ta AES Counter with CBC-MAC .It Dv CRYPTO_CHACHA20_POLY1305 Ta 12 Ta 32 Ta 16 Ta ChaCha20-Poly1305 diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index bcde910728e1..a3a42827d51b 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1,5 +1,9 @@ /*- * Copyright (c) 2002-2006 Sam Leffler. All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -743,6 +747,24 @@ alg_is_aead(int alg) return (alg_type(alg) == ALG_AEAD); } +static bool +ccm_tag_length_valid(int len) +{ + /* RFC 3610 */ + switch (len) { + case 4: + case 6: + case 8: + case 10: + case 12: + case 14: + case 16: + return (true); + default: + return (false); + } +} + #define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN) /* Various sanity checks on crypto session parameters. */ @@ -800,8 +822,21 @@ check_csp(const struct crypto_session_params *csp) return (false); /* IV is optional for digests (e.g. GMAC). */ - if (csp->csp_ivlen >= EALG_MAX_BLOCK_LEN) - return (false); + switch (csp->csp_auth_alg) { + case CRYPTO_AES_CCM_CBC_MAC: + if (csp->csp_ivlen < 7 || csp->csp_ivlen > 13) + return (false); + break; + case CRYPTO_AES_NIST_GMAC: + if (csp->csp_ivlen != AES_GCM_IV_LEN) + return (false); + break; + default: + if (csp->csp_ivlen != 0) + return (false); + break; + } + if (!alg_is_digest(csp->csp_auth_alg)) return (false); @@ -820,6 +855,10 @@ check_csp(const struct crypto_session_params *csp) axf = crypto_auth_hash(csp); if (axf == NULL || csp->csp_auth_mlen > axf->hashsize) return (false); + + if (csp->csp_auth_alg == CRYPTO_AES_CCM_CBC_MAC && + !ccm_tag_length_valid(csp->csp_auth_mlen)) + return (false); } break; case CSP_MODE_AEAD: @@ -833,13 +872,16 @@ check_csp(const struct crypto_session_params *csp) if (csp->csp_auth_alg != 0 || csp->csp_auth_klen != 0) return (false); - /* - * XXX: Would be nice to have a better way to get this - * value. - */ switch (csp->csp_cipher_alg) { - case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + if (csp->csp_auth_mlen != 0 && + !ccm_tag_length_valid(csp->csp_auth_mlen)) + return (false); + + if (csp->csp_ivlen < 7 || csp->csp_ivlen > 13) + return (false); + break; + case CRYPTO_AES_NIST_GCM_16: case CRYPTO_CHACHA20_POLY1305: if (csp->csp_auth_mlen > 16) return (false); diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 046f67de418e..1aa11c34d8ba 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -753,5 +753,34 @@ crypto_read_iv(struct cryptop *crp, void *iv) crypto_copydata(crp, crp->crp_iv_start, csp->csp_ivlen, iv); } +static __inline size_t +ccm_max_payload_length(const struct crypto_session_params *csp) +{ + /* RFC 3160 */ + const u_int L = 15 - csp->csp_ivlen; + + switch (L) { + case 2: + return (0xffff); + case 3: + return (0xffffff); +#ifdef __LP64__ + case 4: + return (0xffffffff); + case 5: + return (0xffffffffff); + case 6: + return (0xffffffffffff); + case 7: + return (0xffffffffffffff); + default: + return (0xffffffffffffffff); +#else + default: + return (0xffffffff); +#endif + } +} + #endif /* _KERNEL */ #endif /* _CRYPTO_CRYPTO_H_ */ diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 77df37420bf5..c86ff86613db 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -642,17 +642,19 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) u_char tag[AES_CBC_MAC_HASH_LEN]; u_char iv[AES_BLOCK_LEN]; union authctx ctx; + const struct crypto_session_params *csp; struct swcr_auth *swa; struct auth_hash *axf; int error, ivlen; + csp = crypto_get_params(crp->crp_session); swa = &ses->swcr_auth; axf = swa->sw_axf; bcopy(swa->sw_ictx, &ctx, axf->ctxsize); /* Initialize the IV */ - ivlen = AES_CCM_IV_LEN; + ivlen = csp->csp_ivlen; crypto_read_iv(crp, iv); /* @@ -694,6 +696,7 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) static int swcr_ccm(struct swcr_session *ses, struct cryptop *crp) { + const struct crypto_session_params *csp; uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; u_char tag[AES_CBC_MAC_HASH_LEN]; @@ -708,6 +711,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) size_t len; int blksz, error, ivlen, r, resid; + csp = crypto_get_params(crp->crp_session); swa = &ses->swcr_auth; axf = swa->sw_axf; @@ -721,10 +725,13 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) KASSERT(axf->blocksize == exf->native_blocksize, ("%s: blocksize mismatch", __func__)); + if (crp->crp_payload_length > ccm_max_payload_length(csp)) + return (EMSGSIZE); + if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) return (EINVAL); - ivlen = AES_CCM_IV_LEN; + ivlen = csp->csp_ivlen; /* * AES CCM-CBC-MAC needs to know the length of both the auth @@ -1130,7 +1137,6 @@ swcr_setup_cipher(struct swcr_session *ses, swe = &ses->swcr_encdec; txf = crypto_cipher(csp); - MPASS(txf->ivsize == csp->csp_ivlen); if (txf->ctxsize != 0) { swe->sw_kschedule = malloc(txf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); @@ -1282,9 +1288,6 @@ swcr_setup_ccm(struct swcr_session *ses, struct swcr_auth *swa; struct auth_hash *axf; - if (csp->csp_ivlen != AES_CCM_IV_LEN) - return (EINVAL); - /* First, setup the auth side. */ swa = &ses->swcr_auth; switch (csp->csp_cipher_klen * 8) { @@ -1392,8 +1395,6 @@ swcr_auth_supported(const struct crypto_session_params *csp) } if (csp->csp_auth_key == NULL) return (false); - if (csp->csp_ivlen != AES_CCM_IV_LEN) - return (false); break; } return (true); diff --git a/sys/opencrypto/xform_aes_icm.c b/sys/opencrypto/xform_aes_icm.c index 45da8267ca7d..4126bd755e0c 100644 --- a/sys/opencrypto/xform_aes_icm.c +++ b/sys/opencrypto/xform_aes_icm.c @@ -144,15 +144,14 @@ aes_ccm_reinit(void *key, const uint8_t *iv, size_t ivlen) { struct aes_icm_ctx *ctx; - KASSERT(ivlen == AES_CCM_IV_LEN, + KASSERT(ivlen >= 7 && ivlen <= 13, ("%s: invalid IV length", __func__)); ctx = key; /* CCM has flags, then the IV, then the counter, which starts at 1 */ bzero(ctx->ac_block, sizeof(ctx->ac_block)); - /* 3 bytes for length field; this gives a nonce of 12 bytes */ - ctx->ac_block[0] = (15 - AES_CCM_IV_LEN) - 1; - bcopy(iv, ctx->ac_block+1, AES_CCM_IV_LEN); + ctx->ac_block[0] = (15 - ivlen) - 1; + bcopy(iv, ctx->ac_block + 1, ivlen); ctx->ac_block[AESICM_BLOCKSIZE - 1] = 1; } From nobody Thu Oct 21 22:04:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8D55B1801437; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jD0dDkz3tL5; Thu, 21 Oct 2021 22:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B54BD230A4; Thu, 21 Oct 2021 22:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4FvV079506; Thu, 21 Oct 2021 22:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4FP7079505; Thu, 21 Oct 2021 22:04:15 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:15 GMT Message-Id: <202110212204.19LM4FP7079505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8581b350dda4 - stable/13 - cryptocheck: Support multiple IV sizes for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8581b350dda4eb8c46f92949b8def97454f63ae0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8581b350dda4eb8c46f92949b8def97454f63ae0 commit 8581b350dda4eb8c46f92949b8def97454f63ae0 Author: John Baldwin AuthorDate: 2021-10-06 21:08:47 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:07:24 +0000 cryptocheck: Support multiple IV sizes for AES-CCM. By default, the "normal" IV size (12) is used, but it can be overriden via -I. If -I is not specified and -z is specified, issue requests for all possible IV sizes. Reviewed by: markj Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32110 (cherry picked from commit bcb0fd6accc095295765b08b02f5f3b07ea62536) --- tools/tools/crypto/cryptocheck.c | 236 ++++++++++++++++++++++++++------------- 1 file changed, 156 insertions(+), 80 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index 502ea04cd661..63c6ce1f9d28 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -1,8 +1,12 @@ /*- * Copyright (c) 2017 Chelsio Communications, Inc. * All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation * Written by: John Baldwin * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -65,7 +69,8 @@ * operation once in software via OpenSSL and a second time via * OpenCrypto and compares the results. * - * cryptocheck [-vz] [-A aad length] [-a algorithm] [-d dev] [size ...] + * cryptocheck [-vz] [-A aad length] [-a algorithm] [-d dev] [-I IV length] + * [size ...] * * Options: * -v Verbose. @@ -153,6 +158,7 @@ static const struct alg { enum { T_HASH, T_HMAC, T_GMAC, T_DIGEST, T_CIPHER, T_ETA, T_AEAD } type; int key_len; int tag_len; + u_int iv_sizes[8]; const EVP_CIPHER *(*evp_cipher)(void); const EVP_MD *(*evp_md)(void); int pkey; @@ -208,34 +214,41 @@ static const struct alg { { .name = "chacha20", .cipher = CRYPTO_CHACHA20, .type = T_CIPHER, .evp_cipher = EVP_chacha20 }, { .name = "aes-gcm", .cipher = CRYPTO_AES_NIST_GCM_16, .type = T_AEAD, - .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_128_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .iv_sizes = { AES_GCM_IV_LEN }, + .evp_cipher = EVP_aes_128_gcm }, { .name = "aes-gcm192", .cipher = CRYPTO_AES_NIST_GCM_16, .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, - .evp_cipher = EVP_aes_192_gcm }, + .iv_sizes = { AES_GCM_IV_LEN }, .evp_cipher = EVP_aes_192_gcm }, { .name = "aes-gcm256", .cipher = CRYPTO_AES_NIST_GCM_16, .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, - .evp_cipher = EVP_aes_256_gcm }, + .iv_sizes = { AES_GCM_IV_LEN }, .evp_cipher = EVP_aes_256_gcm }, { .name = "aes-ccm", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_128_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, + .tag_len = AES_CBC_MAC_HASH_LEN, .iv_sizes = { 12, 7, 8, 9, 10, 11, 13 }, + .evp_cipher = EVP_aes_128_ccm }, { .name = "aes-ccm192", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_192_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, + .tag_len = AES_CBC_MAC_HASH_LEN, .iv_sizes = { 12, 7, 8, 9, 10, 11, 13 }, + .evp_cipher = EVP_aes_192_ccm }, { .name = "aes-ccm256", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_256_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, + .tag_len = AES_CBC_MAC_HASH_LEN, .iv_sizes = { 12, 7, 8, 9, 10, 11, 13 }, + .evp_cipher = EVP_aes_256_ccm }, { .name = "chacha20-poly1305", .cipher = CRYPTO_CHACHA20_POLY1305, .type = T_AEAD, .tag_len = POLY1305_HASH_LEN, + .iv_sizes = { CHACHA20_POLY1305_IV_LEN }, .evp_cipher = EVP_chacha20_poly1305 }, }; -static bool verbose; +static bool testall, verbose; static int requested_crid; static size_t aad_sizes[48], sizes[EALG_MAX_BLOCK_LEN * 2]; static u_int naad_sizes, nsizes; +static u_int iv_size; static void usage(void) { fprintf(stderr, - "usage: cryptocheck [-z] [-a algorithm] [-d dev] [size ...]\n"); + "usage: cryptocheck [-vz] [-A aad size] [-a algorithm]\n" + " [-d dev] [-I IV size] [size ...]\n"); exit(1); } @@ -1218,8 +1231,8 @@ out: static void openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, - const char *key, const char *iv, const char *aad, size_t aad_len, - const char *input, char *output, size_t size, char *tag) + const char *key, const char *iv, size_t iv_len, const char *aad, + size_t aad_len, const char *input, char *output, size_t size, char *tag) { EVP_CIPHER_CTX *ctx; int outl, total; @@ -1228,7 +1241,13 @@ openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if (ctx == NULL) errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_EncryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) + errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, (const u_char *)iv) != 1) errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1314,54 +1333,67 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, ctx = EVP_CIPHER_CTX_new(); if (ctx == NULL) - errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx new failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) - errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, + "OpenSSL %s/%zu (%zu, %zu) setting iv length failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) - errx(1, "OpenSSL %s (%zu) setting tag length failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, + "OpenSSL %s/%zu (%zu, %zu) setting tag length failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, (const u_char *)iv) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (EVP_EncryptUpdate(ctx, NULL, &outl, NULL, size) != 1) - errx(1, "OpenSSL %s (%zu) unable to set data length: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, + "OpenSSL %s/%zu (%zu, %zu) unable to set data length: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); if (aad != NULL) { if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)aad, aad_len) != 1) - errx(1, "OpenSSL %s (%zu) aad update failed: %s", - alg->name, size, + errx(1, + "OpenSSL %s/%zu (%zu, %zu) aad update failed: %s", + alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); } if (EVP_EncryptUpdate(ctx, (u_char *)output, &outl, (const u_char *)input, size) != 1) - errx(1, "OpenSSL %s (%zu) encrypt update failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt update failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); total = outl; if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) - errx(1, "OpenSSL %s (%zu) encrypt final failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt final failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); total += outl; if ((size_t)total != size) - errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, - size, total); + errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt size mismatch: %d", + alg->name, iv_len, aad_len, size, total); if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_CBC_MAC_HASH_LEN, tag) != 1) - errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, - size, ERR_error_string(ERR_get_error(), NULL)); + errx(1, "OpenSSL %s/%zu (%zu, %zu) get tag failed: %s", + alg->name, iv_len, aad_len, size, + ERR_error_string(ERR_get_error(), NULL)); EVP_CIPHER_CTX_free(ctx); } static bool ocf_init_aead_session(const struct alg *alg, const char *key, size_t key_len, - struct ocf_session *ses) + size_t iv_len, struct ocf_session *ses) { struct session2_op sop; @@ -1369,6 +1401,7 @@ ocf_init_aead_session(const struct alg *alg, const char *key, size_t key_len, sop.keylen = key_len; sop.key = key; sop.cipher = alg->cipher; + sop.ivlen = iv_len; return (ocf_init_session(&sop, "AEAD", alg->name, ses)); } @@ -1398,14 +1431,43 @@ ocf_aead(const struct ocf_session *ses, const char *iv, size_t iv_len, #define AEAD_MAX_TAG_LEN \ MAX(MAX(AES_GMAC_HASH_LEN, AES_CBC_MAC_HASH_LEN), POLY1305_HASH_LEN) +static size_t +max_ccm_buffer_length(size_t iv_len) +{ + const u_int L = 15 - iv_len; + + switch (L) { + case 2: + return (0xffff); + case 3: + return (0xffffff); +#ifdef __LP64__ + case 4: + return (0xffffffff); + case 5: + return (0xffffffffff); + case 6: + return (0xffffffffffff); + case 7: + return (0xffffffffffffff); + default: + return (0xffffffffffffffff); +#else + default: + return (0xffffffff); +#endif + } +} + static void -run_aead_test(const struct alg *alg, size_t aad_len, size_t size) +run_aead_test(const struct alg *alg, size_t aad_len, size_t size, + size_t iv_len) { struct ocf_session ses; const EVP_CIPHER *cipher; char *aad, *buffer, *cleartext, *ciphertext; char *iv, *key; - u_int iv_len, key_len; + u_int key_len; int error; char control_tag[AEAD_MAX_TAG_LEN], test_tag[AEAD_MAX_TAG_LEN]; @@ -1413,31 +1475,25 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) if (size % EVP_CIPHER_block_size(cipher) != 0) { if (verbose) printf( - "%s (%zu, %zu): invalid buffer size (block size %d)\n", - alg->name, aad_len, size, + "%s/%zu (%zu, %zu): invalid buffer size (block size %d)\n", + alg->name, iv_len, aad_len, size, EVP_CIPHER_block_size(cipher)); return; } - memset(control_tag, 0x3c, sizeof(control_tag)); - memset(test_tag, 0x3c, sizeof(test_tag)); - - key_len = EVP_CIPHER_key_length(cipher); - iv_len = EVP_CIPHER_iv_length(cipher); - - /* - * AES-CCM can have varying IV lengths; however, for the moment - * we only support AES_CCM_IV_LEN (12). So if the sizes are - * different, we'll fail. - */ if (EVP_CIPHER_mode(cipher) == EVP_CIPH_CCM_MODE && - iv_len != AES_CCM_IV_LEN) { + size > max_ccm_buffer_length(iv_len)) { if (verbose) - printf("OpenSSL CCM IV length (%d) != AES_CCM_IV_LEN", - iv_len); + printf("%s/%zu (%zu, %zu): invalid buffer size\n", + alg->name, iv_len, aad_len, size); return; } + memset(control_tag, 0x3c, sizeof(control_tag)); + memset(test_tag, 0x3c, sizeof(test_tag)); + + key_len = EVP_CIPHER_key_length(cipher); + key = alloc_buffer(key_len); iv = generate_iv(iv_len, alg); cleartext = alloc_buffer(size); @@ -1453,23 +1509,23 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) openssl_ccm_encrypt(alg, cipher, key, iv, iv_len, aad, aad_len, cleartext, ciphertext, size, control_tag); else - openssl_aead_encrypt(alg, cipher, key, iv, aad, aad_len, - cleartext, ciphertext, size, control_tag); + openssl_aead_encrypt(alg, cipher, key, iv, iv_len, aad, + aad_len, cleartext, ciphertext, size, control_tag); - if (!ocf_init_aead_session(alg, key, key_len, &ses)) + if (!ocf_init_aead_session(alg, key, key_len, iv_len, &ses)) goto out; /* OCF encrypt */ error = ocf_aead(&ses, iv, iv_len, aad, aad_len, cleartext, buffer, size, test_tag, COP_ENCRYPT); if (error != 0) { - warnc(error, "cryptodev %s (%zu, %zu) failed for device %s", - alg->name, aad_len, size, crfind(ses.crid)); + warnc(error, "cryptodev %s/%zu (%zu, %zu) failed for device %s", + alg->name, iv_len, aad_len, size, crfind(ses.crid)); goto out; } if (memcmp(ciphertext, buffer, size) != 0) { - printf("%s (%zu, %zu) encryption mismatch:\n", alg->name, - aad_len, size); + printf("%s/%zu (%zu, %zu) encryption mismatch:\n", alg->name, + iv_len, aad_len, size); printf("control:\n"); hexdump(ciphertext, size, NULL, 0); printf("test (cryptodev device %s):\n", crfind(ses.crid)); @@ -1477,8 +1533,8 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) goto out; } if (memcmp(control_tag, test_tag, sizeof(control_tag)) != 0) { - printf("%s (%zu, %zu) enc tag mismatch:\n", alg->name, aad_len, - size); + printf("%s/%zu (%zu, %zu) enc tag mismatch:\n", alg->name, + iv_len, aad_len, size); printf("control:\n"); hexdump(control_tag, sizeof(control_tag), NULL, 0); printf("test (cryptodev device %s):\n", crfind(ses.crid)); @@ -1490,13 +1546,13 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) error = ocf_aead(&ses, iv, iv_len, aad, aad_len, ciphertext, buffer, size, control_tag, COP_DECRYPT); if (error != 0) { - warnc(error, "cryptodev %s (%zu, %zu) failed for device %s", - alg->name, aad_len, size, crfind(ses.crid)); + warnc(error, "cryptodev %s/%zu (%zu, %zu) failed for device %s", + alg->name, iv_len, aad_len, size, crfind(ses.crid)); goto out; } if (memcmp(cleartext, buffer, size) != 0) { - printf("%s (%zu, %zu) decryption mismatch:\n", alg->name, - aad_len, size); + printf("%s/%zu (%zu, %zu) decryption mismatch:\n", alg->name, + iv_len, aad_len, size); printf("control:\n"); hexdump(cleartext, size, NULL, 0); printf("test (cryptodev device %s):\n", crfind(ses.crid)); @@ -1511,18 +1567,18 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) if (error != EBADMSG) { if (error != 0) warnc(error, - "cryptodev %s (%zu, %zu) corrupt tag failed for device %s", - alg->name, aad_len, size, crfind(ses.crid)); + "cryptodev %s/%zu (%zu, %zu) corrupt tag failed for device %s", + alg->name, iv_len, aad_len, size, crfind(ses.crid)); else warnx( - "cryptodev %s (%zu, %zu) corrupt tag didn't fail for device %s", - alg->name, aad_len, size, crfind(ses.crid)); + "cryptodev %s/%zu (%zu, %zu) corrupt tag didn't fail for device %s", + alg->name, iv_len, aad_len, size, crfind(ses.crid)); goto out; } if (verbose) - printf("%s (%zu, %zu) matched (cryptodev device %s)\n", - alg->name, aad_len, size, crfind(ses.crid)); + printf("%s/%zu (%zu, %zu) matched (cryptodev device %s)\n", + alg->name, iv_len, aad_len, size, crfind(ses.crid)); out: ocf_destroy_session(&ses); @@ -1535,7 +1591,7 @@ out: } static void -run_test(const struct alg *alg, size_t aad_len, size_t size) +run_test(const struct alg *alg, size_t aad_len, size_t size, size_t iv_len) { switch (alg->type) { @@ -1558,7 +1614,7 @@ run_test(const struct alg *alg, size_t aad_len, size_t size) run_eta_test(alg, aad_len, size); break; case T_AEAD: - run_aead_test(alg, aad_len, size); + run_aead_test(alg, aad_len, size, iv_len); break; } } @@ -1566,18 +1622,33 @@ run_test(const struct alg *alg, size_t aad_len, size_t size) static void run_test_sizes(const struct alg *alg) { - u_int i, j; + u_int i, j, k; switch (alg->type) { default: for (i = 0; i < nsizes; i++) - run_test(alg, 0, sizes[i]); + run_test(alg, 0, sizes[i], 0); break; case T_ETA: - case T_AEAD: for (i = 0; i < naad_sizes; i++) for (j = 0; j < nsizes; j++) - run_test(alg, aad_sizes[i], sizes[j]); + run_test(alg, aad_sizes[i], sizes[j], 0); + break; + case T_AEAD: + for (i = 0; i < naad_sizes; i++) { + for (j = 0; j < nsizes; j++) { + if (iv_size != 0) + run_test(alg, aad_sizes[i], sizes[j], + iv_size); + else if (testall) { + for (k = 0; alg->iv_sizes[k] != 0; k++) + run_test(alg, aad_sizes[i], + sizes[j], alg->iv_sizes[k]); + } else + run_test(alg, aad_sizes[i], sizes[j], + alg->iv_sizes[0]); + } + } break; } } @@ -1654,14 +1725,14 @@ main(int ac, char **av) char *cp; size_t base_size; u_int i; - bool testall; int ch; algname = NULL; requested_crid = CRYPTO_FLAG_HARDWARE; testall = false; verbose = false; - while ((ch = getopt(ac, av, "A:a:d:vz")) != -1) + iv_size = 0; + while ((ch = getopt(ac, av, "A:a:d:I:vz")) != -1) switch (ch) { case 'A': if (naad_sizes >= nitems(aad_sizes)) { @@ -1679,6 +1750,11 @@ main(int ac, char **av) case 'd': requested_crid = crlookup(optarg); break; + case 'I': + iv_size = strtol(optarg, &cp, 0); + if (*cp != '\0') + errx(1, "Bad IV size %s", optarg); + break; case 'v': verbose = true; break; From nobody Thu Oct 21 22:04:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C8C8C180163C; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jP1mNHz3tWR; Thu, 21 Oct 2021 22:04:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0FFF22C5F; Thu, 21 Oct 2021 22:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4N10079680; Thu, 21 Oct 2021 22:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4Nbk079679; Thu, 21 Oct 2021 22:04:23 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:23 GMT Message-Id: <202110212204.19LM4Nbk079679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 12d5e71fb5c3 - stable/13 - ccr: Support AES-CCM requests with truncated tags. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 12d5e71fb5c35113ca0ead049f7285a4e6fab30f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=12d5e71fb5c35113ca0ead049f7285a4e6fab30f commit 12d5e71fb5c35113ca0ead049f7285a4e6fab30f Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:17:09 +0000 ccr: Support AES-CCM requests with truncated tags. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32117 (cherry picked from commit e148e407df5c8b1c83bcd44da9f4837d94431d02) --- sys/dev/cxgbe/crypto/t4_crypto.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 6d5f82f6857c..24287638b376 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1524,6 +1524,29 @@ out: crypto_done(crp); } +static int +ccr_ccm_hmac_ctrl(unsigned int authsize) +{ + switch (authsize) { + case 4: + return (SCMD_HMAC_CTRL_PL1); + case 6: + return (SCMD_HMAC_CTRL_PL2); + case 8: + return (SCMD_HMAC_CTRL_DIV2); + case 10: + return (SCMD_HMAC_CTRL_TRUNC_RFC4366); + case 12: + return (SCMD_HMAC_CTRL_IPSEC_96BIT); + case 14: + return (SCMD_HMAC_CTRL_PL3); + case 16: + return (SCMD_HMAC_CTRL_NO_TRUNC); + default: + __assert_unreachable(); + } +} + static void generate_ccm_b0(struct cryptop *crp, u_int hash_size_in_response, const char *iv, char *b0) @@ -1783,7 +1806,7 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) V_CPL_TX_SEC_PDU_AUTHINSERT(auth_insert)); /* These two flits are actually a CPL_TLS_TX_SCMD_FMT. */ - hmac_ctrl = ccr_hmac_ctrl(AES_CBC_MAC_HASH_LEN, hash_size_in_response); + hmac_ctrl = ccr_ccm_hmac_ctrl(hash_size_in_response); crwr->sec_cpl.seqno_numivs = htobe32( V_SCMD_SEQ_NO_CTRL(0) | V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | @@ -2459,9 +2482,6 @@ ccr_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CRYPTO_AES_CCM_16: - if (csp->csp_auth_mlen < 0 || - csp->csp_auth_mlen > AES_CBC_MAC_HASH_LEN) - return (EINVAL); break; default: return (EINVAL); From nobody Thu Oct 21 22:04:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 91F381801698; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jM2qcHz3tNS; Thu, 21 Oct 2021 22:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95BCD22E1E; Thu, 21 Oct 2021 22:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4M8i079656; Thu, 21 Oct 2021 22:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4M1B079655; Thu, 21 Oct 2021 22:04:22 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:22 GMT Message-Id: <202110212204.19LM4M1B079655@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 61c8f61518c5 - stable/13 - ccr: Support multiple nonce lengths for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 61c8f61518c5f230d76690cc57e01b6e735c760f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=61c8f61518c5f230d76690cc57e01b6e735c760f commit 61c8f61518c5f230d76690cc57e01b6e735c760f Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:16:54 +0000 ccr: Support multiple nonce lengths for AES-CCM. Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32116 (cherry picked from commit 3e6a97b3a7bc80b1c12dd7b5208bfe99019c42b4) --- sys/dev/cxgbe/crypto/t4_crypto.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 33c03c3903e5..6d5f82f6857c 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1528,17 +1528,18 @@ static void generate_ccm_b0(struct cryptop *crp, u_int hash_size_in_response, const char *iv, char *b0) { - u_int i, payload_len; + u_int i, payload_len, L; /* NB: L is already set in the first byte of the IV. */ memcpy(b0, iv, CCM_B0_SIZE); + L = iv[0] + 1; /* Set length of hash in bits 3 - 5. */ b0[0] |= (((hash_size_in_response - 2) / 2) << 3); /* Store the payload length as a big-endian value. */ payload_len = crp->crp_payload_length; - for (i = 0; i < iv[0]; i++) { + for (i = 0; i < L; i++) { b0[CCM_CBC_BLOCK_LEN - 1 - i] = payload_len; payload_len >>= 8; } @@ -1559,6 +1560,7 @@ static int ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) { char iv[CHCR_MAX_CRYPTO_IV_LEN]; + const struct crypto_session_params *csp; struct ulptx_idata *idata; struct chcr_wr *crwr; struct wrqe *wr; @@ -1571,6 +1573,8 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) int sgl_nsegs, sgl_len; int error; + csp = crypto_get_params(crp->crp_session); + if (s->blkcipher.key_len == 0) return (EINVAL); @@ -1581,6 +1585,10 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) if (crp->crp_payload_length == 0) return (EMSGSIZE); + /* The length has to fit within the length field in block 0. */ + if (crp->crp_payload_length > ccm_max_payload_length(csp)) + return (EMSGSIZE); + /* * CCM always includes block 0 in the AAD before AAD from the * request. @@ -1598,9 +1606,8 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) return (EINVAL); /* - * Always assume a 12 byte input nonce for now since that is - * what OCF always generates. The full IV in the work request - * is 16 bytes. + * The IV in the work request is 16 bytes and not just the + * nonce. */ iv_len = AES_BLOCK_LEN; @@ -1745,7 +1752,7 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) * the full IV with the counter set to 0. */ memset(iv, 0, iv_len); - iv[0] = (15 - AES_CCM_IV_LEN) - 1; + iv[0] = (15 - csp->csp_ivlen) - 1; crypto_read_iv(crp, iv + 1); ccr_populate_wreq(sc, s, crwr, kctx_len, wr_len, imm_len, sgl_len, 0, @@ -1868,6 +1875,7 @@ ccr_ccm_done(struct ccr_softc *sc, struct ccr_session *s, static void ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) { + const struct crypto_session_params *csp; struct auth_hash *axf; struct enc_xform *exf; union authctx *auth_ctx; @@ -1879,6 +1887,12 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) auth_ctx = NULL; kschedule = NULL; + csp = crypto_get_params(crp->crp_session); + if (crp->crp_payload_length > ccm_max_payload_length(csp)) { + error = EMSGSIZE; + goto out; + } + /* Initialize the MAC. */ switch (s->blkcipher.key_len) { case 16: @@ -1921,7 +1935,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) auth_ctx->aes_cbc_mac_ctx.authDataLength = crp->crp_aad_length; auth_ctx->aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; - axf->Reinit(auth_ctx, crp->crp_iv, AES_CCM_IV_LEN); + axf->Reinit(auth_ctx, crp->crp_iv, csp->csp_ivlen); /* MAC the AAD. */ if (crp->crp_aad != NULL) @@ -1933,7 +1947,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) if (error) goto out; - exf->reinit(kschedule, crp->crp_iv, AES_CCM_IV_LEN); + exf->reinit(kschedule, crp->crp_iv, csp->csp_ivlen); /* Do encryption/decryption with MAC */ for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { @@ -1968,7 +1982,7 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) error = 0; /* Tag matches, decrypt data. */ - exf->reinit(kschedule, crp->crp_iv, AES_CCM_IV_LEN); + exf->reinit(kschedule, crp->crp_iv, csp->csp_ivlen); for (i = 0; i < crp->crp_payload_length; i += sizeof(block)) { len = imin(crp->crp_payload_length - i, @@ -2445,8 +2459,6 @@ ccr_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CRYPTO_AES_CCM_16: - if (csp->csp_ivlen != AES_CCM_IV_LEN) - return (EINVAL); if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > AES_CBC_MAC_HASH_LEN) return (EINVAL); From nobody Thu Oct 21 22:04:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 78BD218016BB; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jR2FPxz3tfw; Thu, 21 Oct 2021 22:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC5912303F; Thu, 21 Oct 2021 22:04:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4OEQ079704; Thu, 21 Oct 2021 22:04:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4Ohx079703; Thu, 21 Oct 2021 22:04:24 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:24 GMT Message-Id: <202110212204.19LM4Ohx079703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cfa1d2c9b987 - stable/13 - safexcel: Support multiple nonce lengths for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: cfa1d2c9b9876bc97322cd4e68bf10fbd0b0b6d4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cfa1d2c9b9876bc97322cd4e68bf10fbd0b0b6d4 commit cfa1d2c9b9876bc97322cd4e68bf10fbd0b0b6d4 Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:17:14 +0000 safexcel: Support multiple nonce lengths for AES-CCM. Reviewed by: markj Sponsored by: Chelsio Communications, The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32118 (cherry picked from commit 2ec2e4df094ba632e5e74268a8818f71903a4537) --- sys/dev/safexcel/safexcel.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 71300dcb0393..9a9b0ab0cb74 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2,6 +2,10 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2020, 2021 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Ararat River + * Consulting, LLC under sponsorship of the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1689,12 +1693,14 @@ static void safexcel_instr_ccm(struct safexcel_request *req, struct safexcel_instr *instr, struct safexcel_cmd_descr *cdesc) { + const struct crypto_session_params *csp; struct cryptop *crp; struct safexcel_instr *start; uint8_t *a0, *b0, *alenp, L; int aalign, blen; crp = req->crp; + csp = crypto_get_params(crp->crp_session); start = instr; /* @@ -1703,17 +1709,17 @@ safexcel_instr_ccm(struct safexcel_request *req, struct safexcel_instr *instr, * descriptor, and B0 is inserted directly into the data stream using * instructions below. * - * OCF seems to assume a 12-byte IV, fixing L (the payload length size) - * at 3 bytes due to the layout of B0. This is fine since the driver - * has a maximum of 65535 bytes anyway. + * An explicit check for overflow of the length field is not + * needed since the maximum driver size of 65535 bytes fits in + * the smallest length field used for a 13-byte nonce. */ blen = AES_BLOCK_LEN; - L = 3; + L = 15 - csp->csp_ivlen; a0 = (uint8_t *)&cdesc->control_data.token[0]; memset(a0, 0, blen); a0[0] = L - 1; - memcpy(&a0[1], req->iv, AES_CCM_IV_LEN); + memcpy(&a0[1], req->iv, csp->csp_ivlen); /* * Insert B0 and the AAD length into the input stream. @@ -1731,7 +1737,7 @@ safexcel_instr_ccm(struct safexcel_request *req, struct safexcel_instr *instr, (L - 1) | /* payload length size */ ((CCM_CBC_MAX_DIGEST_LEN - 2) / 2) << 3 /* digest length */ | (crp->crp_aad_length > 0 ? 1 : 0) << 6 /* AAD present bit */; - memcpy(&b0[1], req->iv, AES_CCM_IV_LEN); + memcpy(&b0[1], req->iv, csp->csp_ivlen); b0[14] = crp->crp_payload_length >> 8; b0[15] = crp->crp_payload_length & 0xff; instr += blen / sizeof(*instr); @@ -2308,7 +2314,8 @@ safexcel_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CRYPTO_AES_CCM_16: - if (csp->csp_ivlen != AES_CCM_IV_LEN) + if (csp->csp_auth_mlen != 0 && + csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN) return (EINVAL); break; default: From nobody Thu Oct 21 22:04:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1E2051801992; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jW2ndKz3tgX; Thu, 21 Oct 2021 22:04:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 524EC22E1F; Thu, 21 Oct 2021 22:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4Ska079782; Thu, 21 Oct 2021 22:04:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4SRc079781; Thu, 21 Oct 2021 22:04:28 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:28 GMT Message-Id: <202110212204.19LM4SRc079781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: dffa7f13db78 - stable/13 - crypto: Test all of the AES-CCM KAT vectors. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: dffa7f13db7855941b270caa6fc5ec72becb07bc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dffa7f13db7855941b270caa6fc5ec72becb07bc commit dffa7f13db7855941b270caa6fc5ec72becb07bc Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:19:24 +0000 crypto: Test all of the AES-CCM KAT vectors. Previously, only test vectors which used the default nonce and tag sizes (12 and 16, respectively) were tested. This now tests all of the vectors. This exposed some additional issues around requests with an empty payload (which wasn't supported) and an empty AAD (which falls back to CIOCCRYPT instead of CIOCCRYPTAEAD). - Make use of the 'ivlen' and 'maclen' fields for CIOGSESSION2 to test AES-CCM vectors with non-default nonce and tag lengths. - Permit requests with an empty payload. - Permit an input MAC for requests without AAD. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32121 (cherry picked from commit 668770dc7de2ec8b5f5edf71e09b8a404120f6fa) --- tests/sys/opencrypto/cryptodev.py | 54 +++++++++++++++++++++++++++----------- tests/sys/opencrypto/cryptotest.py | 41 ++++++++++++----------------- 2 files changed, 56 insertions(+), 39 deletions(-) diff --git a/tests/sys/opencrypto/cryptodev.py b/tests/sys/opencrypto/cryptodev.py index 83d14fc2b205..d97a731d37ba 100644 --- a/tests/sys/opencrypto/cryptodev.py +++ b/tests/sys/opencrypto/cryptodev.py @@ -79,10 +79,10 @@ class SessionOp2(dpkt.Packet): ('mackey', 'P', 0), ('ses', 'I', 0), ('crid', 'i', 0), + ('ivlen', 'i', 0), + ('maclen', 'i', 0), ('pad0', 'i', 0), ('pad1', 'i', 0), - ('pad2', 'i', 0), - ('pad3', 'i', 0), ) class CryptOp(dpkt.Packet): @@ -159,6 +159,11 @@ def array_tobytes(array_obj): return array_obj.tobytes() return array_obj.tostring() +def empty_bytes(): + if sys.version_info[0] >= 3: + return b'' + return "" + class Crypto: @staticmethod def findcrid(name): @@ -169,7 +174,8 @@ class Crypto: return _findop(crid, '')[1] def __init__(self, cipher=0, key=None, mac=0, mackey=None, - crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE, maclen=None): + crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE, maclen=None, + ivlen=None): self._ses = None self._maclen = maclen ses = SessionOp2() @@ -191,6 +197,10 @@ class Crypto: if not cipher and not mac: raise ValueError('one of cipher or mac MUST be specified.') ses.crid = crid + if ivlen: + ses.ivlen = ivlen + if maclen: + ses.maclen = maclen #print(ses) s = array.array('B', ses.pack_hdr()) #print(s) @@ -209,16 +219,23 @@ class Crypto: pass self._ses = None - def _doop(self, op, src, iv): + def _doop(self, op, src, iv, mac=None): cop = CryptOp() cop.ses = self._ses cop.op = op cop.flags = 0 - cop.len = len(src) - s = array.array('B', src) - cop.src = cop.dst = s.buffer_info()[0] + if src is not None: + cop.len = len(src) + s = array.array('B', src) + cop.src = cop.dst = s.buffer_info()[0] + if mac is not None: + assert len(mac) == self._maclen, \ + '%d != %d' % (len(tag), self._maclen) if self._maclen is not None: - m = array.array('B', [0] * self._maclen) + if mac is None: + m = array.array('B', [0] * self._maclen) + else: + m = array.array('B', mac) cop.mac = m.buffer_info()[0] ivbuf = array.array('B', str_to_ascii(iv)) cop.iv = ivbuf.buffer_info()[0] @@ -226,7 +243,10 @@ class Crypto: #print('cop:', cop) ioctl(_cryptodev, CIOCCRYPT, bytes(cop)) - s = array_tobytes(s) + if src is not None: + s = array_tobytes(s) + else: + s = empty_bytes() if self._maclen is not None: return s, array_tobytes(m) @@ -238,10 +258,11 @@ class Crypto: caead.op = op caead.flags = CRD_F_IV_EXPLICIT caead.flags = 0 - src = str_to_ascii(src) - caead.len = len(src) - s = array.array('B', src) - caead.src = caead.dst = s.buffer_info()[0] + if src is not None and len(src) != 0: + src = str_to_ascii(src) + caead.len = len(src) + s = array.array('B', src) + caead.src = caead.dst = s.buffer_info()[0] aad = str_to_ascii(aad) caead.aadlen = len(aad) saad = array.array('B', aad) @@ -266,7 +287,10 @@ class Crypto: ioctl(_cryptodev, CIOCCRYPTAEAD, bytes(caead)) - s = array_tobytes(s) + if src is not None: + s = array_tobytes(s) + else: + s = empty_bytes() return s, array_tobytes(tag) @@ -320,7 +344,7 @@ class Crypto: def decrypt(self, data, iv, aad=None, tag=None): if aad is None: - return self._doop(COP_DECRYPT, data, iv) + return self._doop(COP_DECRYPT, data, iv, mac=tag) else: return self._doaead(COP_DECRYPT, data, aad, iv, tag=tag) diff --git a/tests/sys/opencrypto/cryptotest.py b/tests/sys/opencrypto/cryptotest.py index 2ef423ac1505..74ce62cee33d 100644 --- a/tests/sys/opencrypto/cryptotest.py +++ b/tests/sys/opencrypto/cryptotest.py @@ -243,25 +243,26 @@ def GenTestCase(cname): def runCCMEncryptWithParser(self, parser): for data in next(parser): Nlen = int(data['Nlen']) - if Nlen != 12: - # OCF only supports 12 byte IVs - continue + Tlen = int(data['Tlen']) key = binascii.unhexlify(data['Key']) nonce = binascii.unhexlify(data['Nonce']) Alen = int(data['Alen']) + Plen = int(data['Plen']) if Alen != 0: aad = binascii.unhexlify(data['Adata']) else: aad = None - payload = binascii.unhexlify(data['Payload']) + if Plen != 0: + payload = binascii.unhexlify(data['Payload']) + else: + payload = None ct = binascii.unhexlify(data['CT']) try: c = Crypto(crid=crid, cipher=cryptodev.CRYPTO_AES_CCM_16, key=key, - mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC, - mackey=key, maclen=16) + mackey=key, maclen=Tlen, ivlen=Nlen) r, tag = Crypto.encrypt(c, payload, nonce, aad) except EnvironmentError as e: @@ -280,36 +281,29 @@ def GenTestCase(cname): self.runCCMDecryptWithParser(parser) def runCCMDecryptWithParser(self, parser): - # XXX: Note that all of the current CCM - # decryption test vectors use IV and tag sizes - # that aren't supported by OCF none of the - # tests are actually ran. for data in next(parser): Nlen = int(data['Nlen']) - if Nlen != 12: - # OCF only supports 12 byte IVs - continue Tlen = int(data['Tlen']) - if Tlen != 16: - # OCF only supports 16 byte tags - continue key = binascii.unhexlify(data['Key']) nonce = binascii.unhexlify(data['Nonce']) Alen = int(data['Alen']) + Plen = int(data['Plen']) if Alen != 0: aad = binascii.unhexlify(data['Adata']) else: aad = None ct = binascii.unhexlify(data['CT']) - tag = ct[-16:] - ct = ct[:-16] + tag = ct[-Tlen:] + if Plen != 0: + payload = ct[:-Tlen] + else: + payload = None try: c = Crypto(crid=crid, cipher=cryptodev.CRYPTO_AES_CCM_16, key=key, - mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC, - mackey=key, maclen=16) + mackey=key, maclen=Tlen, ivlen=Nlen) except EnvironmentError as e: if e.errno != errno.EOPNOTSUPP: raise @@ -319,12 +313,11 @@ def GenTestCase(cname): self.assertRaises(IOError, c.decrypt, payload, nonce, aad, tag) else: - r = Crypto.decrypt(c, payload, nonce, - aad, tag) + r, tag = Crypto.decrypt(c, payload, nonce, + aad, tag) payload = binascii.unhexlify(data['Payload']) - plen = int(data('Plen')) - payload = payload[:plen] + payload = payload[:Plen] self.assertEqual(r, payload, "Count " + data['Count'] + \ " Actual: " + repr(binascii.hexlify(r)) + \ From nobody Thu Oct 21 22:04:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DE9DD18016F2; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jY134pz3tgg; Thu, 21 Oct 2021 22:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 680DB22CD8; Thu, 21 Oct 2021 22:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4TIm079806; Thu, 21 Oct 2021 22:04:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4TcE079805; Thu, 21 Oct 2021 22:04:29 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:29 GMT Message-Id: <202110212204.19LM4TcE079805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 64c043d2d2cf - stable/13 - crypto: Support Chacha20-Poly1305 with a nonce size of 8 bytes. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 64c043d2d2cfa44128361c9354d1fad023087be8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=64c043d2d2cfa44128361c9354d1fad023087be8 commit 64c043d2d2cfa44128361c9354d1fad023087be8 Author: John Baldwin AuthorDate: 2021-10-06 21:08:49 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:19:30 +0000 crypto: Support Chacha20-Poly1305 with a nonce size of 8 bytes. This is useful for WireGuard which uses a nonce of 8 bytes rather than the 12 bytes used for IPsec and TLS. Note that this also fixes a (should be) harmless bug in ossl(4) where the counter was incorrectly treated as a 64-bit counter instead of a 32-bit counter in terms of wrapping when using a 12 byte nonce. However, this required a single message (TLS record) longer than 64 * (2^32 - 1) bytes (about 256 GB) to trigger. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32122 (cherry picked from commit 42dcd39528c6188a259951e28bbad309234324e4) --- share/man/man7/crypto.7 | 2 +- sys/crypto/openssl/ossl_chacha20.c | 14 ++++++++------ sys/opencrypto/crypto.c | 7 ++++++- sys/opencrypto/cryptosoft.c | 3 --- sys/opencrypto/xform_chacha20_poly1305.c | 31 +++++++++++++++++++++++++------ tools/tools/crypto/cryptocheck.c | 4 ++-- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index d75daa62adcb..c7af22af4deb 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -167,7 +167,7 @@ The following AEAD algorithms are supported: AES Galois/Counter Mode .It Dv CRYPTO_AES_CCM_16 Ta 12, 7-13 Ta 16, 24, 32 Ta 16 Ta AES Counter with CBC-MAC -.It Dv CRYPTO_CHACHA20_POLY1305 Ta 12 Ta 32 Ta 16 Ta +.It Dv CRYPTO_CHACHA20_POLY1305 Ta 12, 8 Ta 32 Ta 16 Ta ChaCha20-Poly1305 .El .Sh SEE ALSO diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index a6f56aca1f8f..aa125121e8b4 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -161,7 +161,8 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, for (i = 0; i < nitems(key); i++) key[i] = CHACHA_U8TOU32(cipher_key + i * 4); - crypto_read_iv(crp, counter + 1); + memset(counter, 0, sizeof(counter)); + crypto_read_iv(crp, counter + (CHACHA_CTR_SIZE - csp->csp_ivlen) / 4); for (i = 1; i < nitems(counter); i++) counter[i] = le32toh(counter[i]); @@ -223,7 +224,7 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, /* Truncate if the 32-bit counter would roll over. */ next_counter = counter[0] + todo / CHACHA_BLK_SIZE; - if (next_counter < counter[0]) { + if (csp->csp_ivlen == 8 && next_counter < counter[0]) { todo -= next_counter * CHACHA_BLK_SIZE; next_counter = 0; } @@ -232,7 +233,7 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, Poly1305_Update(&auth_ctx, out, todo); counter[0] = next_counter; - if (counter[0] == 0) + if (csp->csp_ivlen == 8 && counter[0] == 0) counter[1]++; if (out == block) { @@ -307,7 +308,8 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, for (i = 0; i < nitems(key); i++) key[i] = CHACHA_U8TOU32(cipher_key + i * 4); - crypto_read_iv(crp, counter + 1); + memset(counter, 0, sizeof(counter)); + crypto_read_iv(crp, counter + (CHACHA_CTR_SIZE - csp->csp_ivlen) / 4); for (i = 1; i < nitems(counter); i++) counter[i] = le32toh(counter[i]); @@ -391,7 +393,7 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, /* Truncate if the 32-bit counter would roll over. */ next_counter = counter[0] + todo / CHACHA_BLK_SIZE; - if (next_counter < counter[0]) { + if (csp->csp_ivlen == 8 && next_counter < counter[0]) { todo -= next_counter * CHACHA_BLK_SIZE; next_counter = 0; } @@ -399,7 +401,7 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, ChaCha20_ctr32(out, in, todo, key, counter); counter[0] = next_counter; - if (counter[0] == 0) + if (csp->csp_ivlen == 8 && counter[0] == 0) counter[1]++; if (out == block) { diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index a3a42827d51b..f0fd3fe662a9 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -882,10 +882,15 @@ check_csp(const struct crypto_session_params *csp) return (false); break; case CRYPTO_AES_NIST_GCM_16: - case CRYPTO_CHACHA20_POLY1305: if (csp->csp_auth_mlen > 16) return (false); break; + case CRYPTO_CHACHA20_POLY1305: + if (csp->csp_ivlen != 8 && csp->csp_ivlen != 12) + return (false); + if (csp->csp_auth_mlen > POLY1305_HASH_LEN) + return (false); + break; } break; case CSP_MODE_ETA: diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index fb43a08970c7..567a0f4748d5 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1393,9 +1393,6 @@ swcr_setup_chacha20_poly1305(struct swcr_session *ses, struct swcr_auth *swa; struct auth_hash *axf; - if (csp->csp_ivlen != CHACHA20_POLY1305_IV_LEN) - return (EINVAL); - /* First, setup the auth side. */ swa = &ses->swcr_auth; axf = &auth_hash_chacha20_poly1305; diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index e893287145f2..f593faa9b5ef 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -34,6 +34,7 @@ struct chacha20_poly1305_cipher_ctx { const void *key; uint32_t ic; + bool ietf; char nonce[CHACHA20_POLY1305_IV_LEN]; }; @@ -58,7 +59,8 @@ chacha20_poly1305_reinit(void *vctx, const uint8_t *iv, size_t ivlen) ("%s: invalid nonce length", __func__)); /* Block 0 is used for the poly1305 key. */ - memcpy(ctx->nonce, iv, sizeof(ctx->nonce)); + memcpy(ctx->nonce, iv, ivlen); + ctx->ietf = (ivlen == CHACHA20_POLY1305_IV_LEN); ctx->ic = 1; } @@ -68,8 +70,12 @@ chacha20_poly1305_crypt(void *vctx, const uint8_t *in, uint8_t *out) struct chacha20_poly1305_cipher_ctx *ctx = vctx; int error; - error = crypto_stream_chacha20_ietf_xor_ic(out, in, - CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); + if (ctx->ietf) + error = crypto_stream_chacha20_ietf_xor_ic(out, in, + CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); + else + error = crypto_stream_chacha20_xor_ic(out, in, + CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); KASSERT(error == 0, ("%s failed: %d", __func__, error)); ctx->ic++; } @@ -82,8 +88,12 @@ chacha20_poly1305_crypt_last(void *vctx, const uint8_t *in, uint8_t *out, int error; - error = crypto_stream_chacha20_ietf_xor_ic(out, in, len, ctx->nonce, - ctx->ic, ctx->key); + if (ctx->ietf) + error = crypto_stream_chacha20_ietf_xor_ic(out, in, len, + ctx->nonce, ctx->ic, ctx->key); + else + error = crypto_stream_chacha20_xor_ic(out, in, len, ctx->nonce, + ctx->ic, ctx->key); KASSERT(error == 0, ("%s failed: %d", __func__, error)); } @@ -129,7 +139,16 @@ chacha20_poly1305_Reinit(void *vctx, const uint8_t *nonce, u_int noncelen) struct chacha20_poly1305_auth_ctx *ctx = vctx; char block[CHACHA20_NATIVE_BLOCK_LEN]; - crypto_stream_chacha20_ietf(block, sizeof(block), nonce, ctx->key); + switch (noncelen) { + case 8: + crypto_stream_chacha20(block, sizeof(block), nonce, ctx->key); + break; + case CHACHA20_POLY1305_IV_LEN: + crypto_stream_chacha20_ietf(block, sizeof(block), nonce, ctx->key); + break; + default: + __assert_unreachable(); + } crypto_onetimeauth_poly1305_init(&ctx->state, block); explicit_bzero(block, sizeof(block)); } diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index 63c6ce1f9d28..05b761a0c87a 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -126,7 +126,7 @@ * aes-ccm 128-bit AES-CCM * aes-ccm192 192-bit AES-CCM * aes-ccm256 256-bit AES-CCM - * chacha20-poly1305 Chacha20 (96 bit nonce) with Poly1305 per RFC 8439 + * chacha20-poly1305 Chacha20 with Poly1305 per RFC 8439 */ #include @@ -233,7 +233,7 @@ static const struct alg { .evp_cipher = EVP_aes_256_ccm }, { .name = "chacha20-poly1305", .cipher = CRYPTO_CHACHA20_POLY1305, .type = T_AEAD, .tag_len = POLY1305_HASH_LEN, - .iv_sizes = { CHACHA20_POLY1305_IV_LEN }, + .iv_sizes = { CHACHA20_POLY1305_IV_LEN, 8 }, .evp_cipher = EVP_chacha20_poly1305 }, }; From nobody Thu Oct 21 22:04:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3674018018D5; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jV1Ycyz3tnn; Thu, 21 Oct 2021 22:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C15322F1B; Thu, 21 Oct 2021 22:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4Rew079758; Thu, 21 Oct 2021 22:04:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4RID079757; Thu, 21 Oct 2021 22:04:27 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:27 GMT Message-Id: <202110212204.19LM4RID079757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 9039a0fae46e - stable/13 - cryptosoft: Fix support for variable tag lengths in AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9039a0fae46e7a63c5c09890d46f987dc8320d80 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9039a0fae46e7a63c5c09890d46f987dc8320d80 commit 9039a0fae46e7a63c5c09890d46f987dc8320d80 Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:19:04 +0000 cryptosoft: Fix support for variable tag lengths in AES-CCM. The tag length is included as one of the values in the flags byte of block 0 passed to CBC_MAC, so merely copying the first N bytes is insufficient. To avoid adding more sideband data to the CBC MAC software context, pull the generation of block 0, the AAD length, and AAD padding out of cbc_mac.c and into cryptosoft.c. This matches how GCM/GMAC are handled where the length block is constructed in cryptosoft.c and passed as an input to the Update callback. As a result, the CBC MAC Update() routine is now much simpler and simply performs the XOR-and-encrypt step on each input block. While here, avoid a copy to the staging block in the Update routine when one or more full blocks are passed as input to the Update callback. Reviewed by: sef Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32120 (cherry picked from commit 4361c4eb6e3620e68d005c1671fdbf60b1fe83c6) --- sys/dev/cxgbe/crypto/t4_crypto.c | 107 ++++++++++++++++++++------ sys/opencrypto/cbc_mac.c | 157 ++++++--------------------------------- sys/opencrypto/cbc_mac.h | 6 +- sys/opencrypto/cryptosoft.c | 124 +++++++++++++++++++++++-------- 4 files changed, 205 insertions(+), 189 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 24287638b376..885271d82de0 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1893,8 +1893,60 @@ ccr_ccm_done(struct ccr_softc *sc, struct ccr_session *s, /* * Handle a CCM request that is not supported by the crypto engine by - * performing the operation in software. Derived from swcr_authenc(). + * performing the operation in software. Derived from swcr_ccm(). */ +static void +build_ccm_b0(const char *nonce, u_int nonce_length, u_int aad_length, + u_int data_length, u_int tag_length, uint8_t *b0) +{ + uint8_t *bp; + uint8_t flags, L; + + KASSERT(nonce_length >= 7 && nonce_length <= 13, + ("nonce_length must be between 7 and 13 bytes")); + + /* + * Need to determine the L field value. This is the number of + * bytes needed to specify the length of the message; the length + * is whatever is left in the 16 bytes after specifying flags and + * the nonce. + */ + L = 15 - nonce_length; + + flags = ((aad_length > 0) << 6) + + (((tag_length - 2) / 2) << 3) + + L - 1; + + /* + * Now we need to set up the first block, which has flags, nonce, + * and the message length. + */ + b0[0] = flags; + memcpy(b0 + 1, nonce, nonce_length); + bp = b0 + 1 + nonce_length; + + /* Need to copy L' [aka L-1] bytes of data_length */ + for (uint8_t *dst = b0 + CCM_CBC_BLOCK_LEN - 1; dst >= bp; dst--) { + *dst = data_length; + data_length >>= 8; + } +} + +/* NB: OCF only supports AAD lengths < 2^32. */ +static int +build_ccm_aad_length(u_int aad_length, uint8_t *blk) +{ + if (aad_length < ((1 << 16) - (1 << 8))) { + be16enc(blk, aad_length); + return (sizeof(uint16_t)); + } else { + blk[0] = 0xff; + blk[1] = 0xfe; + be32enc(blk + 2, aad_length); + return (2 + sizeof(uint32_t)); + } +} + static void ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) { @@ -1904,11 +1956,13 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) union authctx *auth_ctx; void *kschedule; char block[CCM_CBC_BLOCK_LEN]; - char digest[AES_CBC_MAC_HASH_LEN]; + char tag[AES_CBC_MAC_HASH_LEN]; + u_int taglen; int error, i, len; auth_ctx = NULL; kschedule = NULL; + taglen = s->ccm_mac.hash_len; csp = crypto_get_params(crp->crp_session); if (crp->crp_payload_length > ccm_max_payload_length(csp)) { @@ -1956,19 +2010,32 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) goto out; } - auth_ctx->aes_cbc_mac_ctx.authDataLength = crp->crp_aad_length; - auth_ctx->aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; axf->Reinit(auth_ctx, crp->crp_iv, csp->csp_ivlen); + /* Supply MAC with b0. */ + build_ccm_b0(crp->crp_iv, csp->csp_ivlen, crp->crp_aad_length, + crp->crp_payload_length, taglen, block); + axf->Update(auth_ctx, block, CCM_CBC_BLOCK_LEN); + /* MAC the AAD. */ - if (crp->crp_aad != NULL) - error = axf->Update(auth_ctx, crp->crp_aad, - crp->crp_aad_length); - else - error = crypto_apply(crp, crp->crp_aad_start, - crp->crp_aad_length, axf->Update, auth_ctx); - if (error) - goto out; + if (crp->crp_aad_length != 0) { + len = build_ccm_aad_length(crp->crp_aad_length, block); + axf->Update(auth_ctx, block, len); + if (crp->crp_aad != NULL) + axf->Update(auth_ctx, crp->crp_aad, + crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, + crp->crp_aad_length, axf->Update, auth_ctx); + + /* Pad the AAD (including length field) to a full block. */ + len = (len + crp->crp_aad_length) % CCM_CBC_BLOCK_LEN; + if (len != 0) { + len = CCM_CBC_BLOCK_LEN - len; + memset(block, 0, CCM_CBC_BLOCK_LEN); + axf->Update(auth_ctx, block, len); + } + } exf->reinit(kschedule, crp->crp_iv, csp->csp_ivlen); @@ -1989,19 +2056,17 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) } /* Finalize MAC. */ - axf->Final(digest, auth_ctx); + axf->Final(tag, auth_ctx); /* Inject or validate tag. */ if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - crypto_copyback(crp, crp->crp_digest_start, sizeof(digest), - digest); + crypto_copyback(crp, crp->crp_digest_start, taglen, tag); error = 0; } else { - char digest2[AES_CBC_MAC_HASH_LEN]; + char tag2[AES_CBC_MAC_HASH_LEN]; - crypto_copydata(crp, crp->crp_digest_start, sizeof(digest2), - digest2); - if (timingsafe_bcmp(digest, digest2, sizeof(digest)) == 0) { + crypto_copydata(crp, crp->crp_digest_start, taglen, tag2); + if (timingsafe_bcmp(tag, tag2, taglen) == 0) { error = 0; /* Tag matches, decrypt data. */ @@ -2019,14 +2084,14 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) } } else error = EBADMSG; - explicit_bzero(digest2, sizeof(digest2)); + explicit_bzero(tag2, sizeof(tag2)); } out: zfree(kschedule, M_CCR); zfree(auth_ctx, M_CCR); explicit_bzero(block, sizeof(block)); - explicit_bzero(digest, sizeof(digest)); + explicit_bzero(tag, sizeof(tag)); crp->crp_etype = error; crypto_done(crp); } diff --git a/sys/opencrypto/cbc_mac.c b/sys/opencrypto/cbc_mac.c index 40afae5373bf..9a030cd54173 100644 --- a/sys/opencrypto/cbc_mac.c +++ b/sys/opencrypto/cbc_mac.c @@ -75,85 +75,23 @@ AES_CBC_MAC_Setkey(void *vctx, const uint8_t *key, u_int klen) /* * This is called to set the nonce, aka IV. - * Before this call, the authDataLength and cryptDataLength fields - * MUST have been set. Sadly, there's no way to return an error. * - * The CBC-MAC algorithm requires that the first block contain the - * nonce, as well as information about the sizes and lengths involved. + * Note that the caller is responsible for constructing b0 as well + * as the length and padding around the AAD and passing that data + * to _Update. */ void AES_CBC_MAC_Reinit(void *vctx, const uint8_t *nonce, u_int nonceLen) { struct aes_cbc_mac_ctx *ctx = vctx; - uint8_t b0[CCM_CBC_BLOCK_LEN]; - uint8_t *bp = b0, flags = 0; - uint8_t L = 0; - uint64_t dataLength = ctx->cryptDataLength; - - KASSERT(nonceLen >= 7 && nonceLen <= 13, - ("nonceLen must be between 7 and 13 bytes")); ctx->nonce = nonce; ctx->nonceLength = nonceLen; - - ctx->authDataCount = 0; + ctx->blockIndex = 0; - explicit_bzero(ctx->staging_block, sizeof(ctx->staging_block)); - - /* - * Need to determine the L field value. This is the number of - * bytes needed to specify the length of the message; the length - * is whatever is left in the 16 bytes after specifying flags and - * the nonce. - */ - L = 15 - nonceLen; - - flags = ((ctx->authDataLength > 0) << 6) + - (((AES_CBC_MAC_HASH_LEN - 2) / 2) << 3) + - L - 1; - /* - * Now we need to set up the first block, which has flags, nonce, - * and the message length. - */ - b0[0] = flags; - bcopy(nonce, b0 + 1, nonceLen); - bp = b0 + 1 + nonceLen; - /* Need to copy L' [aka L-1] bytes of cryptDataLength */ - for (uint8_t *dst = b0 + sizeof(b0) - 1; dst >= bp; dst--) { - *dst = dataLength; - dataLength >>= 8; - } - /* Now need to encrypt b0 */ - rijndaelEncrypt(ctx->keysched, ctx->rounds, b0, ctx->block); - /* If there is auth data, we need to set up the staging block */ - if (ctx->authDataLength) { - size_t addLength; - if (ctx->authDataLength < ((1<<16) - (1<<8))) { - uint16_t sizeVal = htobe16(ctx->authDataLength); - bcopy(&sizeVal, ctx->staging_block, sizeof(sizeVal)); - addLength = sizeof(sizeVal); - } else if (ctx->authDataLength < (1ULL<<32)) { - uint32_t sizeVal = htobe32(ctx->authDataLength); - ctx->staging_block[0] = 0xff; - ctx->staging_block[1] = 0xfe; - bcopy(&sizeVal, ctx->staging_block+2, sizeof(sizeVal)); - addLength = 2 + sizeof(sizeVal); - } else { - uint64_t sizeVal = htobe64(ctx->authDataLength); - ctx->staging_block[0] = 0xff; - ctx->staging_block[1] = 0xff; - bcopy(&sizeVal, ctx->staging_block+2, sizeof(sizeVal)); - addLength = 2 + sizeof(sizeVal); - } - ctx->blockIndex = addLength; - /* - * The length descriptor goes into the AAD buffer, so we - * need to account for it. - */ - ctx->authDataLength += addLength; - ctx->authDataCount = addLength; - } + /* XOR b0 with all 0's on first call to _Update. */ + memset(ctx->block, 0, CCM_CBC_BLOCK_LEN); } int @@ -167,85 +105,35 @@ AES_CBC_MAC_Update(void *vctx, const void *vdata, u_int length) data = vdata; /* - * This will be called in one of two phases: - * (1) Applying authentication data, or - * (2) Applying the payload data. - * - * Because CBC-MAC puts the authentication data size before the - * data, subsequent calls won't be block-size-aligned. Which - * complicates things a fair bit. - * - * The payload data doesn't have that problem. + * _Update can be called with non-aligned update lengths. Use + * the staging block when necessary. */ - - if (ctx->authDataCount < ctx->authDataLength) { - /* - * We need to process data as authentication data. - * Since we may be out of sync, we may also need - * to pad out the staging block. - */ - const uint8_t *ptr = data; - while (length > 0) { - - copy_amt = MIN(length, - sizeof(ctx->staging_block) - ctx->blockIndex); - - bcopy(ptr, ctx->staging_block + ctx->blockIndex, - copy_amt); - ptr += copy_amt; - length -= copy_amt; - ctx->authDataCount += copy_amt; - ctx->blockIndex += copy_amt; - ctx->blockIndex %= sizeof(ctx->staging_block); + while (length != 0) { + uint8_t *ptr; - if (ctx->blockIndex == 0 || - ctx->authDataCount == ctx->authDataLength) { - /* - * We're done with this block, so we - * xor staging_block with block, and then - * encrypt it. - */ - xor_and_encrypt(ctx, ctx->staging_block, ctx->block); - bzero(ctx->staging_block, sizeof(ctx->staging_block)); - ctx->blockIndex = 0; - if (ctx->authDataCount >= ctx->authDataLength) - break; - } - } /* - * We'd like to be able to check length == 0 and return - * here, but the way OCF calls us, length is always - * blksize (16, in this case). So we have to count on - * the fact that OCF calls us separately for the AAD and - * for the real data. + * If there is no partial block and the length is at + * least a full block, encrypt the full block without + * copying to the staging block. */ - return (0); - } - /* - * If we're here, then we're encoding payload data. - * This is marginally easier, except that _Update can - * be called with non-aligned update lengths. As a result, - * we still need to use the staging block. - */ - KASSERT((length + ctx->cryptDataCount) <= ctx->cryptDataLength, - ("More encryption data than allowed")); + if (ctx->blockIndex == 0 && length >= CCM_CBC_BLOCK_LEN) { + xor_and_encrypt(ctx, data, ctx->block); + length -= CCM_CBC_BLOCK_LEN; + data += CCM_CBC_BLOCK_LEN; + continue; + } - while (length) { - uint8_t *ptr; - copy_amt = MIN(sizeof(ctx->staging_block) - ctx->blockIndex, length); ptr = ctx->staging_block + ctx->blockIndex; bcopy(data, ptr, copy_amt); data += copy_amt; ctx->blockIndex += copy_amt; - ctx->cryptDataCount += copy_amt; length -= copy_amt; if (ctx->blockIndex == sizeof(ctx->staging_block)) { /* We've got a full block */ xor_and_encrypt(ctx, ctx->staging_block, ctx->block); ctx->blockIndex = 0; - bzero(ctx->staging_block, sizeof(ctx->staging_block)); } } return (0); @@ -264,11 +152,12 @@ AES_CBC_MAC_Final(uint8_t *buf, void *vctx) * left over to encrypt. */ if (ctx->blockIndex != 0) { + memset(ctx->staging_block + ctx->blockIndex, 0, + CCM_CBC_BLOCK_LEN - ctx->blockIndex); xor_and_encrypt(ctx, ctx->staging_block, ctx->block); - ctx->cryptDataCount += ctx->blockIndex; - ctx->blockIndex = 0; - explicit_bzero(ctx->staging_block, sizeof(ctx->staging_block)); } + explicit_bzero(ctx->staging_block, sizeof(ctx->staging_block)); + bzero(s0, sizeof(s0)); s0[0] = (15 - ctx->nonceLength) - 1; bcopy(ctx->nonce, s0 + 1, ctx->nonceLength); diff --git a/sys/opencrypto/cbc_mac.h b/sys/opencrypto/cbc_mac.h index 51833a212f6c..50694e5d4b44 100644 --- a/sys/opencrypto/cbc_mac.h +++ b/sys/opencrypto/cbc_mac.h @@ -46,13 +46,11 @@ * the encryption one is similar. */ struct aes_cbc_mac_ctx { - uint64_t authDataLength, authDataCount; - uint64_t cryptDataLength, cryptDataCount; - int blockIndex; uint8_t staging_block[CCM_CBC_BLOCK_LEN]; uint8_t block[CCM_CBC_BLOCK_LEN]; - const uint8_t *nonce; + int blockIndex; int nonceLength; /* This one is in bytes, not bits! */ + const uint8_t *nonce; /* AES state data */ int rounds; uint32_t keysched[4*(RIJNDAEL_MAXNR+1)]; diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index c86ff86613db..fb43a08970c7 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -636,16 +636,69 @@ out: return (error); } +static void +build_ccm_b0(const char *nonce, u_int nonce_length, u_int aad_length, + u_int data_length, u_int tag_length, uint8_t *b0) +{ + uint8_t *bp; + uint8_t flags, L; + + KASSERT(nonce_length >= 7 && nonce_length <= 13, + ("nonce_length must be between 7 and 13 bytes")); + + /* + * Need to determine the L field value. This is the number of + * bytes needed to specify the length of the message; the length + * is whatever is left in the 16 bytes after specifying flags and + * the nonce. + */ + L = 15 - nonce_length; + + flags = ((aad_length > 0) << 6) + + (((tag_length - 2) / 2) << 3) + + L - 1; + + /* + * Now we need to set up the first block, which has flags, nonce, + * and the message length. + */ + b0[0] = flags; + memcpy(b0 + 1, nonce, nonce_length); + bp = b0 + 1 + nonce_length; + + /* Need to copy L' [aka L-1] bytes of data_length */ + for (uint8_t *dst = b0 + CCM_CBC_BLOCK_LEN - 1; dst >= bp; dst--) { + *dst = data_length; + data_length >>= 8; + } +} + +/* NB: OCF only supports AAD lengths < 2^32. */ +static int +build_ccm_aad_length(u_int aad_length, uint8_t *blk) +{ + if (aad_length < ((1 << 16) - (1 << 8))) { + be16enc(blk, aad_length); + return (sizeof(uint16_t)); + } else { + blk[0] = 0xff; + blk[1] = 0xfe; + be32enc(blk + 2, aad_length); + return (2 + sizeof(uint32_t)); + } +} + static int swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) { - u_char tag[AES_CBC_MAC_HASH_LEN]; u_char iv[AES_BLOCK_LEN]; + u_char blk[CCM_CBC_BLOCK_LEN]; + u_char tag[AES_CBC_MAC_HASH_LEN]; union authctx ctx; const struct crypto_session_params *csp; struct swcr_auth *swa; struct auth_hash *axf; - int error, ivlen; + int error, ivlen, len; csp = crypto_get_params(crp->crp_session); swa = &ses->swcr_auth; @@ -657,25 +710,24 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) ivlen = csp->csp_ivlen; crypto_read_iv(crp, iv); - /* - * AES CCM-CBC-MAC needs to know the length of both the auth - * data and payload data before doing the auth computation. - */ - ctx.aes_cbc_mac_ctx.authDataLength = crp->crp_payload_length; - ctx.aes_cbc_mac_ctx.cryptDataLength = 0; + /* Supply MAC with IV */ + axf->Reinit(&ctx, crp->crp_iv, ivlen); - axf->Reinit(&ctx, iv, ivlen); - if (crp->crp_aad != NULL) - error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); - else - error = crypto_apply(crp, crp->crp_payload_start, - crp->crp_payload_length, axf->Update, &ctx); - if (error) - return (error); + /* Supply MAC with b0. */ + build_ccm_b0(crp->crp_iv, ivlen, crp->crp_payload_length, 0, + swa->sw_mlen, blk); + axf->Update(&ctx, blk, CCM_CBC_BLOCK_LEN); + + len = build_ccm_aad_length(crp->crp_payload_length, blk); + axf->Update(&ctx, blk, len); + + crypto_apply(crp, crp->crp_payload_start, crp->crp_payload_length, + axf->Update, &ctx); /* Finalize MAC */ axf->Final(tag, &ctx); + error = 0; if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { u_char tag2[AES_CBC_MAC_HASH_LEN]; @@ -689,6 +741,7 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); } explicit_bzero(tag, sizeof(tag)); + explicit_bzero(blk, sizeof(blk)); explicit_bzero(iv, sizeof(iv)); return (error); } @@ -733,24 +786,35 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) ivlen = csp->csp_ivlen; - /* - * AES CCM-CBC-MAC needs to know the length of both the auth - * data and payload data before doing the auth computation. - */ - ctx.aes_cbc_mac_ctx.authDataLength = crp->crp_aad_length; - ctx.aes_cbc_mac_ctx.cryptDataLength = crp->crp_payload_length; - /* Supply MAC with IV */ axf->Reinit(&ctx, crp->crp_iv, ivlen); + /* Supply MAC with b0. */ + _Static_assert(sizeof(blkbuf) >= CCM_CBC_BLOCK_LEN, + "blkbuf too small for b0"); + build_ccm_b0(crp->crp_iv, ivlen, crp->crp_aad_length, + crp->crp_payload_length, swa->sw_mlen, blk); + axf->Update(&ctx, blk, CCM_CBC_BLOCK_LEN); + /* Supply MAC with AAD */ - if (crp->crp_aad != NULL) - error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); - else - error = crypto_apply(crp, crp->crp_aad_start, - crp->crp_aad_length, axf->Update, &ctx); - if (error) - return (error); + if (crp->crp_aad_length != 0) { + len = build_ccm_aad_length(crp->crp_aad_length, blk); + axf->Update(&ctx, blk, len); + if (crp->crp_aad != NULL) + axf->Update(&ctx, crp->crp_aad, + crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, + crp->crp_aad_length, axf->Update, &ctx); + + /* Pad the AAD (including length field) to a full block. */ + len = (len + crp->crp_aad_length) % CCM_CBC_BLOCK_LEN; + if (len != 0) { + len = CCM_CBC_BLOCK_LEN - len; + memset(blk, 0, CCM_CBC_BLOCK_LEN); + axf->Update(&ctx, blk, len); + } + } if (crp->crp_cipher_key != NULL) exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, From nobody Thu Oct 21 22:04:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BB4EF18015DA; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jS5CvBz3thv; Thu, 21 Oct 2021 22:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE56230A6; Thu, 21 Oct 2021 22:04:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4PXU079728; Thu, 21 Oct 2021 22:04:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4P70079727; Thu, 21 Oct 2021 22:04:25 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:25 GMT Message-Id: <202110212204.19LM4P70079727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4b18b3c402b4 - stable/13 - safexcel: Support truncated tags for AES-CCM. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b18b3c402b4db8a6a15acff3dd96e8d5be10bdb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4b18b3c402b4db8a6a15acff3dd96e8d5be10bdb commit 4b18b3c402b4db8a6a15acff3dd96e8d5be10bdb Author: John Baldwin AuthorDate: 2021-10-06 21:08:48 +0000 Commit: John Baldwin CommitDate: 2021-10-21 21:17:21 +0000 safexcel: Support truncated tags for AES-CCM. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32119 (cherry picked from commit 366ae4a000b1483390ddbf28e3dc420ebac894a0) --- sys/dev/safexcel/safexcel.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 9a9b0ab0cb74..807040a7a1d8 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -1735,7 +1735,7 @@ safexcel_instr_ccm(struct safexcel_request *req, struct safexcel_instr *instr, memset(b0, 0, blen); b0[0] = (L - 1) | /* payload length size */ - ((CCM_CBC_MAX_DIGEST_LEN - 2) / 2) << 3 /* digest length */ | + ((req->sess->digestlen - 2) / 2) << 3 /* digest length */ | (crp->crp_aad_length > 0 ? 1 : 0) << 6 /* AAD present bit */; memcpy(&b0[1], req->iv, csp->csp_ivlen); b0[14] = crp->crp_payload_length >> 8; @@ -2314,9 +2314,6 @@ safexcel_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CRYPTO_AES_CCM_16: - if (csp->csp_auth_mlen != 0 && - csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN) - return (EINVAL); break; default: return (EINVAL); From nobody Thu Oct 21 22:04:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7B10E1801D05; Thu, 21 Oct 2021 22:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb1jb0xtMz3tqr; Thu, 21 Oct 2021 22:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E0BC22FA0; Thu, 21 Oct 2021 22:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LM4UHm079830; Thu, 21 Oct 2021 22:04:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LM4UgZ079829; Thu, 21 Oct 2021 22:04:30 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:04:30 GMT Message-Id: <202110212204.19LM4UgZ079829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: fe2827f1678b - stable/13 - Bump __FreeBSD_version for OCF changes to support variable nonce lengths. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: fe2827f1678b8ff0baf62a1529b2cc121a25b090 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fe2827f1678b8ff0baf62a1529b2cc121a25b090 commit fe2827f1678b8ff0baf62a1529b2cc121a25b090 Author: John Baldwin AuthorDate: 2021-10-06 21:09:18 +0000 Commit: John Baldwin CommitDate: 2021-10-21 22:03:38 +0000 Bump __FreeBSD_version for OCF changes to support variable nonce lengths. Sponsored by: The FreeBSD Foundation (cherry picked from commit ac847dbf73685a5df9f70bbcdefa9fdeb559071d) --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index fd177d5a23a1..3d47dda916af 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300518 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300519 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Thu Oct 21 22:31:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 030EB1813440; Thu, 21 Oct 2021 22:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jh6hvYz4fFx; Thu, 21 Oct 2021 22:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6E1723343; Thu, 21 Oct 2021 22:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVWj5018758; Thu, 21 Oct 2021 22:31:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVWff018757; Thu, 21 Oct 2021 22:31:32 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:32 GMT Message-Id: <202110212231.19LMVWff018757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: fa226878a553 - stable/13 - sbuf(9): Microoptimize sbuf_put_byte() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa226878a5532e79acb373e1201f92e0114428e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=fa226878a5532e79acb373e1201f92e0114428e6 commit fa226878a5532e79acb373e1201f92e0114428e6 Author: Alexander Motin AuthorDate: 2021-10-05 18:42:47 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:29 +0000 sbuf(9): Microoptimize sbuf_put_byte() This function is actively used by sbuf_vprintf(), so this simple inlining in half reduces time of kern.geom.confxml generation. MFC after: 2 weeks Sponsored by: iXsystem, Inc. (cherry picked from commit 7835b2cb4a1ae57f403739a2f1076ec7188f18c9) --- sys/kern/subr_sbuf.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index b7f135e81206..6c533f36c82e 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -480,7 +480,26 @@ static void sbuf_put_byte(struct sbuf *s, char c) { - sbuf_put_bytes(s, &c, 1); + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + if (__predict_false(s->s_error != 0)) + return; + if (__predict_false(SBUF_FREESPACE(s) <= 0)) { + /* + * If there is a drain, use it, otherwise extend the + * buffer. + */ + if (s->s_drain_func != NULL) + (void)sbuf_drain(s); + else if (sbuf_extend(s, 1) < 0) + s->s_error = ENOMEM; + if (s->s_error != 0) + return; + } + s->s_buf[s->s_len++] = c; + if (SBUF_ISSECTION(s)) + s->s_sect_len++; } /* @@ -623,7 +642,7 @@ static void sbuf_putc_func(int c, void *arg) { - if (c != '\0') + if (__predict_true(c != '\0')) sbuf_put_byte(arg, c); } From nobody Thu Oct 21 22:31:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7879E1813445; Thu, 21 Oct 2021 22:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jk1XhQz4fND; Thu, 21 Oct 2021 22:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAE0B2352E; Thu, 21 Oct 2021 22:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVXD0018788; Thu, 21 Oct 2021 22:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVX2S018787; Thu, 21 Oct 2021 22:31:33 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:33 GMT Message-Id: <202110212231.19LMVX2S018787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4808bab7fa6c - stable/13 - sched_ule(4): Improve long-term load balancer. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4808bab7fa6c3ec49b49476b8326d7a0250a03fa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4808bab7fa6c3ec49b49476b8326d7a0250a03fa commit 4808bab7fa6c3ec49b49476b8326d7a0250a03fa Author: Alexander Motin AuthorDate: 2021-09-21 22:14:22 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:35 +0000 sched_ule(4): Improve long-term load balancer. Before this change long-term load balancer was unable to migrate running threads, only ones waiting on run queues. But with growing number of CPU cores it is quite typical now for system to not have many waiting threads. But same time if due to some coincidence two long-running CPU-bound threads ended up sharing same physical CPU core, they could suffer from the SMT penalty indefinitely, and the load balancer couldn't help. Improve that by teaching the load balancer to hint running threads to migrate by marking them with TDF_NEEDRESCHED and new TDF_PICKCPU flag, making sched_pickcpu() to search for better CPU later, when it is convenient. Fix CPU search logic when balancing to limit round-robin migrations in case of almost equal load to the group of physical cores. The previous code bounced threads across all the system, that should be pretty bad for caches and NUMA affinity, while additional fairness was almost invisible, diminishing with number of cores in the group. MFC after: 1 month (cherry picked from commit e745d729be60a47b49eb19c02a6864a747fb2744) --- sys/kern/sched_ule.c | 119 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 26 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 53d5a59a3605..e7de4a50bb93 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -196,6 +196,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= #define SCHED_SLICE_MIN_DIVISOR 6 /* DEFAULT/MIN = ~16 ms. */ /* Flags kept in td_flags. */ +#define TDF_PICKCPU TDF_SCHED0 /* Thread should pick new CPU. */ #define TDF_SLICEEND TDF_SCHED2 /* Thread time slice is over. */ /* @@ -633,15 +634,16 @@ sched_random(void) } struct cpu_search { - cpuset_t *cs_mask; - u_int cs_prefer; + cpuset_t *cs_mask; /* The mask of allowed CPUs to choose from. */ + int cs_prefer; /* Prefer this CPU and groups including it. */ + int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ int cs_limit; /* Max load for low, min load for high. */ }; struct cpu_search_res { - int cs_cpu; - int cs_load; + int cs_cpu; /* The best CPU found. */ + int cs_load; /* The load of cs_cpu. */ }; /* @@ -657,7 +659,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, { struct cpu_search_res lr; struct tdq *tdq; - int c, bload, l, load, total; + int c, bload, l, load, p, total; total = 0; bload = INT_MAX; @@ -668,6 +670,17 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_lowest(&cg->cg_child[c], s, &lr); total += load; + + /* + * When balancing do not prefer SMT groups with load >1. + * It allows round-robin between SMT groups with equal + * load within parent group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && + (cg->cg_child[c].cg_flags & CG_FLAG_THREAD) && + load >= 128 && (load & 128) != 0) + load += 128; + if (lr.cs_cpu >= 0 && (load < bload || (load == bload && lr.cs_load < r->cs_load))) { bload = load; @@ -684,20 +697,40 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, continue; tdq = TDQ_CPU(c); l = tdq->tdq_load; + if (c == s->cs_prefer) { + if (__predict_false(s->cs_running)) + l--; + p = 128; + } else + p = 0; load = l * 256; - if (c == s->cs_prefer) - load -= 128; - total += load; - if (l > s->cs_limit || tdq->tdq_lowpri <= s->cs_pri || + total += load - p; + + /* + * Check this CPU is acceptable. + * If the threads is already on the CPU, don't look on the TDQ + * priority, since it can be the priority of the thread itself. + */ + if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; + + /* + * When balancing do not prefer CPUs with load > 1. + * It allows round-robin between CPUs with equal load + * within the CPU group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && l > 0) + p = 0; + load -= sched_random() % 128; - if (load < bload) { - bload = load; + if (bload > load - p) { + bload = load - p; r->cs_cpu = c; + r->cs_load = load; } } - r->cs_load = bload; return (total); } @@ -736,9 +769,17 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, l = tdq->tdq_load; load = l * 256; total += load; - if (l < s->cs_limit || !tdq->tdq_transferable || + + /* + * Check this CPU is acceptable. + * If requested minimum load is 1, then caller must know how + * to handle running threads, not counted in tdq_transferable. + */ + if (l < s->cs_limit || (tdq->tdq_transferable == 0 && + (s->cs_limit > 1 || l > 1)) || !CPU_ISSET(c, s->cs_mask)) continue; + load -= sched_random() % 256; if (load > bload) { bload = load; @@ -756,12 +797,13 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, */ static inline int sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, - int prefer) + int prefer, int running) { struct cpu_search s; struct cpu_search_res r; s.cs_prefer = prefer; + s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; s.cs_limit = maxload; @@ -788,12 +830,13 @@ static void sched_balance_group(struct cpu_group *cg) { struct tdq *tdq; + struct thread *td; cpuset_t hmask, lmask; int high, low, anylow; CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 2); + high = sched_highest(cg, &hmask, 1); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -802,10 +845,28 @@ sched_balance_group(struct cpu_group *cg) /* Stop if there is no more CPU left for low. */ if (CPU_EMPTY(&lmask)) break; - anylow = 1; tdq = TDQ_CPU(high); + if (tdq->tdq_load == 1) { + /* + * There is only one running thread. We can't move + * it from here, so tell it to pick new CPU by itself. + */ + TDQ_LOCK(tdq); + td = pcpu_find(high)->pc_curthread; + if ((td->td_flags & TDF_IDLETD) == 0 && + THREAD_CAN_MIGRATE(td)) { + td->td_flags |= TDF_NEEDRESCHED | TDF_PICKCPU; + if (high != curcpu) + ipi_cpu(high, IPI_AST); + } + TDQ_UNLOCK(tdq); + break; + } + anylow = 1; nextlow: - low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high); + if (tdq->tdq_transferable == 0) + continue; + low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high, 1); /* Stop if we looked well and found no less loaded CPU. */ if (anylow && low == -1) break; @@ -1227,7 +1288,7 @@ sched_pickcpu(struct thread *td, int flags) struct td_sched *ts; struct tdq *tdq; cpuset_t *mask; - int cpu, pri, self, intr; + int cpu, pri, r, self, intr; self = PCPU_GET(cpuid); ts = td_get_sched(td); @@ -1305,32 +1366,33 @@ llc: cpu = -1; mask = &td->td_cpuset->cs_mask; pri = td->td_priority; + r = TD_IS_RUNNING(td); /* * Try hard to keep interrupts within found LLC. Search the LLC for * the least loaded CPU we can run now. For NUMA systems it should * be within target domain, and it also reduces scheduling overhead. */ if (ccg != NULL && intr) { - cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_intrbind); } else /* Search the LLC for the least loaded idle CPU we can run now. */ if (ccg != NULL) { cpu = sched_lowest(ccg, mask, max(pri, PRI_MAX_TIMESHARE), - INT_MAX, ts->ts_cpu); + INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_affinity); } /* Search globally for the least loaded CPU we can run now. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } /* Search globally for the least loaded CPU. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } @@ -2056,7 +2118,7 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, preempted; + int cpuid, pickcpu, preempted; THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2064,11 +2126,15 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); - ts->ts_rltick = ticks; + pickcpu = (td->td_flags & TDF_PICKCPU) != 0; + if (pickcpu) + ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; + else + ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; - td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); + td->td_flags &= ~(TDF_NEEDRESCHED | TDF_PICKCPU | TDF_SLICEEND); td->td_owepreempt = 0; tdq->tdq_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) @@ -2088,7 +2154,8 @@ sched_switch(struct thread *td, int flags) SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; #ifdef SMP - if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_SCHED(td, ts->ts_cpu)) + if (THREAD_CAN_MIGRATE(td) && (!THREAD_CAN_SCHED(td, ts->ts_cpu) + || pickcpu)) ts->ts_cpu = sched_pickcpu(td, 0); #endif if (ts->ts_cpu == cpuid) From nobody Thu Oct 21 22:31:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E73E31813449; Thu, 21 Oct 2021 22:31:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jl2Szwz4fKh; Thu, 21 Oct 2021 22:31:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D083233C2; Thu, 21 Oct 2021 22:31:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVYgl018813; Thu, 21 Oct 2021 22:31:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVYre018812; Thu, 21 Oct 2021 22:31:34 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:34 GMT Message-Id: <202110212231.19LMVYre018812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: a3d50144ccd7 - stable/13 - Fix build without SMP. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3d50144ccd7cdb0754efc8ff2c8b56d8abcc2d9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a3d50144ccd7cdb0754efc8ff2c8b56d8abcc2d9 commit a3d50144ccd7cdb0754efc8ff2c8b56d8abcc2d9 Author: Alexander Motin AuthorDate: 2021-09-22 02:13:33 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:35 +0000 Fix build without SMP. MFC after: 1 month (cherry picked from commit 8db1669959ceebdc60a7d402830663953bf32818) --- sys/kern/sched_ule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index e7de4a50bb93..d92436f70db2 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2118,7 +2118,10 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, pickcpu, preempted; + int cpuid, preempted; +#ifdef SMP + int pickcpu; +#endif THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2126,11 +2129,13 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); +#ifdef SMP pickcpu = (td->td_flags & TDF_PICKCPU) != 0; if (pickcpu) ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; else ts->ts_rltick = ticks; +#endif td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; From nobody Thu Oct 21 22:31:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 84C39181353E; Thu, 21 Oct 2021 22:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jn0j0Xz4fKs; Thu, 21 Oct 2021 22:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 459D0233C3; Thu, 21 Oct 2021 22:31:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVaM1018837; Thu, 21 Oct 2021 22:31:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVaFo018836; Thu, 21 Oct 2021 22:31:36 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:36 GMT Message-Id: <202110212231.19LMVaFo018836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: b5919ea4e6bb - stable/13 - x86: Add NUMA nodes into CPU topology. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b5919ea4e6bb21e22484bc1943665e1f7e3bf888 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b5919ea4e6bb21e22484bc1943665e1f7e3bf888 commit b5919ea4e6bb21e22484bc1943665e1f7e3bf888 Author: Alexander Motin AuthorDate: 2021-09-23 17:41:02 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:36 +0000 x86: Add NUMA nodes into CPU topology. Depending on hardware, NUMA nodes may match last level caches, or they may be above them (AMD Zen 2/3) or below (Intel Xeon w/ SNC). This information is provided by ACPI instead of CPUID, and it is provided for each CPU individually instead of mask widths, but this code should be able to properly handle all the above cases. This change should immediately allow idle stealing in sched_ule(4) to prefer load from NUMA-local CPUs to remote ones when the node does not match LLC. Later we may think of how to better handle it on sched_pickcpu() side. MFC after: 1 month (cherry picked from commit ef50d5fbc39fc39970eab1234222b5ac1d9ba74c) --- sys/kern/sched_ule.c | 2 ++ sys/sys/smp.h | 1 + sys/x86/x86/mp_x86.c | 82 +++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index d92436f70db2..98c1f0bca981 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -3098,6 +3098,8 @@ sysctl_kern_sched_topology_spec_internal(struct sbuf *sb, struct cpu_group *cg, sbuf_printf(sb, "THREAD group"); if ((cg->cg_flags & CG_FLAG_SMT) != 0) sbuf_printf(sb, "SMT group"); + if ((cg->cg_flags & CG_FLAG_NODE) != 0) + sbuf_printf(sb, "NUMA node"); sbuf_printf(sb, "\n"); } diff --git a/sys/sys/smp.h b/sys/sys/smp.h index cee1199015a7..1da557212ae2 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -107,6 +107,7 @@ typedef struct cpu_group *cpu_group_t; #define CG_FLAG_HTT 0x01 /* Schedule the alternate core last. */ #define CG_FLAG_SMT 0x02 /* New age htt, less crippled. */ #define CG_FLAG_THREAD (CG_FLAG_HTT | CG_FLAG_SMT) /* Any threading. */ +#define CG_FLAG_NODE 0x04 /* NUMA node. */ /* * Convenience routines for building and traversing topologies. diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index db40aab28ad5..326b6fdae77d 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" #ifdef __i386__ #include "opt_apic.h" #endif @@ -82,6 +83,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_ACPI +#include +#include +#endif + static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items"); /* lock region used by kernel profiling */ @@ -501,13 +507,16 @@ topo_probe(void) int type; int subtype; int id_shift; - } topo_layers[MAX_CACHE_LEVELS + 4]; + } topo_layers[MAX_CACHE_LEVELS + 5]; struct topo_node *parent; struct topo_node *node; int layer; int nlayers; int node_id; int i; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + int d, domain; +#endif if (cpu_topo_probed) return; @@ -582,6 +591,31 @@ topo_probe(void) topo_layers[nlayers].id_shift = 0; nlayers++; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (vm_ndomains > 1) { + for (layer = 0; layer < nlayers; ++layer) { + for (i = 0; i <= max_apic_id; ++i) { + if ((i & ((1 << topo_layers[layer].id_shift) - 1)) == 0) + domain = -1; + if (!cpu_info[i].cpu_present) + continue; + d = acpi_pxm_get_cpu_locality(i); + if (domain >= 0 && domain != d) + break; + domain = d; + } + if (i > max_apic_id) + break; + } + KASSERT(layer < nlayers, ("NUMA domain smaller than PU")); + memmove(&topo_layers[layer+1], &topo_layers[layer], + sizeof(*topo_layers) * (nlayers - layer)); + topo_layers[layer].type = TOPO_TYPE_NODE; + topo_layers[layer].subtype = CG_SHARE_NONE; + nlayers++; + } +#endif + topo_init_root(&topo_root); for (i = 0; i <= max_apic_id; ++i) { if (!cpu_info[i].cpu_present) @@ -589,7 +623,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = i >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) { + node_id = acpi_pxm_get_cpu_locality(i); + } else +#endif + node_id = i >> topo_layers[layer].id_shift; parent = topo_add_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -598,7 +637,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = boot_cpu_id >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) + node_id = acpi_pxm_get_cpu_locality(boot_cpu_id); + else +#endif + node_id = boot_cpu_id >> topo_layers[layer].id_shift; node = topo_find_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -773,14 +817,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) int i; KASSERT(root->type == TOPO_TYPE_SYSTEM || root->type == TOPO_TYPE_CACHE || - root->type == TOPO_TYPE_GROUP, + root->type == TOPO_TYPE_NODE || root->type == TOPO_TYPE_GROUP, ("x86topo_add_sched_group: bad type: %u", root->type)); CPU_COPY(&root->cpuset, &cg_root->cg_mask); cg_root->cg_count = root->cpu_count; - if (root->type == TOPO_TYPE_SYSTEM) + if (root->type == TOPO_TYPE_CACHE) + cg_root->cg_level = root->subtype; + else cg_root->cg_level = CG_SHARE_NONE; + if (root->type == TOPO_TYPE_NODE) + cg_root->cg_flags = CG_FLAG_NODE; else - cg_root->cg_level = root->subtype; + cg_root->cg_flags = 0; /* * Check how many core nodes we have under the given root node. @@ -801,7 +849,7 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) if (cg_root->cg_level != CG_SHARE_NONE && root->cpu_count > 1 && ncores < 2) - cg_root->cg_flags = CG_FLAG_SMT; + cg_root->cg_flags |= CG_FLAG_SMT; /* * Find out how many cache nodes we have under the given root node. @@ -813,10 +861,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) nchildren = 0; node = root; while (node != NULL) { - if ((node->type != TOPO_TYPE_GROUP && - node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + if (CPU_CMP(&node->cpuset, &root->cpuset) == 0) { + if (node->type == TOPO_TYPE_CACHE && + cg_root->cg_level < node->subtype) + cg_root->cg_level = node->subtype; + if (node->type == TOPO_TYPE_NODE) + cg_root->cg_flags |= CG_FLAG_NODE; + node = topo_next_node(root, node); + continue; + } + if (node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && + node->type != TOPO_TYPE_CACHE) { node = topo_next_node(root, node); continue; } @@ -841,9 +897,9 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) i = 0; while (node != NULL) { if ((node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + CPU_CMP(&node->cpuset, &root->cpuset) == 0) { node = topo_next_node(root, node); continue; } From nobody Thu Oct 21 22:31:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1625D18132FE; Thu, 21 Oct 2021 22:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jp3WLKz4fJR; Thu, 21 Oct 2021 22:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AA2D2352F; Thu, 21 Oct 2021 22:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVbfd018861; Thu, 21 Oct 2021 22:31:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVboT018860; Thu, 21 Oct 2021 22:31:37 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:37 GMT Message-Id: <202110212231.19LMVboT018860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 11f14b33629e - stable/13 - sched_ule(4): Fix hang with steal_thresh < 2. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11f14b33629e552a451fdbfe653ebb0addd27700 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=11f14b33629e552a451fdbfe653ebb0addd27700 commit 11f14b33629e552a451fdbfe653ebb0addd27700 Author: Alexander Motin AuthorDate: 2021-09-26 16:03:05 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:36 +0000 sched_ule(4): Fix hang with steal_thresh < 2. e745d729be60 caused infinite loop with interrupts disabled in load stealing code if steal_thresh set below 2. Such configuration should not generally be used, but appeared some people are using it to workaround some problems. To fix the problem explicitly pass to sched_highest() minimum number of transferrable threads, supported by the caller, instead of guessing. MFC after: 25 days (cherry picked from commit 08063e9f98a33980a09e3bd465926719b3437122) --- sys/kern/sched_ule.c | 70 +++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 98c1f0bca981..6f072c518934 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -638,12 +638,13 @@ struct cpu_search { int cs_prefer; /* Prefer this CPU and groups including it. */ int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ - int cs_limit; /* Max load for low, min load for high. */ + int cs_load; /* Max load for low, min load for high. */ + int cs_trans; /* Min transferable load for high. */ }; struct cpu_search_res { - int cs_cpu; /* The best CPU found. */ - int cs_load; /* The load of cs_cpu. */ + int csr_cpu; /* The best CPU found. */ + int csr_load; /* The load of cs_cpu. */ }; /* @@ -663,7 +664,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MAX; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { @@ -681,11 +682,11 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load >= 128 && (load & 128) != 0) load += 128; - if (lr.cs_cpu >= 0 && (load < bload || - (load == bload && lr.cs_load < r->cs_load))) { + if (lr.csr_cpu >= 0 && (load < bload || + (load == bload && lr.csr_load < r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -711,7 +712,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, * If the threads is already on the CPU, don't look on the TDQ * priority, since it can be the priority of the thread itself. */ - if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + if (l > s->cs_load || (tdq->tdq_lowpri <= s->cs_pri && (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; @@ -727,8 +728,8 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load -= sched_random() % 128; if (bload > load - p) { bload = load - p; - r->cs_cpu = c; - r->cs_load = load; + r->csr_cpu = c; + r->csr_load = load; } } return (total); @@ -744,18 +745,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MIN; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_highest(&cg->cg_child[c], s, &lr); total += load; - if (lr.cs_cpu >= 0 && (load > bload || - (load == bload && lr.cs_load > r->cs_load))) { + if (lr.csr_cpu >= 0 && (load > bload || + (load == bload && lr.csr_load > r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -772,21 +773,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, /* * Check this CPU is acceptable. - * If requested minimum load is 1, then caller must know how - * to handle running threads, not counted in tdq_transferable. */ - if (l < s->cs_limit || (tdq->tdq_transferable == 0 && - (s->cs_limit > 1 || l > 1)) || + if (l < s->cs_load || (tdq->tdq_transferable < s->cs_trans) || !CPU_ISSET(c, s->cs_mask)) continue; load -= sched_random() % 256; if (load > bload) { bload = load; - r->cs_cpu = c; + r->csr_cpu = c; } } - r->cs_load = bload; + r->csr_load = bload; return (total); } @@ -806,24 +804,26 @@ sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; - s.cs_limit = maxload; + s.cs_load = maxload; cpu_search_lowest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } /* * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload) +sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload, + int mintrans) { struct cpu_search s; struct cpu_search_res r; s.cs_mask = mask; - s.cs_limit = minload; + s.cs_load = minload; + s.cs_trans = mintrans; cpu_search_highest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } static void @@ -836,7 +836,7 @@ sched_balance_group(struct cpu_group *cg) CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 1); + high = sched_highest(cg, &hmask, 1, 0); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -1008,7 +1008,7 @@ tdq_idled(struct tdq *tdq) restart: switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; for (cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * We were assigned a thread but not preempted. Returning * 0 here will cause our caller to switch to it. @@ -1968,7 +1968,8 @@ tdq_trysteal(struct tdq *tdq) cpuset_t mask; int cpu, i, goup; - if (smp_started == 0 || trysteal_limit == 0 || tdq->tdq_cg == NULL) + if (smp_started == 0 || steal_idle == 0 || trysteal_limit == 0 || + tdq->tdq_cg == NULL) return; CPU_FILL(&mask); CPU_CLR(PCPU_GET(cpuid), &mask); @@ -1976,7 +1977,7 @@ tdq_trysteal(struct tdq *tdq) spinlock_enter(); TDQ_UNLOCK(tdq); for (i = 1, cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * If a thread was added while interrupts were disabled don't * steal one here. @@ -2019,7 +2020,9 @@ tdq_trysteal(struct tdq *tdq) steal = TDQ_CPU(cpu); /* * The data returned by sched_highest() is stale and - * the chosen CPU no longer has an eligible thread. + * the chosen CPU no longer has an eligible thread. + * At this point unconditonally exit the loop to bound + * the time spent in the critcal section. */ if (steal->tdq_load < steal_thresh || steal->tdq_transferable == 0) @@ -2028,8 +2031,7 @@ tdq_trysteal(struct tdq *tdq) * Try to lock both queues. If we are assigned a thread while * waited for the lock, switch to it now instead of stealing. * If we can't get the lock, then somebody likely got there - * first. At this point unconditonally exit the loop to - * bound the time spent in the critcal section. + * first. */ TDQ_LOCK(tdq); if (tdq->tdq_load > 0) From nobody Thu Oct 21 22:31:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A5D09181363C; Thu, 21 Oct 2021 22:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2Jq3LD9z4fXP; Thu, 21 Oct 2021 22:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70F62234EE; Thu, 21 Oct 2021 22:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMVcD0018885; Thu, 21 Oct 2021 22:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMVc0d018884; Thu, 21 Oct 2021 22:31:38 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:31:38 GMT Message-Id: <202110212231.19LMVc0d018884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 1e7091ac7cf2 - stable/13 - sched_ule(4): Fix possible significance loss. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e7091ac7cf222a1fbc2b318b1b12b16fcbb5b50 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1e7091ac7cf222a1fbc2b318b1b12b16fcbb5b50 commit 1e7091ac7cf222a1fbc2b318b1b12b16fcbb5b50 Author: Alexander Motin AuthorDate: 2021-10-02 03:47:18 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:24:36 +0000 sched_ule(4): Fix possible significance loss. Before this change kern.sched.interact sysctl setting above 32 gave all interactive threads identical priority of PRI_MIN_INTERACT due to ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / sched_interact) turning zero. Setting the sysctl lower reduced the range of used priority levels up to half, that is not great either. Change of the operations order should fix the issue, always using full range of priorities, while overflow is impossible there since both score and priority values are small. While there, make the variables unsigned as they really are. MFC after: 1 month (cherry picked from commit 1c119e173ddc7f5603a3b6cf940dc524e494a667) --- sys/kern/sched_ule.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 6f072c518934..708c19b27394 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -207,7 +207,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= * sched_slice: Runtime of each thread before rescheduling. * preempt_thresh: Priority threshold for preemption and remote IPIs. */ -static int __read_mostly sched_interact = SCHED_INTERACT_THRESH; +static u_int __read_mostly sched_interact = SCHED_INTERACT_THRESH; static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT; static int __read_mostly realstathz = 127; /* reset during boot. */ static int __read_mostly sched_slice = 10; /* reset during boot. */ @@ -1616,8 +1616,7 @@ sched_interact_score(struct thread *td) static void sched_priority(struct thread *td) { - int score; - int pri; + u_int pri, score; if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE) return; @@ -1637,10 +1636,10 @@ sched_priority(struct thread *td) score = imax(0, sched_interact_score(td) + td->td_proc->p_nice); if (score < sched_interact) { pri = PRI_MIN_INTERACT; - pri += ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / - sched_interact) * score; + pri += (PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) * score / + sched_interact; KASSERT(pri >= PRI_MIN_INTERACT && pri <= PRI_MAX_INTERACT, - ("sched_priority: invalid interactive priority %d score %d", + ("sched_priority: invalid interactive priority %u score %u", pri, score)); } else { pri = SCHED_PRI_MIN; @@ -1649,7 +1648,7 @@ sched_priority(struct thread *td) SCHED_PRI_RANGE - 1); pri += SCHED_PRI_NICE(td->td_proc->p_nice); KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH, - ("sched_priority: invalid priority %d: nice %d, " + ("sched_priority: invalid priority %u: nice %d, " "ticks %d ftick %d ltick %d tick pri %d", pri, td->td_proc->p_nice, td_get_sched(td)->ts_ticks, td_get_sched(td)->ts_ftick, td_get_sched(td)->ts_ltick, @@ -3174,7 +3173,7 @@ SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, "Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, "Quantum for timeshare threads in stathz ticks"); -SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, +SYSCTL_UINT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, "Interactivity score threshold"); SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, 0, From nobody Thu Oct 21 22:44:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8B247181A38C; Thu, 21 Oct 2021 22:44: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2c73ZcTz4lQH; Thu, 21 Oct 2021 22:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56EAE236BF; Thu, 21 Oct 2021 22:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMit9p033399; Thu, 21 Oct 2021 22:44:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMituh033398; Thu, 21 Oct 2021 22:44:55 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:44:55 GMT Message-Id: <202110212244.19LMituh033398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: b7eded5ea1f1 - stable/12 - sched_ule(4): Fix possible significance loss. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b7eded5ea1f1b051489627989c13d9e48521ed9f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b7eded5ea1f1b051489627989c13d9e48521ed9f commit b7eded5ea1f1b051489627989c13d9e48521ed9f Author: Alexander Motin AuthorDate: 2021-10-02 03:47:18 +0000 Commit: Alexander Motin CommitDate: 2021-10-21 22:44:29 +0000 sched_ule(4): Fix possible significance loss. Before this change kern.sched.interact sysctl setting above 32 gave all interactive threads identical priority of PRI_MIN_INTERACT due to ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / sched_interact) turning zero. Setting the sysctl lower reduced the range of used priority levels up to half, that is not great either. Change of the operations order should fix the issue, always using full range of priorities, while overflow is impossible there since both score and priority values are small. While there, make the variables unsigned as they really are. MFC after: 1 month (cherry picked from commit 1c119e173ddc7f5603a3b6cf940dc524e494a667) --- sys/kern/sched_ule.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 20835a0b2c5f..ed5cef8ab80a 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -206,7 +206,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= * sched_slice: Runtime of each thread before rescheduling. * preempt_thresh: Priority threshold for preemption and remote IPIs. */ -static int __read_mostly sched_interact = SCHED_INTERACT_THRESH; +static u_int __read_mostly sched_interact = SCHED_INTERACT_THRESH; static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT; static int __read_mostly realstathz = 127; /* reset during boot. */ static int __read_mostly sched_slice = 10; /* reset during boot. */ @@ -1576,8 +1576,7 @@ sched_interact_score(struct thread *td) static void sched_priority(struct thread *td) { - int score; - int pri; + u_int pri, score; if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE) return; @@ -1597,10 +1596,10 @@ sched_priority(struct thread *td) score = imax(0, sched_interact_score(td) + td->td_proc->p_nice); if (score < sched_interact) { pri = PRI_MIN_INTERACT; - pri += ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / - sched_interact) * score; + pri += (PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) * score / + sched_interact; KASSERT(pri >= PRI_MIN_INTERACT && pri <= PRI_MAX_INTERACT, - ("sched_priority: invalid interactive priority %d score %d", + ("sched_priority: invalid interactive priority %u score %u", pri, score)); } else { pri = SCHED_PRI_MIN; @@ -1609,7 +1608,7 @@ sched_priority(struct thread *td) SCHED_PRI_RANGE - 1); pri += SCHED_PRI_NICE(td->td_proc->p_nice); KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH, - ("sched_priority: invalid priority %d: nice %d, " + ("sched_priority: invalid priority %u: nice %d, " "ticks %d ftick %d ltick %d tick pri %d", pri, td->td_proc->p_nice, td_get_sched(td)->ts_ticks, td_get_sched(td)->ts_ftick, td_get_sched(td)->ts_ltick, @@ -3070,7 +3069,7 @@ SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, "Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, "Quantum for timeshare threads in stathz ticks"); -SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, +SYSCTL_UINT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, "Interactivity score threshold"); SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, 0, From nobody Thu Oct 21 22:48:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 788D5181A904; Thu, 21 Oct 2021 22:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb2gs30xtz4m00; Thu, 21 Oct 2021 22:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 470AC236C1; Thu, 21 Oct 2021 22:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LMm9X5033738; Thu, 21 Oct 2021 22:48:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LMm9Pv033737; Thu, 21 Oct 2021 22:48:09 GMT (envelope-from git) Date: Thu, 21 Oct 2021 22:48:09 GMT Message-Id: <202110212248.19LMm9Pv033737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 51a3024ee71a - releng/12.3 - 12.3: Makefile: add a newline to validate the git->svn exporter List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 51a3024ee71a1ffebed139a40a534cdb2284d888 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=51a3024ee71a1ffebed139a40a534cdb2284d888 commit 51a3024ee71a1ffebed139a40a534cdb2284d888 Author: Glen Barber AuthorDate: 2021-10-21 22:47:31 +0000 Commit: Glen Barber CommitDate: 2021-10-21 22:47:31 +0000 12.3: Makefile: add a newline to validate the git->svn exporter Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 21ce26f215c9..f86f483f55d6 100644 --- a/Makefile +++ b/Makefile @@ -743,3 +743,4 @@ MAKE_JOB_ERROR_TOKEN= no .endif # bmake .endif # DIRDEPS_BUILD + From nobody Thu Oct 21 23:09:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D158817F2EAB; Thu, 21 Oct 2021 23:09:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb3875dwBz4sHF; Thu, 21 Oct 2021 23:09:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E94D23C37; Thu, 21 Oct 2021 23:09:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LN9B3V061167; Thu, 21 Oct 2021 23:09:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LN9B6t061166; Thu, 21 Oct 2021 23:09:11 GMT (envelope-from git) Date: Thu, 21 Oct 2021 23:09:11 GMT Message-Id: <202110212309.19LN9B6t061166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: b9c0a61651a2 - releng/12.3 - Revert "12.3: Makefile: add a newline to validate the git->svn exporter" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: b9c0a61651a21c2c6dc546479f382c5a5831bdb5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=b9c0a61651a21c2c6dc546479f382c5a5831bdb5 commit b9c0a61651a21c2c6dc546479f382c5a5831bdb5 Author: Glen Barber AuthorDate: 2021-10-21 23:08:30 +0000 Commit: Glen Barber CommitDate: 2021-10-21 23:08:30 +0000 Revert "12.3: Makefile: add a newline to validate the git->svn exporter" This reverts commit 51a3024ee71a1ffebed139a40a534cdb2284d888. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index f86f483f55d6..21ce26f215c9 100644 --- a/Makefile +++ b/Makefile @@ -743,4 +743,3 @@ MAKE_JOB_ERROR_TOKEN= no .endif # bmake .endif # DIRDEPS_BUILD - From nobody Fri Oct 22 03:17:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4E022181C124; Fri, 22 Oct 2021 03:17:02 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb8f61gQTz3D04; Fri, 22 Oct 2021 03:17:02 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634872622; 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=lYUe9SoWbU5zlfs6MVKTMtM7bJ8ZOxJX7m3VYeWeYkc=; b=uPyBSGtzMXXb+fB/K8cnHdY1SwG4hs9xYF5LxKyjdg6vCgVK9D95rpsA96c+/I86CY+IU3 sIZIdKMrBfUQvFCKNxzBLBm0Ge8tJd0Uj6VbGuaA6cqytcPSs7kh9RZkKL2Rv1z9SRsTVK 0hU6iiGa54xuo7qkfZ2Cr7PLfVdscFQPAnfqmtUQXErYiR+qbg2abSJombQpt77XkA0xh5 Imm9KPREOA14dw9NmuXv8K8vcHp9onTKG/NOlU108HuAX9EdTwYZ92KSEd36aA0jjPCCj1 nk4Ncl/YrzxhJVpbEY+MrnDEvvL5YYxkjEg6Iwz6kQgVYyRGuS6VCdNXclSWQw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 243D08453; Fri, 22 Oct 2021 03:17:02 +0000 (UTC) Date: Fri, 22 Oct 2021 03:17:02 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634872622; 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=lYUe9SoWbU5zlfs6MVKTMtM7bJ8ZOxJX7m3VYeWeYkc=; b=aLDEb8ZuTcJJBDOymYFn+/t2MkmY9LDPpRuSKiB5WvUOjym/CzxASur+RgbF4eg05AmrmD CissBJmpH/w/GExyza10LV/EOwKt4mS7loHe8I3zfauELeIZpVIxw6aG4YM/nSA41ZtFsW sVh83yGg+kyIFRsojepvmtUknZhx3eQQZKAnkm4lRud1lTmU9VIsHmgQcg9RTo1LBEOp5C L74wEMiqqED8EAEeHHdoBS+5c2YUKdoI9QV9QHaAMS3NkyCvFcdG78jQiLIEo6zD6hELne YbwA6eYYm7U7H3A8sQE0HJ7cu9jqOrKj3uIeYziPcGbi805UjAfGYC+FjJOa6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634872622; a=rsa-sha256; cv=none; b=AxU0P2zPrLuaWcRX7ovvTx7uYYvdMOvHDyRTiKNi1PUAuF28k/5pL3K/tU0BHwmnlIIECT qLM4DhaTZBAO6Xi6ela+PZlfmxmHw2ymQkupAdQh4vGiJSFgFYoZEqxFwOVOloJrU/iVhF DzWSvJ1mzI8FUyue0Vl12CktqlAPmSpB3oeeqsZgJUUctd4t31uab6TgX6/8hiHIrd9OIY MSkDyEAGmg0U20zZb5MTIbaQgkzr/STIBIhiDnADBWnBbVJ/sTGhJbSYtRgqHg12WtuvyV L+H879tiEcR18RCr3naQk4+YahwRrymBJOIGDQ+dIbS5XUNtl+VcuBO5UOSFcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 01:52:26PM -0600, Warner Losh wrote: > This discussion to date has been data free. I created a poll... > > https://twitter.com/bsdimp/status/1451274644439265308 You couldn't use neutral wording, could you? The poll is loaded with bias, this is not the way to collect answers. FWIW, FreeBSD itself does not make "loud, annoying noise", it simply instructs the underlying hardware to beep. You've asked if people enjoy loud, annoying beeps -- well, nobody does, but that's not what we're discussing here. ./danfe From nobody Fri Oct 22 03:54:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 608FA180375C; Fri, 22 Oct 2021 03:54: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb9TG2HsQz3NHp; Fri, 22 Oct 2021 03:54:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3026C27A17; Fri, 22 Oct 2021 03:54:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M3sQEF045465; Fri, 22 Oct 2021 03:54:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M3sQYp045464; Fri, 22 Oct 2021 03:54:26 GMT (envelope-from git) Date: Fri, 22 Oct 2021 03:54:26 GMT Message-Id: <202110220354.19M3sQYp045464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 73f8667ed4d5 - main - Document my doc commit bit history List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73f8667ed4d5c483ef5602698cdd7cd24b1c2290 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=73f8667ed4d5c483ef5602698cdd7cd24b1c2290 commit 73f8667ed4d5c483ef5602698cdd7cd24b1c2290 Author: Li-Wen Hsu AuthorDate: 2021-10-22 03:54:06 +0000 Commit: Li-Wen Hsu CommitDate: 2021-10-22 03:54:06 +0000 Document my doc commit bit history Reminded by: ygy --- share/misc/committers-doc.dot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index a4297f2442db..8a256548e758 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -82,6 +82,7 @@ joel [label="Joel Dahl\njoel@FreeBSD.org\n2005/04/05"] keramida [label="Giorgos Keramidas\nkeramida@FreeBSD.org\n2001/10/12"] linimon [label="Mark Linimon\nlinimon@FreeBSD.org\n2004/03/31"] loader [label="Fukang Chen\nloader@FreeBSD.org\n2007/07/30"] +lwhsu [label="Li-Wen Hsu\nlwhsu@FreeBSD.org\n2021/08/01"] manolis [label="Manolis Kiagias\nmanolis@FreeBSD.org\n2008/05/24"] marck [label="Dmitry Morozovsky\nmarck@FreeBSD.org\n2004/08/10"] maxim [label="Maxim Konovalov\nmaxim@FreeBSD.org\n2002/02/07"] @@ -132,6 +133,8 @@ blackend -> ceri brueffer -> joel +carlavilla -> lwhsu + ceri -> brd ceri -> brueffer ceri -> linimon @@ -210,4 +213,6 @@ trhodes -> jcamou wblock -> jgh wblock -> allanjude + +ygy -> lwhsu } From nobody Fri Oct 22 04:00:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 606401805431; Fri, 22 Oct 2021 04:00:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hb9bm2Hhcz3PZT; Fri, 22 Oct 2021 04:00:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E6F627B98; Fri, 22 Oct 2021 04:00:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M4043S049035; Fri, 22 Oct 2021 04:00:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M404RC049032; Fri, 22 Oct 2021 04:00:04 GMT (envelope-from git) Date: Fri, 22 Oct 2021 04:00:04 GMT Message-Id: <202110220400.19M404RC049032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: d8359af5b642 - stable/13 - devd(8): Note default config file search locations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d8359af5b642c0d194aedce90ebd1415e0c483d6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d8359af5b642c0d194aedce90ebd1415e0c483d6 commit d8359af5b642c0d194aedce90ebd1415e0c483d6 Author: Felix Johnson AuthorDate: 2021-10-19 04:37:40 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-22 03:59:17 +0000 devd(8): Note default config file search locations PR: 197003 Reported by: Harald Schmalzbauer (cherry picked from commit bad324ace4f817206baf86ae7379c35c8199048e) --- sbin/devd/devd.8 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sbin/devd/devd.8 b/sbin/devd/devd.8 index fa05db734b88..77c8e4aac2fb 100644 --- a/sbin/devd/devd.8 +++ b/sbin/devd/devd.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 19, 2021 .Dt DEVD 8 .Os .Sh NAME @@ -115,10 +115,16 @@ option and uses that file to drive the rest of the process. While the format of this file is described in .Xr devd.conf 5 , some basics are covered here. +.Pp In the .Ic options section, one can define multiple directories to search for config files. +The default config file specifies +.Pa /etc/devd +and +.Pa /usr/local/etc/devd +as directories to search. All files in these directories whose names match the pattern .Pa *.conf are parsed. From nobody Fri Oct 22 04:55:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 667CE181D0DC for ; Fri, 22 Oct 2021 04:55:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbBqR1ygzz3tqn for ; Fri, 22 Oct 2021 04:55:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92e.google.com with SMTP id a17so5342165uax.12 for ; Thu, 21 Oct 2021 21:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jqBJ1tsfuYUf7teV3iTtFxUn97wSyUwtOOrLlrRZtH0=; b=WvvJrugS3d/OqfeDeDCnqjIX3PBJl8F59TK85wrWFuCtjeHbGrqkB37cNb868CGzob oFNSAGvLlzOWTA9CLfrfNwN5pggjUq0S2CEC86oZcDIV0DgxHsd+MoUZsWJ/jMAAMBVp r6YoO2yVlpQj8OwkHjODNJVY0vLsmzzLQyzk75R1G9nxdcD1qTBXMecEZF6NGHHJkK4i qySw6KqQBPcoZ8mO6pwoe7rYNUipnj8MYX84lWi8JKkp7xHr5Ik2wPwAythQc2E2AhiN CiE1mqAbuBB63rCn4JrAfeWXYRhatzVCJJEM35XjXTCVf/BdS7VK/NeWkNIi7jVP1GCf LeFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jqBJ1tsfuYUf7teV3iTtFxUn97wSyUwtOOrLlrRZtH0=; b=iQpOVzJjTzVikdcGKEB98UdI9a3kMqErGY8qAdAqa2r4k36Ox7L9zCXynDVWxhzs1I aIIdstnHK2or9wnbrFmbegQK5ESy+X0vZKu71gcZVJm2hk/7C7VBc5lioFYUSkX0JHWm ciIDyaQemMx/u0kKpedasthz4UaD/IjHAxMp5TGDu6w5BM0jIh8LKNOlER/zuOf1Adok k7pS/sbcDfj1nu0VEZZMXPCGbKns6IpwudD7nzLF19KhHoms4GUKWMzj3cnhY/uRgZAO /s1ZG8uQmjnuKpJgvNWQN34q/Nk3qzFZuef5yGGQrgY8vNzm75DaZoI8VHx1JGRPNAdQ rgLA== X-Gm-Message-State: AOAM53135uncivJ0eRdH4vJuNIfYw7ZVAEBwF7Zd+CiREKD3hyKwv89+ YdLX2By6v43ZCR7UNRz4BOA043oHIm1dm0mEcbtEtPWUEXhalA== X-Google-Smtp-Source: ABdhPJzpy3+ArY3ZE+MksfY2CyJRh37TGQqMNPtUWGEKtphCatYMEY0JhMNB6It3vAUpvqwfQ18txAcRrbMuObpyhiU= X-Received: by 2002:a67:ab48:: with SMTP id k8mr12933297vsh.30.1634878509332; Thu, 21 Oct 2021 21:55:09 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Thu, 21 Oct 2021 22:55:00 -0600 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: Alexey Dokuchaev Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000ccd16005cee9d0b2" X-Rspamd-Queue-Id: 4HbBqR1ygzz3tqn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000ccd16005cee9d0b2 Content-Type: text/plain; charset="UTF-8" On Thu, Oct 21, 2021 at 9:17 PM Alexey Dokuchaev wrote: > On Thu, Oct 21, 2021 at 01:52:26PM -0600, Warner Losh wrote: > > This discussion to date has been data free. I created a poll... > > > > https://twitter.com/bsdimp/status/1451274644439265308 > > You couldn't use neutral wording, could you? The poll is loaded > with bias, this is not the way to collect answers. FWIW, FreeBSD > itself does not make "loud, annoying noise", it simply instructs > the underlying hardware to beep. You've asked if people enjoy > loud, annoying beeps -- well, nobody does, but that's not what > we're discussing here. > FreeBSD controls the pitch and duration of the noise. And there's at least one bug in it. It looks like we want 800Hz: #define VT_BELLPITCH 800 But we ring the bell with sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); which looks almost sane. 1.193182MHz is the clock frequency of the IBM PC PIT square wave generator. And normally it's programmed by dividing this base clock by the desired clock. So we're passing in 1491 into sysbeep. We have a tuneable for the 8254 frequency that the PIT uses, so it's a bug that we're ignoring that and hard coding this value. Now, sysbeep is only defined on x86, where this is timer_spkr_setfreq(pitch); otherwise it's nothing. So, timer_spkr_setfreq looks like: freq = i8254_freq / freq; outb(TIMER_CNTR2, freq & 0xff); outb(TIMER_CNTR2, freq >> 8); so this computation means we are actually playing a 1491Hz tone for 50ms. You can verify this will be the frequency with any PC speaker tutorial. This corresponds to no natural note in western music. F#6 is 1480Hz and F6 is 1397Hz. So the tone that's generated is a dissonant note. C4 is middle C, so this is two octaves higher and a little bit. Even the 800Hz is between G5 and G5#. Not a great note, but at least it's an octave lower. So even the desired beep is dissonant. Since most people find music pleasing, that makes it objectively annoying. A similar analysis for the other common tunings (where A4 is one of 432, 436, 438, 440 (the most common these days), 442, 444, and 446Hz) yields similar results with varying degrees of subtonal dissonance. Also, 50ms is 1/20th of a second (give of take), which translates to about 600 beats per minute, which is annoyingly fast, as any musician would tell you. The only saving grace is that it's done only once. Also, the poll is running 4 to 1 for silence by default. While any bias in wording mighthave pushed it a little one way or the other, when it's this lopsided it's hard to argue that such bias affected the actual outcome. Our users aren't so unsophisticated as to be totally swayed by the choice of wording. The reply tweets suggest people know exactly what I'm talking about. Iknow it isn't scientific, but it is highly suggestive given the 60 point spread. Even had I used differentwording, my followers on twitter are self selecting which is likely a biggersource of error, and lord knows what Twitter's algorithms do to distort who sees it. And likely a dozen other factors I've not even thought of. Warner P.S. We likely should fix this bug, and also change the note to 880, which is A5 (the second A above middle C). Please see https://reviews.freebsd.org/D32594 for a fix for the bug I found here. --000000000000ccd16005cee9d0b2-- From nobody Fri Oct 22 05:19:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5E66417F5776 for ; Fri, 22 Oct 2021 05:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbCMk2Ctkz4THy; Fri, 22 Oct 2021 05:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 225AA77A; Fri, 22 Oct 2021 05:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M5JkbL052877; Fri, 22 Oct 2021 05:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M5Jk7A052876; Fri, 22 Oct 2021 05:19:46 GMT (envelope-from git) Date: Fri, 22 Oct 2021 05:19:46 GMT Message-Id: <202110220519.19M5Jk7A052876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: c28d35783173..c66f7aacfc78 - vendor/tzdata - vendor branch updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/vendor/tzdata X-Git-Reftype: branch X-Git-Commit: c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74 X-Git-Oldrev: c28d35783173c0b09ca1f7e29d2565b1602f733d X-Git-Newrev: c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch vendor/tzdata has been updated by philip: URL: https://cgit.FreeBSD.org/src/log/?id=c28d35783173..c66f7aacfc78 c66f7aacfc78 Import tzdata 2021e From nobody Fri Oct 22 05:19:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7273F17F58AF for ; Fri, 22 Oct 2021 05:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbCMk2kJLz4TLG; Fri, 22 Oct 2021 05:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC74B6D; Fri, 22 Oct 2021 05:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M5JkxO052901; Fri, 22 Oct 2021 05:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M5JkRI052900; Fri, 22 Oct 2021 05:19:46 GMT (envelope-from git) Date: Fri, 22 Oct 2021 05:19:46 GMT Message-Id: <202110220519.19M5JkRI052900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: 0a8accaf3606 - Create tag vendor/tzdata/tzdata2021e List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/tags/vendor/tzdata/tzdata2021e X-Git-Reftype: annotated tag X-Git-Commit: 0a8accaf3606d17f8d4115df893ebd5d983266ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The annotated tag vendor/tzdata/tzdata2021e has been created by philip: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tzdata/tzdata2021e tag vendor/tzdata/tzdata2021e Tagger: Philip Paeps TaggerDate: 2021-10-22 05:17:41 +0000 Tag import of tzdata 2021e commit c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74 Author: Philip Paeps AuthorDate: 2021-10-22 05:17:04 +0000 Commit: Philip Paeps CommitDate: 2021-10-22 05:17:04 +0000 Import tzdata 2021e From nobody Fri Oct 22 05:22:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 927D9180104A; Fri, 22 Oct 2021 05:22: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbCQc3q0Zz4Wb9; Fri, 22 Oct 2021 05:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63E4FD21; Fri, 22 Oct 2021 05:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M5MGqJ065389; Fri, 22 Oct 2021 05:22:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M5MDY7065386; Fri, 22 Oct 2021 05:22:13 GMT (envelope-from git) Date: Fri, 22 Oct 2021 05:22:13 GMT Message-Id: <202110220522.19M5MDY7065386@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: b02df2322c86 - main - contrib/tzdata: import tzdata 2021e List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: b02df2322c861221ae60c5b06886f6f68368307d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=b02df2322c861221ae60c5b06886f6f68368307d commit b02df2322c861221ae60c5b06886f6f68368307d Merge: 73f8667ed4d5 c66f7aacfc78 Author: Philip Paeps AuthorDate: 2021-10-22 05:20:20 +0000 Commit: Philip Paeps CommitDate: 2021-10-22 05:20:20 +0000 contrib/tzdata: import tzdata 2021e Merge commit 'c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74' Changes: https://github.com/eggert/tz/blob/2021e/NEWS MFC after: 3 days contrib/tzdata/NEWS | 8 ++++++++ contrib/tzdata/asia | 19 +++++++++++++------ contrib/tzdata/version | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) From nobody Fri Oct 22 06:06:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 175E318121E2; Fri, 22 Oct 2021 06:06:31 +0000 (UTC) (envelope-from avg@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbDPg08yhz4hVm; Fri, 22 Oct 2021 06:06:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from [192.168.0.88] (unknown [195.64.148.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 03E8C2D558; Fri, 22 Oct 2021 06:06:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) To: Warner Losh Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> From: Andriy Gapon Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <718707f9-57e9-057e-1811-f9229f2da9de@FreeBSD.org> Date: Fri, 22 Oct 2021 09:06:27 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N On 21/10/2021 22:52, Warner Losh wrote: > This discussion to date has been data free. I created a poll... > > https://twitter.com/bsdimp/status/1451274644439265308 > I tried to abstain from this discussion on whether the bike shed should have been repainted although I do have an opinion :-) Don't have we have anything better than twitter for such a poll? Something on FreeBSD infra maybe? I recall some polls and surveys in the past and they weren't on twitter. Reading some comments on twitter (thankfully I don't need to sign up for that) I see a valid point about feature discoverability. If it beeps, I know that it can beep. And if that annoys me, I'll try to research how to disable it. If it doesn't beep, how would I even know that it can beep? (Asking for a 15 year old friend). Maybe I would find the beeping useful and pleasant, but what are my chances of learning that it exists? -- Andriy Gapon From nobody Fri Oct 22 06:28:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06D7A17F4DFC; Fri, 22 Oct 2021 06:28:23 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbDtt1Pzlz4qTj; Fri, 22 Oct 2021 06:28:22 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634884102; 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=k0N9R22+Ecpb/SnnoiPv7mQYZQuedt+e+xLhK1Ukpzw=; b=nD0TIuYfOPjtTJReqSU3rUS8HFgfu1oJi8p7QFBcrCrwAKVRoiQ1zuy3GspLEhOgoZqJar H+BIvl7MGmdZ9AjiP/jy1hOcZou+/ohCKZdnEHSOLF/zbiW0Oi1qfHG1R23OXbqxtjpZXD 8aL9aZoIpxs1WLPvicjjZ+4hXWI5MJ4L0XgtOxkWwjYalTx9QqXva+xLPRLN0aW63+toU7 xwl/Q1H6YCwmCMK/dPImzwirc+pbueJ/9lTvc9zQ10eYt5qVGN282Yn5eaS2LNdJBdQm1b n6/4f9WC3aNUR90NOL0ELmn50OOaYZMxzyLoQX3DsL4jyLc1mxdSARuLXAJYtg== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 15B9D8DDD; Fri, 22 Oct 2021 06:28:22 +0000 (UTC) Date: Fri, 22 Oct 2021 06:28:22 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1634884102; 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=k0N9R22+Ecpb/SnnoiPv7mQYZQuedt+e+xLhK1Ukpzw=; b=ZK88VP+4WsCeEEPTehxJb0xDDbU5/vY1GT74DBB0rgwDTdgOJpx1HQcKkjsrLKTft+waos uH45SlBS/q9gAFEU5SkFRLZJiEnE7PfRL5NAfcUhceKjTwGQwHEbUtbTdUDvzaaJAjO5cB MSgHps6fbYl8vJdFst/dYBKcN0z+vjS91qDL9n7azjBaahcEhM6ZvguzTjv6Ar5SybpDCg lttx+S1mbkaoQoC0D0UIKqnmyhOVkJ1s1Zv72iHvVXg6J16WSkrP9eiGrCKt/G4/AFdCOy 2yPheEXtIQxCgjEoRiL5ss5LhkKNlT9eU2HoVEDJ1nIPGFMzCxKLJH9/UxLBCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1634884102; a=rsa-sha256; cv=none; b=CFXI3llnv9Dc0fWtCaf9PL1p5gn1qtCoOYZN+QtsjQK/m2wRizHKff6psaBQNk18B8axsO fuFVFUA35yuicBGUXDOXu0q8K3B4AMbmi1PEhhVMVJrBF44+ngOJ2rzaePEkv+yex20961 H2snoUFQWCVWqDFuqXjteylyPrxFNhpolIY9WKBeXP3aI2qOSRK7D2X8NuJAvylo4mNTMC OEJ7Cmw1+8L3yp4vBO/FRDcihTFxsutgTR9AVCzxfVS7uFeoE6hV2yvyS3bBdtbdewb7G3 +fErsPsYhsiaunAcCmZa05ua0F9qfkuUvfTLxHcLhfs9/mDWfybASgst3E7ckg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 10:55:00PM -0600, Warner Losh wrote: > On Thu, Oct 21, 2021 at 9:17 PM Alexey Dokuchaev wrote: > > On Thu, Oct 21, 2021 at 01:52:26PM -0600, Warner Losh wrote: > > > This discussion to date has been data free. I created a poll... > > > > > > https://twitter.com/bsdimp/status/1451274644439265308 > > > > You couldn't use neutral wording, could you? The poll is loaded > > with bias, this is not the way to collect answers. FWIW, FreeBSD > > itself does not make "loud, annoying noise", it simply instructs > > the underlying hardware to beep. You've asked if people enjoy > > loud, annoying beeps -- well, nobody does, but that's not what > > we're discussing here. > > FreeBSD controls the pitch and duration of the noise. And there's > at least one bug in it. > > [ technical details skipped ] > Since most people find music pleasing, that makes it objectively > annoying. A similar analysis for the other common tunings (where > A4 is one of 432, 436, 438, 440 (the most common these days), 442, > 444, and 446Hz) yields similar results with varying degrees of > subtonal dissonance. Good, so let's fix the bug and make emitted sound more pleasant by default, good catch! > Also, the poll is running 4 to 1 for silence by default. While any > bias in wording mighthave pushed it a little one way or the other, > when it's this lopsided it's hard to argue that such bias affected > the actual outcome. Or it could, should you have worded it differently, we don't know. > Our users aren't so unsophisticated as to be totally swayed by the > choice of wording. This is not how it works Warner, you don't first offer biased poll and then defend skewed results by appealing to observed ratio and how smart your target audience is. ./danfe From nobody Fri Oct 22 07:27:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5DC4181554C; Fri, 22 Oct 2021 07:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbGCP4mkdz3MGt; Fri, 22 Oct 2021 07:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FF7522DE; Fri, 22 Oct 2021 07:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M7RjoI026045; Fri, 22 Oct 2021 07:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M7RjfZ026044; Fri, 22 Oct 2021 07:27:45 GMT (envelope-from git) Date: Fri, 22 Oct 2021 07:27:45 GMT Message-Id: <202110220727.19M7RjfZ026044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: cfd8fda15939 - main - RELNOTES: Fix KMSAN entry List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfd8fda15939c931d3788d49d6cad586c7899bd9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=cfd8fda15939c931d3788d49d6cad586c7899bd9 commit cfd8fda15939c931d3788d49d6cad586c7899bd9 Author: Elliott Mitchell AuthorDate: 2021-10-22 07:16:54 +0000 Commit: Li-Wen Hsu CommitDate: 2021-10-22 07:16:54 +0000 RELNOTES: Fix KMSAN entry The lead digit was lost in 05eba8e068c1 making it impossible to find the commit. The two subsequent RELNOTES commits gave one less digit of the commit hash, which is what `git rev-parse --short` thinks the minimal length is, but keep them to align with other entries. Fixes: 05eba8e068c1 Differential Revision: https://reviews.freebsd.org/D32595 --- RELNOTES | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELNOTES b/RELNOTES index 60942ddd5422..0c6c1c2f4ffc 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,16 +10,16 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. -d410b585b6f: +d410b585b6f0: sh(1) is now the default shell for the root user. -396851c20ae: +396851c20aeb: libncursesw has been split into libtinfow and libncursesw, linker scripts should make it transparent for consumers. pkg-config files are also now installed to ease ports detecting the ncurses setup from base. -422084abbda: +a422084abbda: LLVM's MemorySanitizer can now be used in amd64 kernels. See the kmsan(9) manual page for more information. From nobody Fri Oct 22 08:56:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C85731813D1C; Fri, 22 Oct 2021 08:56: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbJBD5FRVz4WsB; Fri, 22 Oct 2021 08:56:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91EF13ACB; Fri, 22 Oct 2021 08:56:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M8uqGR044656; Fri, 22 Oct 2021 08:56:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M8uqxw044655; Fri, 22 Oct 2021 08:56:52 GMT (envelope-from git) Date: Fri, 22 Oct 2021 08:56:52 GMT Message-Id: <202110220856.19M8uqxw044655@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: ab238f14544b - main - pf: ensure we have the correct source/destination IP address in ICMP errors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab238f14544b2415561c4fed674ee360aa8b5860 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab238f14544b2415561c4fed674ee360aa8b5860 commit ab238f14544b2415561c4fed674ee360aa8b5860 Author: Luiz Otavio O Souza AuthorDate: 2021-10-19 11:37:54 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:52:17 +0000 pf: ensure we have the correct source/destination IP address in ICMP errors When we route-to a packet that later turns out to not fit in the outbound interface MTU we generate an ICMP error. However, if we've already changed those (i.e. we've passed through a NAT rule) we have to undo the transformation first. Obtained from: pfSense MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32571 --- sys/netpfil/pf/pf.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 2c625703c5d9..17253373628c 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -320,6 +320,8 @@ static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); +static void pf_packet_rework_nat(struct mbuf *, struct pf_pdesc *, + int, struct pf_state_key *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_kstate *, @@ -341,6 +343,16 @@ extern struct proc *pf_purge_proc; VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); +#define PACKET_UNDO_NAT(_m, _pd, _off, _s, _dir) \ + do { \ + struct pf_state_key *nk; \ + if ((_dir) == PF_OUT) \ + nk = (_s)->key[PF_SK_STACK]; \ + else \ + nk = (_s)->key[PF_SK_WIRE]; \ + pf_packet_rework_nat(_m, _pd, _off, nk); \ + } while (0) + #define PACKET_LOOPED(pd) ((pd)->pf_mtag && \ (pd)->pf_mtag->flags & PF_PACKET_LOOPED) @@ -446,6 +458,83 @@ pf_addr_cmp(struct pf_addr *a, struct pf_addr *b, sa_family_t af) return (0); } +static void +pf_packet_rework_nat(struct mbuf *m, struct pf_pdesc *pd, int off, + struct pf_state_key *nk) +{ + + switch (pd->proto) { + case IPPROTO_TCP: { + struct tcphdr *th = &pd->hdr.tcp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &th->th_sport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 0, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &th->th_dport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 0, pd->af); + m_copyback(m, off, sizeof(*th), (caddr_t)th); + break; + } + case IPPROTO_UDP: { + struct udphdr *uh = &pd->hdr.udp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &uh->uh_sport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 1, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &uh->uh_dport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 1, pd->af); + m_copyback(m, off, sizeof(*uh), (caddr_t)uh); + break; + } + case IPPROTO_ICMP: { + struct icmp *ih = &pd->hdr.icmp; + + if (nk->port[pd->sidx] != ih->icmp_id) { + pd->hdr.icmp.icmp_cksum = pf_cksum_fixup( + ih->icmp_cksum, ih->icmp_id, + nk->port[pd->sidx], 0); + ih->icmp_id = nk->port[pd->sidx]; + pd->sport = &ih->icmp_id; + + m_copyback(m, off, ICMP_MINLEN, (caddr_t)ih); + } + /* FALLTHROUGH */ + } + default: + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->src->v4.s_addr, + pd->ip_sum, nk->addr[pd->sidx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->src, &nk->addr[pd->sidx], pd->af); + break; + } + } + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->dst->v4.s_addr, + pd->ip_sum, nk->addr[pd->didx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->dst, &nk->addr[pd->didx], pd->af); + break; + } + } + break; + } +} + static __inline uint32_t pf_hashkey(struct pf_state_key *sk) { @@ -5937,6 +6026,11 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, error = EMSGSIZE; KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + (ip->ip_hl << 2) + (ip_off & IP_OFFMASK), + s, dir); + icmp_error(m0, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, ifp->if_mtu); goto done; @@ -6104,9 +6198,14 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, nd6_output_ifp(ifp, ifp, m0, &dst, NULL); else { in6_ifstat_inc(ifp, ifs6_in_toobig); - if (r->rt != PF_DUPTO) + if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + ((caddr_t)ip6 - m0->m_data) + + sizeof(struct ip6_hdr), s, dir); + icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); - else + } else goto bad; } From nobody Fri Oct 22 08:56:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4C1FA1813D21; Fri, 22 Oct 2021 08:56: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbJBF6d7vz4Wmg; Fri, 22 Oct 2021 08:56:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAD543C48; Fri, 22 Oct 2021 08:56:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M8urSp044686; Fri, 22 Oct 2021 08:56:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M8urgr044685; Fri, 22 Oct 2021 08:56:53 GMT (envelope-from git) Date: Fri, 22 Oct 2021 08:56:53 GMT Message-Id: <202110220856.19M8urgr044685@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: 30276ef12cbb - main - pf tests: test NAT-ed ICMP errors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30276ef12cbb47cdd302741096262041be30ec11 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=30276ef12cbb47cdd302741096262041be30ec11 commit 30276ef12cbb47cdd302741096262041be30ec11 Author: Kristof Provost AuthorDate: 2021-10-19 11:52:21 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:52:17 +0000 pf tests: test NAT-ed ICMP errors Ensure that the ICMP error is returned with the correct source and destination addresses. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32572 --- tests/sys/netpfil/common/Makefile | 2 + tests/sys/netpfil/common/pft_icmp_check.py | 112 +++++++++++++++++++++++++++++ tests/sys/netpfil/pf/route_to.sh | 59 +++++++++++++++ 3 files changed, 173 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index 749e0dd99469..189b8b44cfce 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -16,10 +16,12 @@ ATF_TESTS_SH+= \ ${PACKAGE}FILES+= \ utils.subr \ runner.subr \ + pft_icmp_check.py \ pft_ping.py \ pft_synflood.py \ sniffer.py +${PACKAGE}FILESMODE_pft_icmp_check.py= 0555 ${PACKAGE}FILESMODE_pft_ping.py= 0555 ${PACKAGE}FILESMODE_pft_synflood.py= 0555 diff --git a/tests/sys/netpfil/common/pft_icmp_check.py b/tests/sys/netpfil/common/pft_icmp_check.py new file mode 100644 index 000000000000..e3c5b927aa63 --- /dev/null +++ b/tests/sys/netpfil/common/pft_icmp_check.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import random +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer + +PAYLOAD_MAGIC = bytes.fromhex('42c0ffee') + +def ping(send_if, dst_ip, args): + ether = sp.Ether() + ip = sp.IP(dst=dst_ip, src=args.fromaddr[0]) + icmp = sp.ICMP(type='echo-request') + raw = sp.raw(PAYLOAD_MAGIC * 250) # We want 1000 bytes payload, -ish + + ip.flags = 2 # Don't fragment + icmp.seq = random.randint(0, 65535) + args.icmp_seq = icmp.seq + + req = ether / ip / icmp / raw + sp.sendp(req, iface=send_if, verbose=False) + +def check_icmp_too_big(args, packet): + """ + Verify that this is an ICMP packet too big error, and that the IP addresses + in the payload packet match expectations. + """ + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + + if not icmp.type == 3: + return False + ip = packet.getlayer(sp.IPerror) + if not ip: + return False + + if ip.src != args.fromaddr[0]: + print("Incorrect src addr %s" % ip.src) + return False + if ip.dst != args.to[0]: + print("Incorrect dst addr %s" % ip.dst) + return False + + icmp2 = packet.getlayer(sp.ICMPerror) + if not icmp2: + print("IPerror doesn't contain ICMP") + return False + if icmp2.seq != args.icmp_seq: + print("Incorrect icmp seq %d != %d" % (icmp2.seq, args.icmp_seq)) + return False + return True + +def main(): + parser = argparse.ArgumentParser("pft_icmp_check.py", + description="ICMP error validation tool") + parser.add_argument('--to', nargs=1, required=True, + help='The destination IP address') + parser.add_argument('--fromaddr', nargs=1, required=True, + help='The source IP address') + parser.add_argument('--sendif', nargs=1, required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP error') + + args = parser.parse_args() + sniffer = None + if not args.recvif is None: + sniffer = Sniffer(args, check_icmp_too_big) + + ping(args.sendif[0], args.to[0], args) + + if sniffer: + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + else: + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 957317eb462e..e7646a5fb7f7 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -250,10 +252,67 @@ multiwanlocal_cleanup() pft_cleanup } +atf_test_case "icmp_nat" "cleanup" +icmp_nat_head() +{ + atf_set descr 'Test that ICMP packets are correct for route-to + NAT' + atf_set require.user root +} + +icmp_nat_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_three=$(vnet_mkepair) + + vnet_mkjail gw ${epair_one}b ${epair_two}a ${epair_three}a + vnet_mkjail srv ${epair_two}b + vnet_mkjail srv2 ${epair_three}b + + ifconfig ${epair_one}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + jexec gw sysctl net.inet.ip.forwarding=1 + jexec gw ifconfig ${epair_one}b 192.0.2.1/24 up + jexec gw ifconfig ${epair_two}a 198.51.100.1/24 up + jexec gw ifconfig ${epair_three}a 203.0.113.1/24 up mtu 500 + jexec srv ifconfig ${epair_two}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv2 ifconfig ${epair_three}b 203.0.113.2/24 up mtu 500 + jexec srv2 route add default 203.0.113.1 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + jexec gw pfctl -e + pft_set_rules gw \ + "nat on ${epair_two}a inet from 192.0.2.0/24 to any -> (${epair_two}a)" \ + "nat on ${epair_three}a inet from 192.0.2.0/24 to any -> (${epair_three}a)" \ + "pass out route-to (${epair_three}a 203.0.113.2) proto icmp icmp-type echoreq" + + # Now ensure that we get an ICMP error with the correct IP addresses in it. + atf_check -s exit:0 ${common_dir}/pft_icmp_check.py \ + --to 198.51.100.2 \ + --fromaddr 192.0.2.2 \ + --recvif ${epair_one}a \ + --sendif ${epair_one}a + + # ping reports the ICMP error, so check of that too. + atf_check -s exit:2 -o match:'frag needed and DF set' \ + ping -D -c 1 -s 1000 198.51.100.2 +} + +icmp_nat_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" atf_add_test_case "multiwanlocal" + atf_add_test_case "icmp_nat" } From nobody Fri Oct 22 09:58:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 354B7180F3FE; Fri, 22 Oct 2021 09:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbKYf5g17z4qDQ; Fri, 22 Oct 2021 09:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A1554B14; Fri, 22 Oct 2021 09:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19M9wkYx025264; Fri, 22 Oct 2021 09:58:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19M9wkjX025263; Fri, 22 Oct 2021 09:58:46 GMT (envelope-from git) Date: Fri, 22 Oct 2021 09:58:46 GMT Message-Id: <202110220958.19M9wkjX025263@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: 9a6695532b39 - main - net80211/drivers: improve ieee80211_rx_stats for band List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a6695532b3997e4e2bc3fe57481cc49be5e9e93 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9a6695532b3997e4e2bc3fe57481cc49be5e9e93 commit 9a6695532b3997e4e2bc3fe57481cc49be5e9e93 Author: Bjoern A. Zeeb AuthorDate: 2021-06-06 21:14:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-22 09:55:54 +0000 net80211/drivers: improve ieee80211_rx_stats for band While IEEE80211_R_BAND was defined, there was no place to store the band. Add a field for that, adjust ieee80211_lookup_channel_rxstatus() to require it, and update drivers passing "R_{FREQ|IEEE}" in already to provide the band as well. For the moment keep the fall-back code requiring all three fields. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D30662 --- sys/dev/iwm/if_iwm.c | 5 +++++ sys/dev/rtwn/rtl8188e/r88e_rx.c | 2 ++ sys/dev/rtwn/rtl8812a/r12a_rx.c | 2 ++ sys/dev/usb/wlan/if_rsu.c | 2 ++ sys/net80211/_ieee80211.h | 3 +++ sys/net80211/ieee80211.c | 17 ++++++++++++++--- 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index b89c895efb50..f994e8e75307 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -3303,12 +3303,15 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, */ bzero(&rxs, sizeof(rxs)); rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs.r_flags |= IEEE80211_R_BAND; rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; rxs.c_ieee = le16toh(phy_info->channel); if (le16toh(phy_info->phy_flags & IWM_RX_RES_PHY_FLAGS_BAND_24)) { rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ); + rxs.c_band = IEEE80211_CHAN_2GHZ; } else { rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_5GHZ); + rxs.c_band = IEEE80211_CHAN_5GHZ; } /* rssi is in 1/2db units */ @@ -3414,10 +3417,12 @@ iwm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, */ bzero(&rxs, sizeof(rxs)); rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs.r_flags |= IEEE80211_R_BAND; rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; rxs.c_ieee = channel; rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ); + rxs.c_band = channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ; /* rssi is in 1/2db units */ rxs.c_rssi = rssi * 2; diff --git a/sys/dev/rtwn/rtl8188e/r88e_rx.c b/sys/dev/rtwn/rtl8188e/r88e_rx.c index dad1bc56446a..16510839bd44 100644 --- a/sys/dev/rtwn/rtl8188e/r88e_rx.c +++ b/sys/dev/rtwn/rtl8188e/r88e_rx.c @@ -240,8 +240,10 @@ r88e_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs, if (!sc->sc_ht40) { /* XXX center channel */ rxs->r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs->r_flags |= IEEE80211_R_BAND; rxs->c_ieee = physt->chan; rxs->c_freq = ieee80211_ieee2mhz(rxs->c_ieee, IEEE80211_CHAN_2GHZ); + rxs->c_band = IEEE80211_CHAN_2GHZ; } } diff --git a/sys/dev/rtwn/rtl8812a/r12a_rx.c b/sys/dev/rtwn/rtl8812a/r12a_rx.c index d8dcb3de12c5..98e0cabdff7c 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_rx.c +++ b/sys/dev/rtwn/rtl8812a/r12a_rx.c @@ -321,8 +321,10 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs, */ #if 0 rxs->r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs->r_flags |= IEEE80211_R_BAND; rxs->c_ieee = MS(le16toh(physt->phyw1), R12A_PHYW1_CHAN); rxs->c_freq = ieee80211_ieee2mhz(rxs->c_ieee, (rxs->c_ieee < 36) ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ); + rxs->c_band = (rxs->c_ieee < 36) ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ; #endif } diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 4dd1c624b9d0..747e3532cde4 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -2081,9 +2081,11 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) /* Set channel flags for input path */ bzero(&rxs, sizeof(rxs)); rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs.r_flags |= IEEE80211_R_BAND; rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; rxs.c_ieee = le32toh(bss->config.dsconfig); rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ); + rxs.c_band = IEEE80211_CHAN_2GHZ; /* This is a number from 0..100; so let's just divide it down a bit */ rxs.c_rssi = le32toh(bss->rssi) / 2; rxs.c_nf = -96; diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h index dc6773afac09..754e4647e82f 100644 --- a/sys/net80211/_ieee80211.h +++ b/sys/net80211/_ieee80211.h @@ -612,6 +612,9 @@ struct ieee80211_rx_stats { uint8_t c_ieee; /* Channel */ uint8_t c_width; /* channel width, FW flags above */ + /* 32 bits */ + uint32_t c_band; /* Band; XXX we do not have a real band. */ + /* Force alignment to DWORD */ union { uint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS]; diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 2e98e67edc47..35cf7abdbf3b 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1818,6 +1818,8 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap *vap, return (NULL); if ((rxs->r_flags & IEEE80211_R_IEEE) == 0) return (NULL); + if ((rxs->r_flags & IEEE80211_R_BAND) == 0) + return (NULL); /* * If the rx status contains a valid ieee/freq, then @@ -1828,11 +1830,20 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap *vap, */ /* Determine a band */ - /* XXX should be done by the driver? */ - if (rxs->c_freq < 3000) { + switch (rxs->c_band) { + case IEEE80211_CHAN_2GHZ: flags = IEEE80211_CHAN_G; - } else { + break; + case IEEE80211_CHAN_5GHZ: flags = IEEE80211_CHAN_A; + break; + default: + if (rxs->c_freq < 3000) { + flags = IEEE80211_CHAN_G; + } else { + flags = IEEE80211_CHAN_A; + } + break; } /* Channel lookup */ From nobody Fri Oct 22 10:45:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9171C17F1B76; Fri, 22 Oct 2021 10:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbLbs0KHYz3JQk; Fri, 22 Oct 2021 10:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CBF56514F; Fri, 22 Oct 2021 10:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MAjiHB091334; Fri, 22 Oct 2021 10:45:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MAjiib091333; Fri, 22 Oct 2021 10:45:44 GMT (envelope-from git) Date: Fri, 22 Oct 2021 10:45:44 GMT Message-Id: <202110221045.19MAjiib091333@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: 3dc7a1897e0b - main - net80211: correct input_sta length checks and control frame handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3dc7a1897e0bb9e4b529c01cb3f88e1c387af5e8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc7a1897e0bb9e4b529c01cb3f88e1c387af5e8 commit 3dc7a1897e0bb9e4b529c01cb3f88e1c387af5e8 Author: Bjoern A. Zeeb AuthorDate: 2021-09-30 16:41:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-22 10:42:06 +0000 net80211: correct input_sta length checks and control frame handling Correct input_sta "assertion" checks. CTS/ACK CTRL frames are shorter then sizeof(struct ieee80211_frame_min) and were thus running into the is_rx_tooshort error case. Use ieee80211_anyhdrsize() to handle this better but make sure we do at least have the first 2 octets needed for that. While here move the safety checks before any code which may not obey them later, just for good style. The non-scanning check further down assumes a frame format also not matching control frames. For now skip the checks for control frames which allows us to deal with some of them at least now. Sponsored by: The FreeBSD Foundation Obtained from: 20210906 wireless v0.91 code drop MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D32238 --- sys/net80211/ieee80211_sta.c | 66 +++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index cd62266ab942..7ea6187332b1 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -552,6 +552,35 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, int is_hw_decrypted = 0; int has_decrypted = 0; + KASSERT(ni != NULL, ("%s: null node, mbuf %p", __func__, m)); + + /* Early init in case of early error case. */ + type = -1; + + /* + * Bit of a cheat here, we use a pointer for a 3-address + * frame format but don't reference fields past outside + * ieee80211_frame_min (or other shorter frames) w/o first + * validating the data is present. + */ + wh = mtod(m, struct ieee80211_frame *); + + if (m->m_pkthdr.len < 2 || m->m_pkthdr.len < ieee80211_anyhdrsize(wh)) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + ni->ni_macaddr, NULL, + "too short (1): len %u", m->m_pkthdr.len); + vap->iv_stats.is_rx_tooshort++; + goto err; + } + if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != + IEEE80211_FC0_VERSION_0) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", + wh->i_fc[0], wh->i_fc[1]); + vap->iv_stats.is_rx_badversion++; + goto err; + } + /* * Some devices do hardware decryption all the way through * to pretending the frame wasn't encrypted in the first place. @@ -569,7 +598,6 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, * with the M_AMPDU_MPDU flag and we can bypass most of * the normal processing. */ - wh = mtod(m, struct ieee80211_frame *); type = IEEE80211_FC0_TYPE_DATA; dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; subtype = IEEE80211_FC0_SUBTYPE_QOS; @@ -577,39 +605,19 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, goto resubmit_ampdu; } - KASSERT(ni != NULL, ("null node")); ni->ni_inact = ni->ni_inact_reload; - type = -1; /* undefined */ - - if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_min)) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, - "too short (1): len %u", m->m_pkthdr.len); - vap->iv_stats.is_rx_tooshort++; - goto out; - } - /* - * Bit of a cheat here, we use a pointer for a 3-address - * frame format but don't reference fields past outside - * ieee80211_frame_min w/o first validating the data is - * present. - */ - wh = mtod(m, struct ieee80211_frame *); - - if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != - IEEE80211_FC0_VERSION_0) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", - wh->i_fc[0], wh->i_fc[1]); - vap->iv_stats.is_rx_badversion++; - goto err; - } - dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; - if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { + /* + * Control frames are not folowing the header scheme of data and mgmt + * frames so we do not apply extra checks here. + * We probably should do checks on RA (+TA) where available for those + * too, but for now do not drop them. + */ + if (type != IEEE80211_FC0_TYPE_CTL && + (ic->ic_flags & IEEE80211_F_SCAN) == 0) { bssid = wh->i_addr2; if (!IEEE80211_ADDR_EQ(bssid, ni->ni_bssid)) { /* not interested in */ From nobody Fri Oct 22 10:50:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4C1E117F32FD; Fri, 22 Oct 2021 10:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbLj01frfz3KXc; Fri, 22 Oct 2021 10:50:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 194BF5244; Fri, 22 Oct 2021 10:50:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MAoCRO095479; Fri, 22 Oct 2021 10:50:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MAoC9V095475; Fri, 22 Oct 2021 10:50:12 GMT (envelope-from git) Date: Fri, 22 Oct 2021 10:50:12 GMT Message-Id: <202110221050.19MAoC9V095475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Grehan Subject: git: 5a3eb6207a35 - main - igc: correctly update RCTL when changing multicast filters. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a3eb6207a353c3a18da8abcf00a2d75276dd29e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=5a3eb6207a353c3a18da8abcf00a2d75276dd29e commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e Author: Peter Grehan AuthorDate: 2021-10-11 17:49:01 +0000 Commit: Peter Grehan CommitDate: 2021-10-22 11:16:12 +0000 igc: correctly update RCTL when changing multicast filters. Fix clearing of bits in RCTL for the non-bpf/non-allmulti case. Update RCTL after modifying the multicast filter registers as per the Linux driver. This fixes LACP on igc interfaces, where incoming LACP multicasti control packets were being dropped. Reviewed by: kbowling Obtained from: Rubicon Communications, LLC ("Netgate") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32574 --- sys/dev/igc/if_igc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 6d94a7c223c7..436493185d5c 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -1172,12 +1172,12 @@ igc_if_multi_set(if_ctx_t ctx) reg_rctl |= IGC_RCTL_MPE; reg_rctl &= ~IGC_RCTL_UPE; } else - reg_rctl = ~(IGC_RCTL_UPE | IGC_RCTL_MPE); - - IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); + reg_rctl &= ~(IGC_RCTL_UPE | IGC_RCTL_MPE); if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) igc_update_mc_addr_list(&adapter->hw, mta, mcnt); + + IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); } /********************************************************************* From nobody Fri Oct 22 11:11:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 626CB1804956; Fri, 22 Oct 2021 11:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbMB02DZgz3QJB; Fri, 22 Oct 2021 11:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D8FB57C9; Fri, 22 Oct 2021 11:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MBBqdU031765; Fri, 22 Oct 2021 11:11:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MBBqs9031764; Fri, 22 Oct 2021 11:11:52 GMT (envelope-from git) Date: Fri, 22 Oct 2021 11:11:52 GMT Message-Id: <202110221111.19MBBqs9031764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 4e4c84f8d101 - main - tcp: Add hystart-plus to cc_newreno and rack. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e4c84f8d101216ebf303f04ce9d4327c3328059 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4e4c84f8d101216ebf303f04ce9d4327c3328059 commit 4e4c84f8d101216ebf303f04ce9d4327c3328059 Author: Randall Stewart AuthorDate: 2021-10-22 11:10:28 +0000 Commit: Randall Stewart CommitDate: 2021-10-22 11:10:28 +0000 tcp: Add hystart-plus to cc_newreno and rack. TCP Hystart draft version -03: https://datatracker.ietf.org/doc/html/draft-ietf-tcpm-hystartplusplus Is a new version of hystart that allows one to carefully exit slow start if the RTT spikes too much. The newer version has a slower-slow-start so to speak that then kicks in for five round trips. To see if you exited too early, if not into congestion avoidance. This commit will add that feature to our newreno CC and add the needed bits in rack to be able to enable it. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32373 --- sys/netinet/cc/cc.h | 9 + sys/netinet/cc/cc_newreno.c | 335 ++++++++++++++++++++++++++++++++++---- sys/netinet/cc/cc_newreno.h | 22 ++- sys/netinet/tcp.h | 2 +- sys/netinet/tcp_log_buf.h | 3 +- sys/netinet/tcp_stacks/rack.c | 167 +++++++++++++++---- sys/netinet/tcp_stacks/tcp_rack.h | 3 + 7 files changed, 476 insertions(+), 65 deletions(-) diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h index be84a6841d15..e5fc328cc0c2 100644 --- a/sys/netinet/cc/cc.h +++ b/sys/netinet/cc/cc.h @@ -163,6 +163,15 @@ struct cc_algo { /* Called for an additional ECN processing apart from RFC3168. */ void (*ecnpkt_handler)(struct cc_var *ccv); + /* Called when a new "round" begins, if the transport is tracking rounds. */ + void (*newround)(struct cc_var *ccv, uint32_t round_cnt); + + /* + * Called when a RTT sample is made (fas = flight at send, if you dont have it + * send the cwnd in). + */ + void (*rttsample)(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas); + /* Called for {get|set}sockopt() on a TCP socket with TCP_CCALGOOPT. */ int (*ctl_output)(struct cc_var *, struct sockopt *, void *); diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 8f939ad70695..23d2b273f6aa 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -63,15 +63,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include #include +#include +#include #include #include #include +#include +#include #include #include #include @@ -85,6 +91,9 @@ static void newreno_after_idle(struct cc_var *ccv); static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); static void newreno_post_recovery(struct cc_var *ccv); static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf); +static void newreno_newround(struct cc_var *ccv, uint32_t round_cnt); +static void newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas); +static int newreno_cb_init(struct cc_var *ccv); VNET_DEFINE(uint32_t, newreno_beta) = 50; VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; @@ -99,23 +108,95 @@ struct cc_algo newreno_cc_algo = { .cong_signal = newreno_cong_signal, .post_recovery = newreno_post_recovery, .ctl_output = newreno_ctl_output, + .newround = newreno_newround, + .rttsample = newreno_rttsample, + .cb_init = newreno_cb_init, }; -static inline struct newreno * -newreno_malloc(struct cc_var *ccv) -{ - struct newreno *nreno; +static uint32_t hystart_lowcwnd = 16; +static uint32_t hystart_minrtt_thresh = 4000; +static uint32_t hystart_maxrtt_thresh = 16000; +static uint32_t hystart_n_rttsamples = 8; +static uint32_t hystart_css_growth_div = 4; +static uint32_t hystart_css_rounds = 5; +static uint32_t hystart_bblogs = 0; - nreno = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT); - if (nreno != NULL) { - /* NB: nreno is not zeroed, so initialise all fields. */ - nreno->beta = V_newreno_beta; - nreno->beta_ecn = V_newreno_beta_ecn; - nreno->newreno_flags = 0; - ccv->cc_data = nreno; +static void +newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod, uint32_t flex1) +{ + /* + * Types of logs (mod value) + * 1 - rtt_thresh in flex1, checking to see if RTT is to great. + * 2 - rtt is too great, rtt_thresh in flex1. + * 3 - CSS is active incr in flex1 + * 4 - A new round is beginning flex1 is round count + * 5 - A new RTT measurement flex1 is the new measurement. + * 6 - We enter CA ssthresh is also in flex1. + * 7 - Socket option to change hystart executed opt.val in flex1. + * 8 - Back out of CSS into SS, flex1 is the css_baseline_minrtt + */ + struct tcpcb *tp; + + if (hystart_bblogs == 0) + return; + tp = ccv->ccvc.tcp; + if (tp->t_logstate != TCP_LOG_STATE_OFF) { + union tcp_log_stackspecific log; + struct timeval tv; + + memset(&log, 0, sizeof(log)); + log.u_bbr.flex1 = flex1; + log.u_bbr.flex2 = nreno->css_current_round_minrtt; + log.u_bbr.flex3 = nreno->css_lastround_minrtt; + log.u_bbr.flex4 = nreno->css_rttsample_count; + log.u_bbr.flex5 = nreno->css_entered_at_round; + log.u_bbr.flex6 = nreno->css_baseline_minrtt; + /* We only need bottom 16 bits of flags */ + log.u_bbr.flex7 = nreno->newreno_flags & 0x0000ffff; + log.u_bbr.flex8 = mod; + log.u_bbr.epoch = nreno->css_current_round; + log.u_bbr.timeStamp = tcp_get_usecs(&tv); + log.u_bbr.lt_epoch = nreno->css_fas_at_css_entry; + log.u_bbr.pkts_out = nreno->css_last_fas; + log.u_bbr.delivered = nreno->css_lowrtt_fas; + TCP_LOG_EVENTP(tp, NULL, + &tp->t_inpcb->inp_socket->so_rcv, + &tp->t_inpcb->inp_socket->so_snd, + TCP_HYSTART, 0, + 0, &log, false, &tv); } +} + +static int +newreno_cb_init(struct cc_var *ccv) +{ + struct newreno *nreno; - return (nreno); + ccv->cc_data = NULL; + ccv->cc_data = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT); + if (ccv->cc_data == NULL) + return (ENOMEM); + nreno = (struct newreno *)ccv->cc_data; + /* NB: nreno is not zeroed, so initialise all fields. */ + nreno->beta = V_newreno_beta; + nreno->beta_ecn = V_newreno_beta_ecn; + /* + * We set the enabled flag so that if + * the socket option gets strobed and + * we have not hit a loss + */ + nreno->newreno_flags = CC_NEWRENO_HYSTART_ENABLED; + /* At init set both to infinity */ + nreno->css_lastround_minrtt = 0xffffffff; + nreno->css_current_round_minrtt = 0xffffffff; + nreno->css_current_round = 0; + nreno->css_baseline_minrtt = 0xffffffff; + nreno->css_rttsample_count = 0; + nreno->css_entered_at_round = 0; + nreno->css_fas_at_css_entry = 0; + nreno->css_lowrtt_fas = 0; + nreno->css_last_fas = 0; + return (0); } static void @@ -127,6 +208,9 @@ newreno_cb_destroy(struct cc_var *ccv) static void newreno_ack_received(struct cc_var *ccv, uint16_t type) { + struct newreno *nreno; + + nreno = (struct newreno *)ccv->cc_data; if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && (ccv->flags & CCF_CWND_LIMITED)) { u_int cw = CCV(ccv, snd_cwnd); @@ -160,6 +244,16 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) * avoid capping cwnd. */ if (cw > CCV(ccv, snd_ssthresh)) { + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) { + /* + * We have slipped into CA with + * CSS active. Deactivate all. + */ + /* Turn off the CSS flag */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + /* Disable use of CSS in the future except long idle */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; + } if (V_tcp_do_rfc3465) { if (ccv->flags & CCF_ABC_SENTAWND) ccv->flags &= ~CCF_ABC_SENTAWND; @@ -184,12 +278,48 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) abc_val = ccv->labc; else abc_val = V_tcp_abc_l_var; + if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) && + ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) == 0)) { + /* + * Hystart is allowed and still enabled and we are not yet + * in CSS. Lets check to see if we can make a decision on + * if we need to go into CSS. + */ + if ((nreno->css_rttsample_count >= hystart_n_rttsamples) && + (CCV(ccv, snd_cwnd) > + (hystart_lowcwnd * tcp_fixed_maxseg(ccv->ccvc.tcp)))) { + uint32_t rtt_thresh; + + /* Clamp (minrtt_thresh, lastround/8, maxrtt_thresh) */ + rtt_thresh = (nreno->css_lastround_minrtt >> 3); + if (rtt_thresh < hystart_minrtt_thresh) + rtt_thresh = hystart_minrtt_thresh; + if (rtt_thresh > hystart_maxrtt_thresh) + rtt_thresh = hystart_maxrtt_thresh; + newreno_log_hystart_event(ccv, nreno, 1, rtt_thresh); + if (nreno->css_current_round_minrtt >= (nreno->css_lastround_minrtt + rtt_thresh)) { + /* Enter CSS */ + nreno->newreno_flags |= CC_NEWRENO_HYSTART_IN_CSS; + nreno->css_fas_at_css_entry = nreno->css_lowrtt_fas; + nreno->css_baseline_minrtt = nreno->css_current_round_minrtt; + nreno->css_entered_at_round = nreno->css_current_round; + newreno_log_hystart_event(ccv, nreno, 2, rtt_thresh); + } + } + } if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) incr = min(ccv->bytes_this_ack, ccv->nsegs * abc_val * CCV(ccv, t_maxseg)); else incr = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg)); + + /* Only if Hystart is enabled will the flag get set */ + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) { + incr /= hystart_css_growth_div; + newreno_log_hystart_event(ccv, nreno, 3, incr); + } } /* ABC is on by default, so incr equals 0 frequently. */ if (incr > 0) @@ -201,8 +331,10 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) static void newreno_after_idle(struct cc_var *ccv) { + struct newreno *nreno; uint32_t rw; + nreno = (struct newreno *)ccv->cc_data; /* * If we've been idle for more than one retransmit timeout the old * congestion window is no longer current and we have to reduce it to @@ -226,6 +358,16 @@ newreno_after_idle(struct cc_var *ccv) CCV(ccv, snd_cwnd)-(CCV(ccv, snd_cwnd)>>2)); CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd)); + if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) == 0) { + if (CCV(ccv, snd_cwnd) <= (hystart_lowcwnd * tcp_fixed_maxseg(ccv->ccvc.tcp))) { + /* + * Re-enable hystart if our cwnd has fallen below + * the hystart lowcwnd point. + */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + nreno->newreno_flags |= CC_NEWRENO_HYSTART_ENABLED; + } + } } /* @@ -240,15 +382,9 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) cwin = CCV(ccv, snd_cwnd); mss = tcp_fixed_maxseg(ccv->ccvc.tcp); - /* - * Other TCP congestion controls use newreno_cong_signal(), but - * with their own private cc_data. Make sure the cc_data is used - * correctly. - */ - nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; - beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; - beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; - + nreno = (struct newreno *) ccv->cc_data; + beta = nreno->beta; + beta_ecn = nreno->beta_ecn; /* * Note that we only change the backoff for ECN if the * global sysctl V_cc_do_abe is set the stack itself @@ -257,7 +393,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) */ if ((type == CC_ECN) && (V_cc_do_abe || - ((nreno != NULL) && (nreno->newreno_flags & CC_NEWRENO_BETA_ECN)))) + ((nreno != NULL) && (nreno->newreno_flags & CC_NEWRENO_BETA_ECN_ENABLED)))) factor = beta_ecn; else factor = beta; @@ -271,6 +407,11 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) switch (type) { case CC_NDUPACK: + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { + /* Make sure the flags are all off we had a loss */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + } if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (IN_CONGRECOVERY(CCV(ccv, t_flags) && V_cc_do_abe && V_cc_abe_frlossreduce)) { @@ -284,6 +425,11 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) } break; case CC_ECN: + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { + /* Make sure the flags are all off we had a loss */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + } if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_cwnd) = cwin; @@ -346,17 +492,10 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo) return (ENOPROTOOPT); - nreno = ccv->cc_data; + nreno = (struct newreno *)ccv->cc_data; opt = buf; - switch (sopt->sopt_dir) { case SOPT_SET: - /* We cannot set without cc_data memory. */ - if (nreno == NULL) { - nreno = newreno_malloc(ccv); - if (nreno == NULL) - return (ENOMEM); - } switch (opt->name) { case CC_NEWRENO_BETA: nreno->beta = opt->val; @@ -365,6 +504,19 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) if ((!V_cc_do_abe) && ((nreno->newreno_flags & CC_NEWRENO_BETA_ECN) == 0)) return (EACCES); nreno->beta_ecn = opt->val; + nreno->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; + break; + case CC_NEWRENO_ENABLE_HYSTART: + /* Allow hystart on this connection */ + if (opt->val != 0) { + nreno->newreno_flags |= CC_NEWRENO_HYSTART_ALLOWED; + if (opt->val > 1) + nreno->newreno_flags |= CC_NEWRENO_HYSTART_CAN_SH_CWND; + if (opt->val > 2) + nreno->newreno_flags |= CC_NEWRENO_HYSTART_CONS_SSTH; + } else + nreno->newreno_flags &= ~(CC_NEWRENO_HYSTART_ALLOWED|CC_NEWRENO_HYSTART_CAN_SH_CWND|CC_NEWRENO_HYSTART_CONS_SSTH); + newreno_log_hystart_event(ccv, nreno, 7, opt->val); break; default: return (ENOPROTOOPT); @@ -380,6 +532,17 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) opt->val = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; break; + case CC_NEWRENO_ENABLE_HYSTART: + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) { + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CONS_SSTH) + opt->val = 3; + else if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CAN_SH_CWND) + opt->val = 2; + else + opt->val = 1; + } else + opt->val = 0; + break; default: return (ENOPROTOOPT); } @@ -411,6 +574,78 @@ newreno_beta_handler(SYSCTL_HANDLER_ARGS) return (error); } +static void +newreno_newround(struct cc_var *ccv, uint32_t round_cnt) +{ + struct newreno *nreno; + + nreno = (struct newreno *)ccv->cc_data; + /* We have entered a new round */ + nreno->css_lastround_minrtt = nreno->css_current_round_minrtt; + nreno->css_current_round_minrtt = 0xffffffff; + nreno->css_rttsample_count = 0; + nreno->css_current_round = round_cnt; + if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) && + ((round_cnt - nreno->css_entered_at_round) >= hystart_css_rounds)) { + /* Enter CA */ + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CAN_SH_CWND) { + /* + * We engage more than snd_ssthresh, engage + * the brakes!! Though we will stay in SS to + * creep back up again, so lets leave CSS active + * and give us hystart_css_rounds more rounds. + */ + if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CONS_SSTH) { + CCV(ccv, snd_ssthresh) = ((nreno->css_lowrtt_fas + nreno->css_fas_at_css_entry) / 2); + } else { + CCV(ccv, snd_ssthresh) = nreno->css_lowrtt_fas; + } + CCV(ccv, snd_cwnd) = nreno->css_fas_at_css_entry; + nreno->css_entered_at_round = round_cnt; + } else { + CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); + /* Turn off the CSS flag */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + /* Disable use of CSS in the future except long idle */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; + } + newreno_log_hystart_event(ccv, nreno, 6, CCV(ccv, snd_ssthresh)); + } + newreno_log_hystart_event(ccv, nreno, 4, round_cnt); +} + +static void +newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas) +{ + struct newreno *nreno; + + nreno = (struct newreno *)ccv->cc_data; + if (rxtcnt > 1) { + /* + * Only look at RTT's that are non-ambiguous. + */ + return; + } + nreno->css_rttsample_count++; + nreno->css_last_fas = fas; + if (nreno->css_current_round_minrtt > usec_rtt) { + nreno->css_current_round_minrtt = usec_rtt; + nreno->css_lowrtt_fas = nreno->css_last_fas; + } + if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) && + (nreno->css_rttsample_count >= hystart_n_rttsamples) && + (nreno->css_baseline_minrtt > nreno->css_current_round_minrtt)) { + /* + * We were in CSS and the RTT is now less, we + * entered CSS erroneously. + */ + nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; + newreno_log_hystart_event(ccv, nreno, 8, nreno->css_baseline_minrtt); + nreno->css_baseline_minrtt = 0xffffffff; + } + newreno_log_hystart_event(ccv, nreno, 5, usec_rtt); +} + SYSCTL_DECL(_net_inet_tcp_cc_newreno); SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, @@ -426,5 +661,45 @@ SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, &VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", "New Reno beta ecn, specified as number between 1 and 100"); +SYSCTL_NODE(_net_inet_tcp_cc_newreno, OID_AUTO, hystartplusplus, + CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, + "New Reno related HyStart++ settings"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, lowcwnd, + CTLFLAG_RW, + &hystart_lowcwnd, 16, + "The number of MSS in the CWND before HyStart++ is active"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, minrtt_thresh, + CTLFLAG_RW, + &hystart_minrtt_thresh, 4000, + "HyStarts++ minimum RTT thresh used in clamp (in microseconds)"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, maxrtt_thresh, + CTLFLAG_RW, + &hystart_maxrtt_thresh, 16000, + "HyStarts++ maximum RTT thresh used in clamp (in microseconds)"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, n_rttsamples, + CTLFLAG_RW, + &hystart_n_rttsamples, 8, + "The number of RTT samples that must be seen to consider HyStart++"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, css_growth_div, + CTLFLAG_RW, + &hystart_css_growth_div, 4, + "The divisor to the growth when in Hystart++ CSS"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, css_rounds, + CTLFLAG_RW, + &hystart_css_rounds, 5, + "The number of rounds HyStart++ lasts in CSS before falling to CA"); + +SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, bblogs, + CTLFLAG_RW, + &hystart_bblogs, 0, + "Do we enable HyStart++ Black Box logs to be generated if BB logging is on"); + + DECLARE_CC_MODULE(newreno, &newreno_cc_algo); MODULE_VERSION(newreno, 1); diff --git a/sys/netinet/cc/cc_newreno.h b/sys/netinet/cc/cc_newreno.h index 16cf1757e830..42c41c7db287 100644 --- a/sys/netinet/cc/cc_newreno.h +++ b/sys/netinet/cc/cc_newreno.h @@ -35,6 +35,15 @@ struct newreno { uint32_t beta; uint32_t beta_ecn; uint32_t newreno_flags; + uint32_t css_baseline_minrtt; + uint32_t css_current_round_minrtt; + uint32_t css_lastround_minrtt; + uint32_t css_rttsample_count; + uint32_t css_entered_at_round; + uint32_t css_current_round; + uint32_t css_fas_at_css_entry; + uint32_t css_lowrtt_fas; + uint32_t css_last_fas; }; struct cc_newreno_opts { @@ -42,6 +51,15 @@ struct cc_newreno_opts { uint32_t val; }; -#define CC_NEWRENO_BETA 1 /* Beta for normal DUP-ACK/Sack recovery */ -#define CC_NEWRENO_BETA_ECN 2 /* ECN Beta for Abe */ +#define CC_NEWRENO_BETA 1 /* Beta for normal DUP-ACK/Sack recovery */ +#define CC_NEWRENO_BETA_ECN 2 /* ECN Beta for Abe */ +#define CC_NEWRENO_ENABLE_HYSTART 3 /* Enable hystart */ + +/* Flags values */ +#define CC_NEWRENO_HYSTART_ALLOWED 0x0001 /* Does the tcp connection allow hystart? */ +#define CC_NEWRENO_HYSTART_ENABLED 0x0002 /* We can do hystart, a loss removes this flag */ +#define CC_NEWRENO_HYSTART_IN_CSS 0x0004 /* If we enter hystart CSS this flag is set */ +#define CC_NEWRENO_HYSTART_CAN_SH_CWND 0x0008 /* Can hystart when going CSS -> CA slam the cwnd */ +#define CC_NEWRENO_HYSTART_CONS_SSTH 0x0010 /* Should hystart use the more conservative sstrhesh */ +#define CC_NEWRENO_BETA_ECN_ENABLED 0x0020 #endif /* _CC_NEWRENO_H */ diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 29c1e376c8de..e7c47e85bb7b 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -310,7 +310,7 @@ struct tcphdr { #define TCP_RACK_PACING_BETA_ECN 1139 /* Changing the beta for ecn with pacing */ #define TCP_RACK_TIMER_SLOP 1140 /* Set or get the timer slop used */ #define TCP_RACK_DSACK_OPT 1141 /* How do we setup rack timer DSACK options bit 1/2 */ - +#define TCP_RACK_ENABLE_HYSTART 1142 /* Do we allow hystart in the CC modules */ /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index 2203fd061213..820f345a758f 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -235,7 +235,8 @@ enum tcp_log_events { TCP_LOG_ACCOUNTING, /* Log of TCP Accounting data 62 */ TCP_LOG_FSB, /* FSB information 63 */ RACK_DSACK_HANDLING, /* Handling of DSACK in rack for reordering window 64 */ - TCP_LOG_END /* End (keep at end) 65 */ + TCP_HYSTART, /* TCP Hystart logging 65 */ + TCP_LOG_END /* End (keep at end) 66 */ }; enum tcp_log_states { diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 00f830caf217..059c7d26d81e 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -204,6 +204,7 @@ static int32_t rack_hw_rate_to_low = 0; /* 1200000; */ static int32_t rack_hw_up_only = 1; static int32_t rack_stats_gets_ms_rtt = 1; static int32_t rack_prr_addbackmax = 2; +static int32_t rack_do_hystart = 0; static int32_t rack_pkt_delay = 1000; static int32_t rack_send_a_lot_in_prr = 1; @@ -624,7 +625,7 @@ rack_set_cc_pacing(struct tcp_rack *rack) * Hack alert we need to set in our newreno_flags * so that Abe behavior is also applied. */ - ((struct newreno *)tp->ccv->cc_data)->newreno_flags = CC_NEWRENO_BETA_ECN; + ((struct newreno *)tp->ccv->cc_data)->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; opt.name = CC_NEWRENO_BETA_ECN; opt.val = rack->r_ctl.rc_saved_beta.beta_ecn; error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); @@ -835,6 +836,7 @@ rack_init_sysctls(void) struct sysctl_oid *rack_timers; struct sysctl_oid *rack_tlp; struct sysctl_oid *rack_misc; + struct sysctl_oid *rack_features; struct sysctl_oid *rack_measure; struct sysctl_oid *rack_probertt; struct sysctl_oid *rack_hw_pacing; @@ -1362,6 +1364,43 @@ rack_init_sysctls(void) OID_AUTO, "min_measure_tim", CTLFLAG_RW, &rack_min_measure_usec, 0, "What is the Minimum time time for a measurement if 0, this is off"); + /* Features */ + rack_features = SYSCTL_ADD_NODE(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_sysctl_root), + OID_AUTO, + "features", + CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "Feature controls"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "cmpack", CTLFLAG_RW, + &rack_use_cmp_acks, 1, + "Should RACK have LRO send compressed acks"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "fsb", CTLFLAG_RW, + &rack_use_fsb, 1, + "Should RACK use the fast send block?"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "rfo", CTLFLAG_RW, + &rack_use_rfo, 1, + "Should RACK use rack_fast_output()?"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "rsmrfo", CTLFLAG_RW, + &rack_use_rsm_rfo, 1, + "Should RACK use rack_fast_rsm_output()?"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "non_paced_lro_queue", CTLFLAG_RW, + &rack_enable_mqueue_for_nonpaced, 0, + "Should RACK use mbuf queuing for non-paced connections"); + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_features), + OID_AUTO, "hystartplusplus", CTLFLAG_RW, + &rack_do_hystart, 0, + "Should RACK enable HyStart++ on connections?"); /* Misc rack controls */ rack_misc = SYSCTL_ADD_NODE(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_sysctl_root), @@ -1376,7 +1415,6 @@ rack_init_sysctls(void) &rack_tcp_accounting, 0, "Should we turn on TCP accounting for all rack sessions?"); #endif - SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_misc), OID_AUTO, "rack_dsack_ctl", CTLFLAG_RW, @@ -1402,26 +1440,6 @@ rack_init_sysctls(void) OID_AUTO, "defprofile", CTLFLAG_RW, &rack_def_profile, 0, "Should RACK use a default profile (0=no, num == profile num)?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "cmpack", CTLFLAG_RW, - &rack_use_cmp_acks, 1, - "Should RACK have LRO send compressed acks"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "fsb", CTLFLAG_RW, - &rack_use_fsb, 1, - "Should RACK use the fast send block?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "rfo", CTLFLAG_RW, - &rack_use_rfo, 1, - "Should RACK use rack_fast_output()?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "rsmrfo", CTLFLAG_RW, - &rack_use_rsm_rfo, 1, - "Should RACK use rack_fast_rsm_output()?"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_misc), OID_AUTO, "shared_cwnd", CTLFLAG_RW, @@ -1432,11 +1450,6 @@ rack_init_sysctls(void) OID_AUTO, "limits_on_scwnd", CTLFLAG_RW, &rack_limits_scwnd, 1, "Should RACK place low end time limits on the shared cwnd feature"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "non_paced_lro_queue", CTLFLAG_RW, - &rack_enable_mqueue_for_nonpaced, 0, - "Should RACK use mbuf queuing for non-paced connections"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_misc), OID_AUTO, "iMac_dack", CTLFLAG_RW, @@ -6139,6 +6152,7 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, nrsm->r_dupack = rsm->r_dupack; nrsm->r_no_rtt_allowed = rsm->r_no_rtt_allowed; nrsm->r_rtr_bytes = 0; + nrsm->r_fas = rsm->r_fas; rsm->r_end = nrsm->r_start; nrsm->r_just_ret = rsm->r_just_ret; for (idx = 0; idx < nrsm->r_rtr_cnt; idx++) { @@ -7260,6 +7274,12 @@ rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, } idx = rsm->r_rtr_cnt - 1; rsm->r_tim_lastsent[idx] = ts; + /* + * Here we don't add in the len of send, since its already + * in snduna <->snd_max. + */ + rsm->r_fas = ctf_flight_size(rack->rc_tp, + rack->r_ctl.rc_sacked); stripped_flags = rsm->r_flags & ~(RACK_SENT_SP|RACK_SENT_FP); if (rsm->r_flags & RACK_ACKED) { /* Problably MTU discovery messing with us */ @@ -7479,6 +7499,13 @@ again: */ rsm->m = s_mb; rsm->soff = s_moff; + /* + * Here we do add in the len of send, since its not yet + * reflected in in snduna <->snd_max + */ + rsm->r_fas = (ctf_flight_size(rack->rc_tp, + rack->r_ctl.rc_sacked) + + (rsm->r_end - rsm->r_start)); /* rsm->m will be NULL if RACK_HAS_SYN or RACK_HAS_FIN is set */ if (rsm->m) { if (rsm->m->m_len <= rsm->soff) { @@ -7927,6 +7954,7 @@ static int rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, struct tcpopt *to, uint32_t cts, int32_t ack_type, tcp_seq th_ack) { + uint32_t us_rtt; int32_t i, all; uint32_t t, len_acked; @@ -7951,7 +7979,6 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, all = 0; } if (rsm->r_rtr_cnt == 1) { - uint32_t us_rtt; t = cts - (uint32_t)rsm->r_tim_lastsent[(rsm->r_rtr_cnt - 1)]; if ((int)t <= 0) @@ -7971,6 +7998,10 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, us_rtt = tcp_get_usecs(NULL) - (uint32_t)rsm->r_tim_lastsent[(rsm->r_rtr_cnt-1)]; if (us_rtt == 0) us_rtt = 1; + if (CC_ALGO(tp)->rttsample != NULL) { + /* Kick the RTT to the CC */ + CC_ALGO(tp)->rttsample(tp->ccv, us_rtt, 1, rsm->r_fas); + } rack_apply_updated_usrtt(rack, us_rtt, tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time)); if (ack_type == SACKED) { rack_log_rtt_sample_calc(rack, t, (uint32_t)rsm->r_tim_lastsent[(rsm->r_rtr_cnt - 1)], cts, 1); @@ -8057,12 +8088,29 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, t = cts - (uint32_t)rsm->r_tim_lastsent[i]; if ((int)t <= 0) t = 1; + if (CC_ALGO(tp)->rttsample != NULL) { + /* + * Kick the RTT to the CC, here + * we lie a bit in that we know the + * retransmission is correct even though + * we retransmitted. This is because + * we match the timestamps. + */ + if (TSTMP_GT(tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time), rsm->r_tim_lastsent[i])) + us_rtt = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - (uint32_t)rsm->r_tim_lastsent[i]; + else + us_rtt = tcp_get_usecs(NULL) - (uint32_t)rsm->r_tim_lastsent[i]; + CC_ALGO(tp)->rttsample(tp->ccv, us_rtt, 1, rsm->r_fas); + } if ((i + 1) < rsm->r_rtr_cnt) { /* * The peer ack'd from our previous * transmission. We have a spurious * retransmission and thus we dont * want to update our rack_rtt. + * + * Hmm should there be a CC revert here? + * */ return (0); } @@ -12548,10 +12596,11 @@ rack_init(struct tcpcb *tp) rack->r_ctl.rc_saved_beta.beta = V_newreno_beta_ecn; rack->r_ctl.rc_saved_beta.beta_ecn = V_newreno_beta_ecn; /* We want abe like behavior as well */ - rack->r_ctl.rc_saved_beta.newreno_flags = CC_NEWRENO_BETA_ECN; + rack->r_ctl.rc_saved_beta.newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; rack->r_ctl.rc_reorder_fade = rack_reorder_fade; rack->rc_allow_data_af_clo = rack_ignore_data_after_close; rack->r_ctl.rc_tlp_threshold = rack_tlp_thresh; + rack->r_ctl.roundends = tp->snd_max; if (use_rack_rr) rack->use_rack_rr = 1; if (V_tcp_delack_enabled) @@ -12730,6 +12779,17 @@ rack_init(struct tcpcb *tp) */ rack_convert_rtts(tp); tp->t_rttlow = TICKS_2_USEC(tp->t_rttlow); + if (rack_do_hystart) { + struct sockopt sopt; + struct cc_newreno_opts opt; + + sopt.sopt_valsize = sizeof(struct cc_newreno_opts); + sopt.sopt_dir = SOPT_SET; + opt.name = CC_NEWRENO_ENABLE_HYSTART; + opt.val = rack_do_hystart; + if (CC_ALGO(tp)->ctl_output != NULL) + (void)CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + } if (rack_def_profile) rack_set_profile(rack, rack_def_profile); /* Cancel the GP measurement in progress */ @@ -13576,6 +13636,13 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb (((ae->ack - high_seq) + segsiz - 1) / segsiz)); #endif high_seq = ae->ack; + if (SEQ_GEQ(high_seq, rack->r_ctl.roundends)) { + rack->r_ctl.current_round++; + rack->r_ctl.roundends = tp->snd_max; + if (CC_ALGO(tp)->newround != NULL) { + CC_ALGO(tp)->newround(tp->ccv, rack->r_ctl.current_round); + } + } /* Setup our act_rcv_time */ if ((ae->flags & TSTMP_LRO) || (ae->flags & TSTMP_HDWR)) { ts.tv_sec = ae->timestamp / 1000000000; @@ -14464,6 +14531,14 @@ do_output_now: rack_start_hpts_timer(rack, tp, cts, 0, 0, 0); rack_free_trim(rack); } + /* Update any rounds needed */ + if (SEQ_GEQ(tp->snd_una, rack->r_ctl.roundends)) { + rack->r_ctl.current_round++; + rack->r_ctl.roundends = tp->snd_max; + if (CC_ALGO(tp)->newround != NULL) { + CC_ALGO(tp)->newround(tp->ccv, rack->r_ctl.current_round); + } + } if ((nxt_pkt == 0) && ((rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK) == 0) && (SEQ_GT(tp->snd_max, tp->snd_una) || @@ -16936,7 +17011,6 @@ again: goto just_return_nolock; } rsm = TAILQ_FIRST(&rack->r_ctl.rc_tmap); - KASSERT(rsm != NULL, ("rsm is NULL rack:%p r_must_retran set", rack)); if (rsm == NULL) { /* TSNH */ rack->r_must_retran = 0; @@ -19565,7 +19639,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, * rack pcb storage. */ rack->r_ctl.rc_saved_beta.beta_ecn = optval; - rack->r_ctl.rc_saved_beta.newreno_flags = CC_NEWRENO_BETA_ECN; + rack->r_ctl.rc_saved_beta.newreno_flags = CC_NEWRENO_BETA_ECN_ENABLED; } break; case TCP_DEFER_OPTIONS: @@ -19998,6 +20072,21 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, RACK_OPTS_INC(tcp_rack_early_seg); rack->r_ctl.rc_early_recovery_segs = optval; break; + case TCP_RACK_ENABLE_HYSTART: + { + struct sockopt sopt; + struct cc_newreno_opts opt; + + sopt.sopt_valsize = sizeof(struct cc_newreno_opts); + sopt.sopt_dir = SOPT_SET; + opt.name = CC_NEWRENO_ENABLE_HYSTART; + opt.val = optval; + if (CC_ALGO(tp)->ctl_output != NULL) + error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + else + error = EINVAL; + } + break; case TCP_RACK_REORD_THRESH: /* RACK reorder threshold (shift amount) */ RACK_OPTS_INC(tcp_rack_reord_thresh); @@ -20210,6 +20299,7 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, case TCP_RACK_PACING_BETA: /* URL:pacing_beta */ case TCP_RACK_PACING_BETA_ECN: /* URL:pacing_beta_ecn */ case TCP_RACK_TIMER_SLOP: /* URL:timer_slop */ + case TCP_RACK_ENABLE_HYSTART: /* URL:hystart */ break; default: /* Filter off all unknown options to the base stack */ @@ -20394,6 +20484,21 @@ rack_get_sockopt(struct socket *so, struct sockopt *sopt, optval |= 2; } break; + case TCP_RACK_ENABLE_HYSTART: + { + struct sockopt sopt; + struct cc_newreno_opts opt; + + sopt.sopt_valsize = sizeof(struct cc_newreno_opts); + sopt.sopt_dir = SOPT_GET; + opt.name = CC_NEWRENO_ENABLE_HYSTART; + if (CC_ALGO(tp)->ctl_output != NULL) + error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + else + error = EINVAL; + optval = opt.val; + } + break; case TCP_FAST_RSM_HACK: optval = rack->fast_rsm_hack; break; diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 71c7c692ef52..0ada2116dc6f 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -73,6 +73,7 @@ struct rack_sendmap { uint64_t r_tim_lastsent[RACK_NUM_OF_RETRANS]; uint64_t r_ack_arrival; /* This is the time of ack-arrival (if SACK'd) */ RB_ENTRY(rack_sendmap) r_next; /* RB Tree next */ + uint32_t r_fas; /* Flight at send */ }; struct deferred_opt_list { @@ -465,6 +466,8 @@ struct rack_control { uint32_t rc_loss_at_start; /* At measurement window where was our lost value */ uint32_t dsack_round_end; /* In a round of seeing a DSACK */ + uint32_t current_round; /* Starting at zero */ + uint32_t roundends; /* acked value above which round ends */ uint32_t num_dsack; /* Count of dsack's seen (1 per window)*/ uint32_t forced_ack_ts; uint32_t rc_lower_rtt_us_cts; /* Time our GP rtt was last lowered */ From nobody Fri Oct 22 12:32:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8C5C817F7EA4; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzD3RkTz4ZSj; Fri, 22 Oct 2021 12:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 566976CC6; Fri, 22 Oct 2021 12:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWeEm038450; Fri, 22 Oct 2021 12:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWeaT038449; Fri, 22 Oct 2021 12:32:40 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:40 GMT Message-Id: <202110221232.19MCWeaT038449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e089cda88b78 - stable/13 - pfctl: Remove unused variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e089cda88b7885e23043b8a46f9c9add6a285443 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e089cda88b7885e23043b8a46f9c9add6a285443 commit e089cda88b7885e23043b8a46f9c9add6a285443 Author: Kristof Provost AuthorDate: 2021-09-30 15:25:45 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:32:24 +0000 pfctl: Remove unused variable MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 90dedf0fef71d3e3081015525665bf335f9c7ee3) --- sbin/pfctl/parse.y | 1 - sbin/pfctl/pfctl_parser.h | 1 - 2 files changed, 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index b7b934e6c2ef..7457e4346895 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -854,7 +854,6 @@ pfa_anchor : '{' /* steping into a brace anchor */ pf->asd++; pf->bn++; - pf->brace = 1; /* create a holding ruleset in the root */ snprintf(ta, PF_ANCHOR_NAME_SIZE, "_%d", pf->bn); diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 484830c61791..4e144b97567b 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -82,7 +82,6 @@ struct pfctl { int loadopt; int asd; /* anchor stack depth */ int bn; /* brace number */ - int brace; int tdirty; /* kernel dirty */ #define PFCTL_ANCHOR_STACK_DEPTH 64 struct pfctl_anchor *astack[PFCTL_ANCHOR_STACK_DEPTH]; From nobody Fri Oct 22 12:32:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6391617F7E31; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzF5D0Fz4Z7J; Fri, 22 Oct 2021 12:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4746B4E; Fri, 22 Oct 2021 12:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWfTq038483; Fri, 22 Oct 2021 12:32:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWfvn038482; Fri, 22 Oct 2021 12:32:41 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:41 GMT Message-Id: <202110221232.19MCWfvn038482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 00ff2b29a9ba - stable/13 - pf: remove unused field from pf_kanchor List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00ff2b29a9ba563b6b2f324c0c9378ea286e17df Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=00ff2b29a9ba563b6b2f324c0c9378ea286e17df commit 00ff2b29a9ba563b6b2f324c0c9378ea286e17df Author: Kristof Provost AuthorDate: 2021-10-04 08:58:27 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:08 +0000 pf: remove unused field from pf_kanchor The 'match' field is only used in the userspace version of the struct (pf_anchor). MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 76c2e71c4c65a85279505005716aa43101c47bf7) --- sys/net/pfvar.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e142976c588e..9fb231e95a2c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1044,7 +1044,6 @@ struct pf_kanchor { char path[MAXPATHLEN]; struct pf_kruleset ruleset; int refcnt; /* anchor rules */ - int match; /* XXX: used for pfctl black magic */ }; RB_PROTOTYPE(pf_kanchor_global, pf_kanchor, entry_global, pf_anchor_compare); RB_PROTOTYPE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); From nobody Fri Oct 22 12:32:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 683F01800020; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzG6RPMz4ZZQ; Fri, 22 Oct 2021 12:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93A786561; Fri, 22 Oct 2021 12:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWgPu038516; Fri, 22 Oct 2021 12:32:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWgBM038515; Fri, 22 Oct 2021 12:32:42 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:42 GMT Message-Id: <202110221232.19MCWgBM038515@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 56dc7a08bff8 - stable/13 - pf: do not copy anchor_wildcard / anchor_relative from userspace List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 56dc7a08bff8e0d8edde89ab9fecc3c6a7e375e4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=56dc7a08bff8e0d8edde89ab9fecc3c6a7e375e4 commit 56dc7a08bff8e0d8edde89ab9fecc3c6a7e375e4 Author: Kristof Provost AuthorDate: 2021-10-08 13:13:21 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:18 +0000 pf: do not copy anchor_wildcard / anchor_relative from userspace We overwrite these fields again in pf_kanchor_setup() anyway. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 1c680e620bf7e53d043d10b23bdfc980e45e6455) --- sys/netpfil/pf/pf_ioctl.c | 2 -- sys/netpfil/pf/pf_nv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 7a8d0cdda836..7b68110b0f99 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1823,8 +1823,6 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->return_ttl = rule->return_ttl; krule->tos = rule->tos; krule->set_tos = rule->set_tos; - krule->anchor_relative = rule->anchor_relative; - krule->anchor_wildcard = rule->anchor_wildcard; krule->flush = rule->flush; krule->prio = rule->prio; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 5eda6b3917f4..d53c6fe4b84e 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -603,8 +603,6 @@ pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule *rule) PFNV_CHK(pf_nvuint8(nvl, "return_ttl", &rule->return_ttl)); PFNV_CHK(pf_nvuint8(nvl, "tos", &rule->tos)); PFNV_CHK(pf_nvuint8(nvl, "set_tos", &rule->set_tos)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_relative", &rule->anchor_relative)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_wildcard", &rule->anchor_wildcard)); PFNV_CHK(pf_nvuint8(nvl, "flush", &rule->flush)); PFNV_CHK(pf_nvuint8(nvl, "prio", &rule->prio)); From nobody Fri Oct 22 12:32:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4866717F7EB8; Fri, 22 Oct 2021 12:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzJ0N5Wz4ZV4; Fri, 22 Oct 2021 12:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B83EA6D08; Fri, 22 Oct 2021 12:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWh5t038540; Fri, 22 Oct 2021 12:32:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWh0V038539; Fri, 22 Oct 2021 12:32:43 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:43 GMT Message-Id: <202110221232.19MCWh0V038539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 35237559a6a0 - stable/13 - pfctl: delay label macro expansion until after rule optimisation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 35237559a6a0ad0b16abcc6809c2e145931c5e9a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=35237559a6a0ad0b16abcc6809c2e145931c5e9a commit 35237559a6a0ad0b16abcc6809c2e145931c5e9a Author: Kristof Provost AuthorDate: 2021-10-13 14:06:47 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:25 +0000 pfctl: delay label macro expansion until after rule optimisation We used to expand the $nr macro in labels into the rule number prior to the optimisation step. This would occasionally produce incorrect rule numbers in the labels. Delay all macro expansion until after the optimisation step to ensure that we expand the correct values. MFC after: 1 week Reported by: Özkan KIRIK Differential Revision: https://reviews.freebsd.org/D32488 (cherry picked from commit 09c7f2386973f8c36978895a7600320916bc3d07) --- sbin/pfctl/parse.y | 85 +++++++++++++++++++++++------------------------------- sbin/pfctl/pfctl.c | 6 ++++ sbin/pfctl/pfctl.h | 2 ++ 3 files changed, 44 insertions(+), 49 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 7457e4346895..c8a310688ca7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -330,14 +330,12 @@ int process_tabledef(char *, struct table_opts *); void expand_label_str(char *, size_t, const char *, const char *); void expand_label_if(const char *, char *, size_t, const char *); void expand_label_addr(const char *, char *, size_t, u_int8_t, - struct node_host *); + struct pf_rule_addr *); void expand_label_port(const char *, char *, size_t, - struct node_port *); + struct pf_rule_addr *); void expand_label_proto(const char *, char *, size_t, u_int8_t); -void expand_label_nr(const char *, char *, size_t); -void expand_label(char *, size_t, const char *, u_int8_t, - struct node_host *, struct node_port *, struct node_host *, - struct node_port *, u_int8_t); +void expand_label_nr(const char *, char *, size_t, + struct pfctl_rule *); void expand_rule(struct pfctl_rule *, struct node_if *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, @@ -4983,17 +4981,17 @@ expand_label_if(const char *name, char *label, size_t len, const char *ifname) void expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, - struct node_host *h) + struct pf_rule_addr *addr) { char tmp[64], tmp_not[66]; if (strstr(label, name) != NULL) { - switch (h->addr.type) { + switch (addr->addr.type) { case PF_ADDR_DYNIFTL: - snprintf(tmp, sizeof(tmp), "(%s)", h->addr.v.ifname); + snprintf(tmp, sizeof(tmp), "(%s)", addr->addr.v.ifname); break; case PF_ADDR_TABLE: - snprintf(tmp, sizeof(tmp), "<%s>", h->addr.v.tblname); + snprintf(tmp, sizeof(tmp), "<%s>", addr->addr.v.tblname); break; case PF_ADDR_NOROUTE: snprintf(tmp, sizeof(tmp), "no-route"); @@ -5002,18 +5000,18 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, snprintf(tmp, sizeof(tmp), "urpf-failed"); break; case PF_ADDR_ADDRMASK: - if (!af || (PF_AZERO(&h->addr.v.a.addr, af) && - PF_AZERO(&h->addr.v.a.mask, af))) + if (!af || (PF_AZERO(&addr->addr.v.a.addr, af) && + PF_AZERO(&addr->addr.v.a.mask, af))) snprintf(tmp, sizeof(tmp), "any"); else { char a[48]; int bits; - if (inet_ntop(af, &h->addr.v.a.addr, a, + if (inet_ntop(af, &addr->addr.v.a.addr, a, sizeof(a)) == NULL) snprintf(tmp, sizeof(tmp), "?"); else { - bits = unmask(&h->addr.v.a.mask, af); + bits = unmask(&addr->addr.v.a.mask, af); if ((af == AF_INET && bits < 32) || (af == AF_INET6 && bits < 128)) snprintf(tmp, sizeof(tmp), @@ -5029,7 +5027,7 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, break; } - if (h->not) { + if (addr->neg) { snprintf(tmp_not, sizeof(tmp_not), "! %s", tmp); expand_label_str(label, len, name, tmp_not); } else @@ -5039,30 +5037,30 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, void expand_label_port(const char *name, char *label, size_t len, - struct node_port *port) + struct pf_rule_addr *addr) { char a1[6], a2[6], op[13] = ""; if (strstr(label, name) != NULL) { - snprintf(a1, sizeof(a1), "%u", ntohs(port->port[0])); - snprintf(a2, sizeof(a2), "%u", ntohs(port->port[1])); - if (!port->op) + snprintf(a1, sizeof(a1), "%u", ntohs(addr->port[0])); + snprintf(a2, sizeof(a2), "%u", ntohs(addr->port[1])); + if (!addr->port_op) ; - else if (port->op == PF_OP_IRG) + else if (addr->port_op == PF_OP_IRG) snprintf(op, sizeof(op), "%s><%s", a1, a2); - else if (port->op == PF_OP_XRG) + else if (addr->port_op == PF_OP_XRG) snprintf(op, sizeof(op), "%s<>%s", a1, a2); - else if (port->op == PF_OP_EQ) + else if (addr->port_op == PF_OP_EQ) snprintf(op, sizeof(op), "%s", a1); - else if (port->op == PF_OP_NE) + else if (addr->port_op == PF_OP_NE) snprintf(op, sizeof(op), "!=%s", a1); - else if (port->op == PF_OP_LT) + else if (addr->port_op == PF_OP_LT) snprintf(op, sizeof(op), "<%s", a1); - else if (port->op == PF_OP_LE) + else if (addr->port_op == PF_OP_LE) snprintf(op, sizeof(op), "<=%s", a1); - else if (port->op == PF_OP_GT) + else if (addr->port_op == PF_OP_GT) snprintf(op, sizeof(op), ">%s", a1); - else if (port->op == PF_OP_GE) + else if (addr->port_op == PF_OP_GE) snprintf(op, sizeof(op), ">=%s", a1); expand_label_str(label, len, name, op); } @@ -5086,29 +5084,27 @@ expand_label_proto(const char *name, char *label, size_t len, u_int8_t proto) } void -expand_label_nr(const char *name, char *label, size_t len) +expand_label_nr(const char *name, char *label, size_t len, + struct pfctl_rule *r) { char n[11]; if (strstr(label, name) != NULL) { - snprintf(n, sizeof(n), "%u", pf->anchor->match); + snprintf(n, sizeof(n), "%u", r->nr); expand_label_str(label, len, name, n); } } void -expand_label(char *label, size_t len, const char *ifname, sa_family_t af, - struct node_host *src_host, struct node_port *src_port, - struct node_host *dst_host, struct node_port *dst_port, - u_int8_t proto) +expand_label(char *label, size_t len, struct pfctl_rule *r) { - expand_label_if("$if", label, len, ifname); - expand_label_addr("$srcaddr", label, len, af, src_host); - expand_label_addr("$dstaddr", label, len, af, dst_host); - expand_label_port("$srcport", label, len, src_port); - expand_label_port("$dstport", label, len, dst_port); - expand_label_proto("$proto", label, len, proto); - expand_label_nr("$nr", label, len); + expand_label_if("$if", label, len, r->ifname); + expand_label_addr("$srcaddr", label, len, r->af, &r->src); + expand_label_addr("$dstaddr", label, len, r->af, &r->dst); + expand_label_port("$srcport", label, len, &r->src); + expand_label_port("$dstport", label, len, &r->dst); + expand_label_proto("$proto", label, len, r->proto); + expand_label_nr("$nr", label, len, r); } int @@ -5442,15 +5438,6 @@ expand_rule(struct pfctl_rule *r, if (strlcpy(r->match_tagname, match_tagname, sizeof(r->match_tagname)) >= sizeof(r->match_tagname)) errx(1, "expand_rule: strlcpy"); - for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) - expand_label(r->label[i], PF_RULE_LABEL_SIZE, - r->ifname, r->af, src_host, src_port, dst_host, - dst_port, proto->proto); - expand_label(r->tagname, PF_TAG_NAME_SIZE, r->ifname, r->af, - src_host, src_port, dst_host, dst_port, proto->proto); - expand_label(r->match_tagname, PF_TAG_NAME_SIZE, r->ifname, - r->af, src_host, src_port, dst_host, dst_port, - proto->proto); error += check_netmask(src_host, r->af); error += check_netmask(dst_host, r->af); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index d7bde0012e9b..a0eec1b09289 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1528,6 +1528,12 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pfctl_ruleset *rs, while ((r = TAILQ_FIRST(rs->rules[rs_num].active.ptr)) != NULL) { TAILQ_REMOVE(rs->rules[rs_num].active.ptr, r, entries); + + for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) + expand_label(r->label[i], PF_RULE_LABEL_SIZE, r); + expand_label(r->tagname, PF_TAG_NAME_SIZE, r); + expand_label(r->match_tagname, PF_TAG_NAME_SIZE, r); + if ((error = pfctl_load_rule(pf, path, r, depth))) goto error; if (r->anchor) { diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 80ef184fa90f..606eb729cd44 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -138,6 +138,8 @@ void pf_remove_if_empty_ruleset(struct pfctl_ruleset *); struct pfctl_ruleset *pf_find_ruleset(const char *); struct pfctl_ruleset *pf_find_or_create_ruleset(const char *); +void expand_label(char *, size_t, struct pfctl_rule *); + const char *pfctl_proto2name(int); #endif /* _PFCTL_H_ */ From nobody Fri Oct 22 12:32:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D967218000BA; Fri, 22 Oct 2021 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzK4F2Zz4ZK2; Fri, 22 Oct 2021 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E22E76BA5; Fri, 22 Oct 2021 12:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWitE038564; Fri, 22 Oct 2021 12:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWij1038563; Fri, 22 Oct 2021 12:32:44 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:44 GMT Message-Id: <202110221232.19MCWij1038563@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9365113e89a5 - stable/13 - pf tests: ensure that $nr expansion is correct List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9365113e89a52ce025d4097a5986e2228234f5ca Auto-Submitted: auto-generated X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9365113e89a52ce025d4097a5986e2228234f5ca commit 9365113e89a52ce025d4097a5986e2228234f5ca Author: Kristof Provost AuthorDate: 2021-10-03 16:07:04 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:33 +0000 pf tests: ensure that $nr expansion is correct Test the $nr expansion in labels is correct, even if the optimiser reduces the rule count. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32489 (cherry picked from commit 914ec9c78dcd5d8f77552fb93d3bc15efe9c0f40) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/macro.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 2f9ce73f381b..246c267e7d2b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -14,6 +14,7 @@ ATF_TESTS_SH+= altq \ get_state \ icmp \ killstate \ + macro \ map_e \ names \ nat \ diff --git a/tests/sys/netpfil/pf/macro.sh b/tests/sys/netpfil/pf/macro.sh new file mode 100644 index 000000000000..442677c9f946 --- /dev/null +++ b/tests/sys/netpfil/pf/macro.sh @@ -0,0 +1,40 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "nr" "cleanup" +nr_head() +{ + atf_set descr 'Test $nr expansion' + atf_set require.user root +} + +nr_body() +{ + # Ensure that when the optimiser collapses rules the macro expansion + # has the correct rule number + pft_init + + vnet_mkjail alcatraz + jexec alcatraz ifconfig lo0 inet 127.0.0.1/8 + jexec alcatraz ifconfig lo0 inet 127.0.0.2/32 alias + + pft_set_rules alcatraz \ + "pass quick on lo from lo:network to lo:network" \ + "block quick all label \"ruleNo:\$nr\"" + + no=$(jexec alcatraz pfctl -sr -vv | awk '/ruleNo/ { gsub("@", "", $1); print $1; }') + ruleno=$(jexec alcatraz pfctl -sr -vv | awk '/ruleNo/ { gsub(/"ruleNo:/, "", $7); gsub(/"/, "", $7); print $7; }') + if [ "${no}" -ne "${ruleno}" ]; + then + atf_fail "Expected ruleNo $no != $ruleno" + fi +} + +nr_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "nr" +} From nobody Fri Oct 22 12:32:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CBCF117F7EE7; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzN0V8mz4ZgS; Fri, 22 Oct 2021 12:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D22536B4F; Fri, 22 Oct 2021 12:32:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWl5K038758; Fri, 22 Oct 2021 12:32:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWlx2038757; Fri, 22 Oct 2021 12:32:47 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:47 GMT Message-Id: <202110221232.19MCWlx2038757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 006fadf8347b - stable/12 - pf: do not copy anchor_wildcard / anchor_relative from userspace List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 006fadf8347bd640b8e4c07288bb744350c56609 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=006fadf8347bd640b8e4c07288bb744350c56609 commit 006fadf8347bd640b8e4c07288bb744350c56609 Author: Kristof Provost AuthorDate: 2021-10-08 13:13:21 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:18 +0000 pf: do not copy anchor_wildcard / anchor_relative from userspace We overwrite these fields again in pf_kanchor_setup() anyway. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 1c680e620bf7e53d043d10b23bdfc980e45e6455) --- sys/netpfil/pf/pf_ioctl.c | 2 -- sys/netpfil/pf/pf_nv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index bbafaed0c1b0..ff7e4d4235a6 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1792,8 +1792,6 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->return_ttl = rule->return_ttl; krule->tos = rule->tos; krule->set_tos = rule->set_tos; - krule->anchor_relative = rule->anchor_relative; - krule->anchor_wildcard = rule->anchor_wildcard; krule->flush = rule->flush; krule->prio = rule->prio; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 5eda6b3917f4..d53c6fe4b84e 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -603,8 +603,6 @@ pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule *rule) PFNV_CHK(pf_nvuint8(nvl, "return_ttl", &rule->return_ttl)); PFNV_CHK(pf_nvuint8(nvl, "tos", &rule->tos)); PFNV_CHK(pf_nvuint8(nvl, "set_tos", &rule->set_tos)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_relative", &rule->anchor_relative)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_wildcard", &rule->anchor_wildcard)); PFNV_CHK(pf_nvuint8(nvl, "flush", &rule->flush)); PFNV_CHK(pf_nvuint8(nvl, "prio", &rule->prio)); From nobody Fri Oct 22 12:32:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D58C91800209; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzM4x3lz4ZKB; Fri, 22 Oct 2021 12:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACB3B6D09; Fri, 22 Oct 2021 12:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWkAw038731; Fri, 22 Oct 2021 12:32:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWkRf038730; Fri, 22 Oct 2021 12:32:46 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:46 GMT Message-Id: <202110221232.19MCWkRf038730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 094befb5dbd1 - stable/12 - pf: remove unused field from pf_kanchor List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 094befb5dbd111209b43d2e77c4d03df1f41bc4e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=094befb5dbd111209b43d2e77c4d03df1f41bc4e commit 094befb5dbd111209b43d2e77c4d03df1f41bc4e Author: Kristof Provost AuthorDate: 2021-10-04 08:58:27 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:08 +0000 pf: remove unused field from pf_kanchor The 'match' field is only used in the userspace version of the struct (pf_anchor). MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 76c2e71c4c65a85279505005716aa43101c47bf7) --- sys/net/pfvar.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b6a1f779c073..6f8d79b27133 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1044,7 +1044,6 @@ struct pf_kanchor { char path[MAXPATHLEN]; struct pf_kruleset ruleset; int refcnt; /* anchor rules */ - int match; /* XXX: used for pfctl black magic */ }; RB_PROTOTYPE(pf_kanchor_global, pf_kanchor, entry_global, pf_anchor_compare); RB_PROTOTYPE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); From nobody Fri Oct 22 12:32:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE77A17F7ED1; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzL1g36z4ZgJ; Fri, 22 Oct 2021 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 886E96CC7; Fri, 22 Oct 2021 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWjWv038660; Fri, 22 Oct 2021 12:32:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWjtA038659; Fri, 22 Oct 2021 12:32:45 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:45 GMT Message-Id: <202110221232.19MCWjtA038659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 1b46da63eec5 - stable/12 - pfctl: Remove unused variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1b46da63eec5c4cea8eecf2a7f132634903bb1e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1b46da63eec5c4cea8eecf2a7f132634903bb1e6 commit 1b46da63eec5c4cea8eecf2a7f132634903bb1e6 Author: Kristof Provost AuthorDate: 2021-09-30 15:25:45 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:32:29 +0000 pfctl: Remove unused variable MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 90dedf0fef71d3e3081015525665bf335f9c7ee3) --- sbin/pfctl/parse.y | 1 - sbin/pfctl/pfctl_parser.h | 1 - 2 files changed, 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 2bfb1e651d65..5c3f4a07a98a 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -846,7 +846,6 @@ pfa_anchor : '{' /* steping into a brace anchor */ pf->asd++; pf->bn++; - pf->brace = 1; /* create a holding ruleset in the root */ snprintf(ta, PF_ANCHOR_NAME_SIZE, "_%d", pf->bn); diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 484830c61791..4e144b97567b 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -82,7 +82,6 @@ struct pfctl { int loadopt; int asd; /* anchor stack depth */ int bn; /* brace number */ - int brace; int tdirty; /* kernel dirty */ #define PFCTL_ANCHOR_STACK_DEPTH 64 struct pfctl_anchor *astack[PFCTL_ANCHOR_STACK_DEPTH]; From nobody Fri Oct 22 12:32:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 059561800416; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzP2xGLz4ZZr; Fri, 22 Oct 2021 12:32:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF2D86CC8; Fri, 22 Oct 2021 12:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWm6t038782; Fri, 22 Oct 2021 12:32:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWml5038781; Fri, 22 Oct 2021 12:32:48 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:48 GMT Message-Id: <202110221232.19MCWml5038781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6358f57209e2 - stable/12 - pfctl: delay label macro expansion until after rule optimisation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6358f57209e2d16c2f1a6a9e6df09ba8f20f6868 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6358f57209e2d16c2f1a6a9e6df09ba8f20f6868 commit 6358f57209e2d16c2f1a6a9e6df09ba8f20f6868 Author: Kristof Provost AuthorDate: 2021-10-13 14:06:47 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:26 +0000 pfctl: delay label macro expansion until after rule optimisation We used to expand the $nr macro in labels into the rule number prior to the optimisation step. This would occasionally produce incorrect rule numbers in the labels. Delay all macro expansion until after the optimisation step to ensure that we expand the correct values. MFC after: 1 week Reported by: Özkan KIRIK Differential Revision: https://reviews.freebsd.org/D32488 (cherry picked from commit 09c7f2386973f8c36978895a7600320916bc3d07) --- sbin/pfctl/parse.y | 85 +++++++++++++++++++++++------------------------------- sbin/pfctl/pfctl.c | 6 ++++ sbin/pfctl/pfctl.h | 2 ++ 3 files changed, 44 insertions(+), 49 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 5c3f4a07a98a..2dd0e6b6ff43 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -330,14 +330,12 @@ int process_tabledef(char *, struct table_opts *); void expand_label_str(char *, size_t, const char *, const char *); void expand_label_if(const char *, char *, size_t, const char *); void expand_label_addr(const char *, char *, size_t, u_int8_t, - struct node_host *); + struct pf_rule_addr *); void expand_label_port(const char *, char *, size_t, - struct node_port *); + struct pf_rule_addr *); void expand_label_proto(const char *, char *, size_t, u_int8_t); -void expand_label_nr(const char *, char *, size_t); -void expand_label(char *, size_t, const char *, u_int8_t, - struct node_host *, struct node_port *, struct node_host *, - struct node_port *, u_int8_t); +void expand_label_nr(const char *, char *, size_t, + struct pfctl_rule *); void expand_rule(struct pfctl_rule *, struct node_if *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, @@ -4975,17 +4973,17 @@ expand_label_if(const char *name, char *label, size_t len, const char *ifname) void expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, - struct node_host *h) + struct pf_rule_addr *addr) { char tmp[64], tmp_not[66]; if (strstr(label, name) != NULL) { - switch (h->addr.type) { + switch (addr->addr.type) { case PF_ADDR_DYNIFTL: - snprintf(tmp, sizeof(tmp), "(%s)", h->addr.v.ifname); + snprintf(tmp, sizeof(tmp), "(%s)", addr->addr.v.ifname); break; case PF_ADDR_TABLE: - snprintf(tmp, sizeof(tmp), "<%s>", h->addr.v.tblname); + snprintf(tmp, sizeof(tmp), "<%s>", addr->addr.v.tblname); break; case PF_ADDR_NOROUTE: snprintf(tmp, sizeof(tmp), "no-route"); @@ -4994,18 +4992,18 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, snprintf(tmp, sizeof(tmp), "urpf-failed"); break; case PF_ADDR_ADDRMASK: - if (!af || (PF_AZERO(&h->addr.v.a.addr, af) && - PF_AZERO(&h->addr.v.a.mask, af))) + if (!af || (PF_AZERO(&addr->addr.v.a.addr, af) && + PF_AZERO(&addr->addr.v.a.mask, af))) snprintf(tmp, sizeof(tmp), "any"); else { char a[48]; int bits; - if (inet_ntop(af, &h->addr.v.a.addr, a, + if (inet_ntop(af, &addr->addr.v.a.addr, a, sizeof(a)) == NULL) snprintf(tmp, sizeof(tmp), "?"); else { - bits = unmask(&h->addr.v.a.mask, af); + bits = unmask(&addr->addr.v.a.mask, af); if ((af == AF_INET && bits < 32) || (af == AF_INET6 && bits < 128)) snprintf(tmp, sizeof(tmp), @@ -5021,7 +5019,7 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, break; } - if (h->not) { + if (addr->neg) { snprintf(tmp_not, sizeof(tmp_not), "! %s", tmp); expand_label_str(label, len, name, tmp_not); } else @@ -5031,30 +5029,30 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, void expand_label_port(const char *name, char *label, size_t len, - struct node_port *port) + struct pf_rule_addr *addr) { char a1[6], a2[6], op[13] = ""; if (strstr(label, name) != NULL) { - snprintf(a1, sizeof(a1), "%u", ntohs(port->port[0])); - snprintf(a2, sizeof(a2), "%u", ntohs(port->port[1])); - if (!port->op) + snprintf(a1, sizeof(a1), "%u", ntohs(addr->port[0])); + snprintf(a2, sizeof(a2), "%u", ntohs(addr->port[1])); + if (!addr->port_op) ; - else if (port->op == PF_OP_IRG) + else if (addr->port_op == PF_OP_IRG) snprintf(op, sizeof(op), "%s><%s", a1, a2); - else if (port->op == PF_OP_XRG) + else if (addr->port_op == PF_OP_XRG) snprintf(op, sizeof(op), "%s<>%s", a1, a2); - else if (port->op == PF_OP_EQ) + else if (addr->port_op == PF_OP_EQ) snprintf(op, sizeof(op), "%s", a1); - else if (port->op == PF_OP_NE) + else if (addr->port_op == PF_OP_NE) snprintf(op, sizeof(op), "!=%s", a1); - else if (port->op == PF_OP_LT) + else if (addr->port_op == PF_OP_LT) snprintf(op, sizeof(op), "<%s", a1); - else if (port->op == PF_OP_LE) + else if (addr->port_op == PF_OP_LE) snprintf(op, sizeof(op), "<=%s", a1); - else if (port->op == PF_OP_GT) + else if (addr->port_op == PF_OP_GT) snprintf(op, sizeof(op), ">%s", a1); - else if (port->op == PF_OP_GE) + else if (addr->port_op == PF_OP_GE) snprintf(op, sizeof(op), ">=%s", a1); expand_label_str(label, len, name, op); } @@ -5078,29 +5076,27 @@ expand_label_proto(const char *name, char *label, size_t len, u_int8_t proto) } void -expand_label_nr(const char *name, char *label, size_t len) +expand_label_nr(const char *name, char *label, size_t len, + struct pfctl_rule *r) { char n[11]; if (strstr(label, name) != NULL) { - snprintf(n, sizeof(n), "%u", pf->anchor->match); + snprintf(n, sizeof(n), "%u", r->nr); expand_label_str(label, len, name, n); } } void -expand_label(char *label, size_t len, const char *ifname, sa_family_t af, - struct node_host *src_host, struct node_port *src_port, - struct node_host *dst_host, struct node_port *dst_port, - u_int8_t proto) +expand_label(char *label, size_t len, struct pfctl_rule *r) { - expand_label_if("$if", label, len, ifname); - expand_label_addr("$srcaddr", label, len, af, src_host); - expand_label_addr("$dstaddr", label, len, af, dst_host); - expand_label_port("$srcport", label, len, src_port); - expand_label_port("$dstport", label, len, dst_port); - expand_label_proto("$proto", label, len, proto); - expand_label_nr("$nr", label, len); + expand_label_if("$if", label, len, r->ifname); + expand_label_addr("$srcaddr", label, len, r->af, &r->src); + expand_label_addr("$dstaddr", label, len, r->af, &r->dst); + expand_label_port("$srcport", label, len, &r->src); + expand_label_port("$dstport", label, len, &r->dst); + expand_label_proto("$proto", label, len, r->proto); + expand_label_nr("$nr", label, len, r); } int @@ -5434,15 +5430,6 @@ expand_rule(struct pfctl_rule *r, if (strlcpy(r->match_tagname, match_tagname, sizeof(r->match_tagname)) >= sizeof(r->match_tagname)) errx(1, "expand_rule: strlcpy"); - for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) - expand_label(r->label[i], PF_RULE_LABEL_SIZE, - r->ifname, r->af, src_host, src_port, dst_host, - dst_port, proto->proto); - expand_label(r->tagname, PF_TAG_NAME_SIZE, r->ifname, r->af, - src_host, src_port, dst_host, dst_port, proto->proto); - expand_label(r->match_tagname, PF_TAG_NAME_SIZE, r->ifname, - r->af, src_host, src_port, dst_host, dst_port, - proto->proto); error += check_netmask(src_host, r->af); error += check_netmask(dst_host, r->af); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index d7bde0012e9b..a0eec1b09289 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1528,6 +1528,12 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pfctl_ruleset *rs, while ((r = TAILQ_FIRST(rs->rules[rs_num].active.ptr)) != NULL) { TAILQ_REMOVE(rs->rules[rs_num].active.ptr, r, entries); + + for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) + expand_label(r->label[i], PF_RULE_LABEL_SIZE, r); + expand_label(r->tagname, PF_TAG_NAME_SIZE, r); + expand_label(r->match_tagname, PF_TAG_NAME_SIZE, r); + if ((error = pfctl_load_rule(pf, path, r, depth))) goto error; if (r->anchor) { diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 80ef184fa90f..606eb729cd44 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -138,6 +138,8 @@ void pf_remove_if_empty_ruleset(struct pfctl_ruleset *); struct pfctl_ruleset *pf_find_ruleset(const char *); struct pfctl_ruleset *pf_find_or_create_ruleset(const char *); +void expand_label(char *, size_t, struct pfctl_rule *); + const char *pfctl_proto2name(int); #endif /* _PFCTL_H_ */ From nobody Fri Oct 22 12:32:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 41B5418003D1; Fri, 22 Oct 2021 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNzR5PGCz4ZMf; Fri, 22 Oct 2021 12:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1669168FA; Fri, 22 Oct 2021 12:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MCWoMd038806; Fri, 22 Oct 2021 12:32:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MCWoAn038805; Fri, 22 Oct 2021 12:32:50 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:32:50 GMT Message-Id: <202110221232.19MCWoAn038805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 615433297d67 - stable/12 - pf tests: ensure that $nr expansion is correct List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 615433297d6764b0a243dfe6156a05f619d6379c Auto-Submitted: auto-generated X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=615433297d6764b0a243dfe6156a05f619d6379c commit 615433297d6764b0a243dfe6156a05f619d6379c Author: Kristof Provost AuthorDate: 2021-10-03 16:07:04 +0000 Commit: Kristof Provost CommitDate: 2021-10-22 07:34:32 +0000 pf tests: ensure that $nr expansion is correct Test the $nr expansion in labels is correct, even if the optimiser reduces the rule count. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32489 (cherry picked from commit 914ec9c78dcd5d8f77552fb93d3bc15efe9c0f40) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/macro.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 3882db287f5a..5a8b5fe8de70 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -14,6 +14,7 @@ ATF_TESTS_SH+= altq \ get_state \ icmp \ killstate \ + macro \ map_e \ names \ nat \ diff --git a/tests/sys/netpfil/pf/macro.sh b/tests/sys/netpfil/pf/macro.sh new file mode 100644 index 000000000000..442677c9f946 --- /dev/null +++ b/tests/sys/netpfil/pf/macro.sh @@ -0,0 +1,40 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "nr" "cleanup" +nr_head() +{ + atf_set descr 'Test $nr expansion' + atf_set require.user root +} + +nr_body() +{ + # Ensure that when the optimiser collapses rules the macro expansion + # has the correct rule number + pft_init + + vnet_mkjail alcatraz + jexec alcatraz ifconfig lo0 inet 127.0.0.1/8 + jexec alcatraz ifconfig lo0 inet 127.0.0.2/32 alias + + pft_set_rules alcatraz \ + "pass quick on lo from lo:network to lo:network" \ + "block quick all label \"ruleNo:\$nr\"" + + no=$(jexec alcatraz pfctl -sr -vv | awk '/ruleNo/ { gsub("@", "", $1); print $1; }') + ruleno=$(jexec alcatraz pfctl -sr -vv | awk '/ruleNo/ { gsub(/"ruleNo:/, "", $7); gsub(/"/, "", $7); print $7; }') + if [ "${no}" -ne "${ruleno}" ]; + then + atf_fail "Expected ruleNo $no != $ruleno" + fi +} + +nr_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "nr" +} From nobody Fri Oct 22 13:17:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7C3091816F7F for ; Fri, 22 Oct 2021 13:17:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbPzT2ZTLz4rVm for ; Fri, 22 Oct 2021 13:17:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa32.google.com with SMTP id o42so1454826vkf.9 for ; Fri, 22 Oct 2021 06:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ipdlCUY0j7C2wiQxXFY6vxLnxrQXShsrws5cLOmW9tU=; b=YdsPdpnCyBklkV4EqGOmKXdQabh/z/JRvtrdfb+obJ8EGDbp/Lr27+WmeQu1PRiGLV JIj8ngxLLAzYaKBNkur4PPyUYkWmOzLgWkUqfqht3SxStkdYMLFQVf4nvg406Srvq+v/ 7il3Eiohp5R/KlNvOxIGeg0P53I888xyhtI4Wp2jMl0kiaZcpyWkyIEV8QW/rTR2W748 Wd1k1gP/JUME3hXda55BsaSk2XSKAVseG4m/IHkbuFhWlh8QO6Pt/oPiaIgrzk+MPpo6 JVtAFgznX270OmzA3G7M/N723xhoGa6TCbblvSD64KQo9WMRh8yvujf1gOxmcUZhcCnm jOgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ipdlCUY0j7C2wiQxXFY6vxLnxrQXShsrws5cLOmW9tU=; b=YRBkNbkv3tqrCOxPu4YS1K00KOMYYojrhJLTmR0e69bcnPrCnVJXHnlaYYjN39zB5V Q3YtTq2sk6s4uk63ZzTaLlZzTyfXkal61CzaBDemPLz7lhMi0DAzMWoTy4eJ2nAKIX1C 6RxHD8A1U1eWQUi8V7YfItfBzkl9riVIXq+c300/BUwnTf0kkNoHyh79IcW3EsJKSipJ HHC55OL+4ReFNzumQBSnAvXg1m0GKUMGrCeR4taQcIIHehz8+0/3jzd7PxaaMI15nLz9 /oFOjKpqIg3BUXQSDwKVuCWMEJLUJMMfilYfbEqs+RZDYG98hs7O9IIlWGmLJwSO+o5q 4oLA== X-Gm-Message-State: AOAM533NCfWVEjcNXXcYGUtFKnxsaGeeH/Ln9ft6O1ZIxy6vbPk69+RS NKV3XMPqXV+s3WwL9qTI4c7IubmfcB1hGYLlEFk6Cg== X-Google-Smtp-Source: ABdhPJxQcx6znsxiJKmd6/sKFwvO/7Ups7G2imjA7C1CI1XdhKS/ATykjntCSZ0emSeA1W3GK51i291H2v9Gd8iAN7k= X-Received: by 2002:a05:6122:180d:: with SMTP id ay13mr14469572vkb.21.1634908671487; Fri, 22 Oct 2021 06:17:51 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Fri, 22 Oct 2021 07:17:40 -0600 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: Alexey Dokuchaev Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000009ac35705cef0d6a7" X-Rspamd-Queue-Id: 4HbPzT2ZTLz4rVm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000009ac35705cef0d6a7 Content-Type: text/plain; charset="UTF-8" On Fri, Oct 22, 2021 at 12:28 AM Alexey Dokuchaev wrote: > > This is not how it works Warner, you don't first offer biased poll > and then defend skewed results by appealing to observed ratio and > how smart your target audience is. > Infinitely criticizing things isn't how it works Alexey. Data is always imperfect. Don't like it? Do better yourself. Warner --0000000000009ac35705cef0d6a7-- From nobody Fri Oct 22 13:33:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A874317F589E; Fri, 22 Oct 2021 13:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbQKQ40zRz4vmM; Fri, 22 Oct 2021 13:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6915B78C2; Fri, 22 Oct 2021 13:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MDXUne018818; Fri, 22 Oct 2021 13:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MDXUd8018817; Fri, 22 Oct 2021 13:33:30 GMT (envelope-from git) Date: Fri, 22 Oct 2021 13:33:30 GMT Message-Id: <202110221333.19MDXUd8018817@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: d7acbe481d17 - main - vm_page: Break reservations to handle noobj allocations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7acbe481d17ccb81c2b879b9731c83b018f3094 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7acbe481d17ccb81c2b879b9731c83b018f3094 commit d7acbe481d17ccb81c2b879b9731c83b018f3094 Author: Mark Johnston AuthorDate: 2021-10-21 15:46:25 +0000 Commit: Mark Johnston CommitDate: 2021-10-22 13:25:59 +0000 vm_page: Break reservations to handle noobj allocations vm_reserv_reclaim_*() will release pages to the default freepool, not the direct freepool from which noobj allocations are drawn. But if both pools are empty, the noobj allocator variants must break reservations to make progress. Reported by: cy Reviewed by: kib (previous version) Fixes: b498f71bc56a ("vm_page: Add a new page allocator interface for unnamed pages") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32592 --- sys/vm/vm_page.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index eca5d0801b7f..76e9ba4db403 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2409,8 +2409,14 @@ again: m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); vm_domain_free_unlock(vmd); - if (m == NULL) + if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); +#if VM_NRESERVLEVEL > 0 + if (freelist == VM_NFREELIST && + vm_reserv_reclaim_inactive(domain)) + goto again; +#endif + } } if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) @@ -2540,6 +2546,11 @@ again: vm_domain_free_unlock(vmd); if (m_ret == NULL) { vm_domain_freecnt_inc(vmd, npages); +#if VM_NRESERVLEVEL > 0 + if (vm_reserv_reclaim_contig(domain, npages, low, + high, alignment, boundary)) + goto again; +#endif } } if (m_ret == NULL) { From nobody Fri Oct 22 13:42:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EF87C1801AA9 for ; Fri, 22 Oct 2021 13:42:30 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbQWp5qKmz4xxT for ; Fri, 22 Oct 2021 13:42:30 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82d.google.com with SMTP id o12so3510086qtq.7 for ; Fri, 22 Oct 2021 06:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bbBhz+WT/CMfj5LNNucyzJiBBbtXRmd8LesgYEolwk4=; b=XoeGljw25Lp5g1mXXka6VtB632bau0cV2r9Q/batxMS2Ptj511SeZjKTNnB/WasIY9 eR2nm9PrldKzI7PLOQqb00UOlvW7qMNmV2OHz7QbXmn4Wsd8qE91NywMxpK2b0D/basm JF6NiTio0ihvloDZQhAcIYaK4+kZwcZVS/Qk/wclZ0v5iHuiKKL+eizZhMz2BQTYgz5v cq002wtuBzZUE/U4AJmdxpm5KhylCPUgNHlKvUQ6xGTnGpt+Wtxfwovbl9Ii09EzVwnp xK++OY/5mtqyftGxUZR09bUGmfahA71I1BHlQn6zlCbmT4aPKCaP/1AfLN6TsTtCWa2o MZ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bbBhz+WT/CMfj5LNNucyzJiBBbtXRmd8LesgYEolwk4=; b=gKWxl+5HfSJgrSWd1SPuHrHI+9taIE2JRA/2G5oTNAtDNMoqieq+FZSIn/1iitpy9/ 99VLeOFWm9xSgYRe8RhbgLEGuwjMl344E9Ylcuajztnd/CfwRrkPjBcxCIb+KJenITne YErgiAPbkM1GUPI0af8iBgkBivHI/kasRhhc1AS3eS342jR2mOiO+AyNdrNOR9l2c8s7 fnezQO8dyfspVcOJNVkzDpGNd8oyB7FvzhGpJdv2W+jYl46AhXmn3RbCg8OQtc8eOOyi lNtGrJ7I/mI8oMqmY6k4CxoPf6Bn6bWWxsxOMfZARhgble8EyoPhRYC8tJeazwuF2Tc2 O22w== X-Gm-Message-State: AOAM5311v/MdLVYlMkzC1CU7uwywpN2HIhrtS25fU44EYosly8ffGYMT lsmkZ72b6UlmGfcYBdBcsAjg7A== X-Google-Smtp-Source: ABdhPJyxMGSekpxuHbqdXTbBuIh7+TpK00A8I0isXTEWP0RSn536Nmi8KPWTQch1fJMfLkmfqu+4iw== X-Received: by 2002:ac8:5f91:: with SMTP id j17mr13547409qta.138.1634910150339; Fri, 22 Oct 2021 06:42:30 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id 74sm4093165qke.109.2021.10.22.06.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 06:42:29 -0700 (PDT) Date: Fri, 22 Oct 2021 09:42:29 -0400 From: Shawn Webb To: Warner Losh Cc: Alexey Dokuchaev , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211022134229.jrkkgahnu6bz2aec@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cqp53tsgsjljfk5g" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HbQWp5qKmz4xxT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --cqp53tsgsjljfk5g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 21, 2021 at 10:55:00PM -0600, Warner Losh wrote: > On Thu, Oct 21, 2021 at 9:17 PM Alexey Dokuchaev wrot= e: >=20 > > On Thu, Oct 21, 2021 at 01:52:26PM -0600, Warner Losh wrote: > > > This discussion to date has been data free. I created a poll... > > > > > > https://twitter.com/bsdimp/status/1451274644439265308 > > > > You couldn't use neutral wording, could you? The poll is loaded > > with bias, this is not the way to collect answers. FWIW, FreeBSD > > itself does not make "loud, annoying noise", it simply instructs > > the underlying hardware to beep. You've asked if people enjoy > > loud, annoying beeps -- well, nobody does, but that's not what > > we're discussing here. > > > P.S. We likely should fix this bug, and also change the note to 880, which > is > A5 (the second A above middle C). Please see > https://reviews.freebsd.org/D32594 > for a fix for the bug I found here. Tangentially related for curious minds: Tom Scott did a video in 2014 about how the types of trucks that beep when reversing are changing from the traditional beep to a white noise type of beep: https://www.youtube.com/watch?v=3Dfa28lIGuxq8 --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --cqp53tsgsjljfk5g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFyv8IACgkQ/y5nonf4 4frlew/+LbAe/krwG273WNnMEFJwAKldY0cIStpX8Sit00gSJbEIZpn1pejT8xL6 nf7yWWN3Bb7/WAhVUD6nQQUTb8wdKz6oS8bClP94I+BX03FpbJHnWe2CgthnZ7rS GJli4totuc+/T9ZKwoQiFr67iEYHJ8sDz3uQhv2hT05KVnDY7bR6E8UoEjGxXccN /Mn7WSQkopipJN3j6LEX5b+hlwgiZt32pnE3cdjxkXSllnEvAcz4cMFQ4KpVGaqN 6JwNoNOa3JsX4lgvn7cyjr8+gxoSfSix/2UkkdGnqu34/H6hy8uSY6ihG6PME/qZ 0USfjkQbBjr07+rhy0UHBqPBY27+Rtb+wab1Upx/3o4qdxObSynFP1AfRFFYcogF u9dkAVNcQGp6kwCP0ptnoaZC6MDCAXgZ7jK1YIKUe98oR0cp5t0HYu4UNdeqHfAu v68i5xEqxilRJXajpR56ZkDolYERRPe2DVD0KNs4sTZ550VNrNsuwUh8KlLIHv2l nUhav2aYgIB3b3iODfF0pNV3FrHrgtx9rjQt++daHz97B3vng/AsmU4ryVv8+0aI ACJOCdiXHh2e0nnDPQ7zEk88EwW0IPbSaBomhd26Oy8MGsxUqI2MR+RtE1d9pTOd n7k7lo+mOEGXMFqRLKFT3iHKIl9SWli1NrkAwMdKejv+JLj/bhU= =c0fF -----END PGP SIGNATURE----- --cqp53tsgsjljfk5g-- From nobody Fri Oct 22 15:55:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E5A711814A68; Fri, 22 Oct 2021 15:55:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbTSr0rJgz3v1M; Fri, 22 Oct 2021 15:55:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x830.google.com with SMTP id y11so3868710qtn.13; Fri, 22 Oct 2021 08:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rQIX1ZNv69UapXkXdQ4X1hOjCxYLoCsgSmH11Lr2URc=; b=phZCXjXtaCXTU56ZJK/t3qIRZe2uWvRGILp34xToFqlBgNvVEG121eG6ZoghmwW/FR z4BYERaYGsC3R0fuI8q36wTU4OaMPlTw2DU9EberMyEsZ6aRjXDJgnyZwKQsxygJ7qww 26XI16HCmhHxuyG9UqZPbsHmLGitqsr5L2BRT1sc8UXT/Izh+a4cJ1g+XWpqWH2g2Bz2 QskSmtJx26ZbAWcZCL4nDuCHDPJioCpMNpb7kenfIt8UPLSm0b9WuryovVTAc5pDb2BI qv/wwxNLKI/EXuT5BnHPCx3B2UiJC9g8jhlYqwQmmYq4OqDUNxp2UvsaCAbBpC8e5+Pn yEhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=rQIX1ZNv69UapXkXdQ4X1hOjCxYLoCsgSmH11Lr2URc=; b=D8ZJ+NX16qq1SKfu6eF53lEFG17Jgi7Po+YmA0aXvHlYVyLQ8k1fcAvudVFIzRCVo8 UazCXaceI04Cc1jf+sb+UoQh4z2Ss9TCgSVHU++k0EraYAMSa8lZHleuhIkgl3gQribJ qdSkpA1++YEuZD0zgMw4g4d2MUp7EBOkU5gIFNxtqYxvdsltcVriqNgImpATrco8mbuM GV+rwTqPE+lG8ix7oDll/8K5UoSqNQX1CQKrF0rtHA+kgD8QcGpTVUKgu/D5lPBlq7AT 82qzeJKYEaJaf7H5AfBUOPCMNvEWIugaHe020kae6HacsLtkSek1u3bmjRXSS6/o62q0 wUYA== X-Gm-Message-State: AOAM531duj6aPjGJiSRIwoG0ecxuQ8utuQ1lLOvZPhCwS+b1qDqLMjCE 9drZsd7KaJ8t3pq8nU13eWeuzM7W+0Y= X-Google-Smtp-Source: ABdhPJwDTM8baV8WSx11sYoR/s5mG0XauPvdhibKhLPElsVE/kyVd+oJXaT6tT6nxge6/u6rBVbeMw== X-Received: by 2002:ac8:7c53:: with SMTP id o19mr817766qtv.228.1634918107128; Fri, 22 Oct 2021 08:55:07 -0700 (PDT) Received: from nuc ([142.126.186.191]) by smtp.gmail.com with ESMTPSA id w185sm4456206qkd.30.2021.10.22.08.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 08:55:06 -0700 (PDT) Sender: Mark Johnston Date: Fri, 22 Oct 2021 11:55:04 -0400 From: Mark Johnston To: Martin Matuska Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6ba2210ee039 - main - zfs: merge openzfs/zfs@ec64fdb93 (master) into main Message-ID: References: <202110211347.19LDlLoS004709@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202110211347.19LDlLoS004709@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HbTSr0rJgz3v1M X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=phZCXjXt; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::830 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.69 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-0.995]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[freebsd.org]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.998]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::830:from]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 01:47:21PM +0000, Martin Matuska wrote: > The branch main has been updated by mm: > > URL: https://cgit.FreeBSD.org/src/commit/?id=6ba2210ee039f2f12878c217bcf058e9c8b26b29 > > commit 6ba2210ee039f2f12878c217bcf058e9c8b26b29 > Merge: 01593a0ff9f1 ec64fdb93d14 > Author: Martin Matuska > AuthorDate: 2021-10-21 11:58:45 +0000 > Commit: Martin Matuska > CommitDate: 2021-10-21 13:06:06 +0000 > > zfs: merge openzfs/zfs@ec64fdb93 (master) into main > > Notable upstream pull request merges: > #12392 Avoid panic in case of pool errors and missing L2ARC > #12448 skip snapshot in zfs_iter_mounted() > #12516 Fix NFS and large reads on older kernels > #12533 Fail invalid incremental recursive send gracefully > #12569 FreeBSD: Really zero the zero page > #12575 Reject zfs send -RI with nonexistent fromsnap > #12602 Correct refcount_add in dmu_zfetch > #12650 zpool should call zfs_nicestrtonum() with non-NULL handle > > Obtained from: OpenZFS > OpenZFS commit: ec64fdb93d144ab1884097cfd36e18b62a2db848 Hi, I'm seeing some strange errors after the merge. For instance, kldxref segfaults during an installkernel to a dir on ZFS, and it seems to be due to some mishandling of short read()s. I also get filesystem panics in guest VMs with disk images on ZFS. The problems seem to go away with a revert of https://cgit.freebsd.org/src/commit/?id=59eab1093a361ca76849ca76b2ec079c8736e8e3 From nobody Fri Oct 22 16:03:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E5DFA1819A75; Fri, 22 Oct 2021 16:04:02 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [144.76.20.103]) by mx1.freebsd.org (Postfix) with ESMTP id 4HbTg6599nz4SsQ; Fri, 22 Oct 2021 16:04:02 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id CDF692D5DD2; Fri, 22 Oct 2021 18:03:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk by mail.vx.sk (amavisd-new, unix socket) with LMTP id fJ-5lCwPa2sg; Fri, 22 Oct 2021 18:03:55 +0200 (CEST) Received: from [10.0.9.123] (188-167-171-2.static.chello.sk [188.167.171.2]) by mail.vx.sk (Postfix) with ESMTPSA id 82A6A2D5DCF; Fri, 22 Oct 2021 18:03:55 +0200 (CEST) Message-ID: <040e1f76-9884-b416-7ec2-8c4bbc24d89b@FreeBSD.org> Date: Fri, 22 Oct 2021 18:03:53 +0200 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: git: 6ba2210ee039 - main - zfs: merge openzfs/zfs@ec64fdb93 (master) into main Content-Language: en-US To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202110211347.19LDlLoS004709@gitrepo.freebsd.org> From: Martin Matuska In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbTg6599nz4SsQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Mark, if you can confirm it working without that commit, we can revert that single commit on main for now and it would be great if you open an issue at OpenZFS. Cheers, mm On 22. 10. 2021 17:55, Mark Johnston wrote: > On Thu, Oct 21, 2021 at 01:47:21PM +0000, Martin Matuska wrote: >> The branch main has been updated by mm: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=6ba2210ee039f2f12878c217bcf058e9c8b26b29 >> >> commit 6ba2210ee039f2f12878c217bcf058e9c8b26b29 >> Merge: 01593a0ff9f1 ec64fdb93d14 >> Author: Martin Matuska >> AuthorDate: 2021-10-21 11:58:45 +0000 >> Commit: Martin Matuska >> CommitDate: 2021-10-21 13:06:06 +0000 >> >> zfs: merge openzfs/zfs@ec64fdb93 (master) into main >> >> Notable upstream pull request merges: >> #12392 Avoid panic in case of pool errors and missing L2ARC >> #12448 skip snapshot in zfs_iter_mounted() >> #12516 Fix NFS and large reads on older kernels >> #12533 Fail invalid incremental recursive send gracefully >> #12569 FreeBSD: Really zero the zero page >> #12575 Reject zfs send -RI with nonexistent fromsnap >> #12602 Correct refcount_add in dmu_zfetch >> #12650 zpool should call zfs_nicestrtonum() with non-NULL handle >> >> Obtained from: OpenZFS >> OpenZFS commit: ec64fdb93d144ab1884097cfd36e18b62a2db848 > Hi, > > I'm seeing some strange errors after the merge. For instance, kldxref > segfaults during an installkernel to a dir on ZFS, and it seems to be > due to some mishandling of short read()s. I also get filesystem panics > in guest VMs with disk images on ZFS. The problems seem to go away with > a revert of > https://cgit.freebsd.org/src/commit/?id=59eab1093a361ca76849ca76b2ec079c8736e8e3 From nobody Fri Oct 22 16:53:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 806F21808520; Fri, 22 Oct 2021 16:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbVmP335hz4jX8; Fri, 22 Oct 2021 16:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4840F12546; Fri, 22 Oct 2021 16:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MGrfnT084919; Fri, 22 Oct 2021 16:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MGrfa1084918; Fri, 22 Oct 2021 16:53:41 GMT (envelope-from git) Date: Fri, 22 Oct 2021 16:53:41 GMT Message-Id: <202110221653.19MGrfa1084918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: a23e18ea5456 - main - powerpc64: tell kernel when radix is not available List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a23e18ea545675aca7551ef2395f6df40a3acb29 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=a23e18ea545675aca7551ef2395f6df40a3acb29 commit a23e18ea545675aca7551ef2395f6df40a3acb29 Author: Leandro Lupori AuthorDate: 2021-10-22 16:44:21 +0000 Commit: Leandro Lupori CommitDate: 2021-10-22 16:44:21 +0000 powerpc64: tell kernel when radix is not available If CAS detects that radix is not supported, set radix_mmu to 0 to avoid the kernel trying to use it and panic. MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) --- stand/powerpc/ofw/cas.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c index 0a12f31d1a1a..e95af42762a5 100644 --- a/stand/powerpc/ofw/cas.c +++ b/stand/powerpc/ofw/cas.c @@ -234,9 +234,15 @@ ppc64_cas(void) } } - if ((var = getenv("radix_mmu")) != NULL && var[0] == '0') + if (!radix_mmu) + /* + * If radix is not supported, set radix_mmu to 0 to avoid + * the kernel trying to use it and panic. + */ + setenv("radix_mmu", "0", 1); + else if ((var = getenv("radix_mmu")) != NULL && var[0] == '0') radix_mmu = 0; - if (radix_mmu) + else ov5[OV5_MMU_INDEX] = OV5_MMU_RADIX; inst = OF_open("/"); From nobody Fri Oct 22 16:59:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A20BE180B6B3 for ; Fri, 22 Oct 2021 16:59:32 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5d.ore.mailhop.org (outbound5d.ore.mailhop.org [100.20.105.3]) (using TLSv1.3 with cipher TLS_AES_256_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 4HbVv82Wzpz4lCy for ; Fri, 22 Oct 2021 16:59:32 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1634921971; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=mAdf2zYOfC2to/XsVfoR8ZkfWxHcExnL6NaKEzMK/PsEwQxNcdqz3czuGSpNiezsShKgfCC2duUzB 6I2tgPDqas4EjQZG5H10BwVgDoybxMpcRv0Oek+JBV8diaMCt2SNs2mgW7/ygrB2TkJp1CfOZ4EbtJ yUhS77OkzkfKkWOzkFQd23TUrMbpGw/2L7sXUyQkv8zHEk7LjH1fPG5Y6XNNvnV/BfbTX6JgDth3C9 jaqENvt3V/7JdlNBi3kz8PmfL5yntDxPX8HPqAxVGUMumWiS7QcEdOS6EhW1DeyiXC0LH26vTQ/3ri OrBCHW1dfIl6xGyvsslzh/MPXPsAmVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=75L4NOhp8svR+3asHh9nEXk0PCm2q7y+tvGcukBdXqQ=; b=LDZZ8IYq4Uxum6KnBCrWBBGUUvRXMyiwyS7DDRg/tBwWe5jnhiiscktc16M+AIjHaFRqIn/ov9bvg ASCjUxK/UXg5+84+wByfN7BOfT5LwhPtMiHhMfgfFFdaqsiivBFtOahRAjq6cmZ0M0mOvpbbMWp77u Y66AZUJBf7C2XNNbMmiJRDfwWdt6ZkU59OFBIFfnXjY10mjsfFmDTP7drrErHldY+pJHEtaCS4jq9V EsczvDyS3UTm/sC6swlF539wbcRY3/3N1DZ0Tc/wO2C/gXZnfvmJkfNvrLn1wQjxnxFaq8tewGtg6b tdJPx4PR6r/pEt21iDALBEI2WJPwVeQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=75L4NOhp8svR+3asHh9nEXk0PCm2q7y+tvGcukBdXqQ=; b=wjkLSr3qrCUDS/vWxz6jR3rJfcYYXrB0LyiIzBWAAXC5yjSIps/CAp3QQneejSz3vYlGBrkeh9WfT 1C0jxpIP+HsQNd8S2iZL7T4hBkpTCMAmSOfwUkQqAxbW7Upadkez6RdhNIZ8bqyqlRVX1/r31q948r 3x8In6AmIAUXZ8vXOQEkdkVwzTxjNdxH4sUVGdMfwO/Rn7EuQUDe5SlGH9fLn2cXFOIIw5djz53J3p lZORNRLEGyWaGfdi07PIVFa+HsAEfWb5xdu/cdSes0GuucEdbpSibN/TfA/crUwBSMV9v3808iVT+K ucATVFcdskRCcQNqF6K+loQ7K8vqnAA== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: 6b9c9b3b-3359-11ec-9e58-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 6b9c9b3b-3359-11ec-9e58-bf9d68d023b6; Fri, 22 Oct 2021 16:59:30 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19MGxSNt083324; Fri, 22 Oct 2021 10:59:29 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <2d9f9df5958cec23b11d6e23e0b20c236db44574.camel@freebsd.org> Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default From: Ian Lepore To: Alexey Dokuchaev , Warner Losh Cc: src-committers , "" , dev-commits-src-main@freebsd.org Date: Fri, 22 Oct 2021 10:59:28 -0600 In-Reply-To: References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> Content-Type: text/plain; charset="ASCII" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbVv82Wzpz4lCy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 2021-10-22 at 06:28 +0000, Alexey Dokuchaev wrote: > > Our users aren't so unsophisticated as to be totally swayed by the > > choice of wording. > > This is not how it works Warner, you don't first offer biased poll > and then defend skewed results by appealing to observed ratio and > how smart your target audience is. Do you really believe different words would change the result from 4:1 against to some number in favor? Of course you don't, you're only complaining because your opinion is VERY CLEARLY the minority one. -- Ian From nobody Fri Oct 22 17:04:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BD022180BF37; Fri, 22 Oct 2021 17:04:18 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbW0f39wfz4lfb; Fri, 22 Oct 2021 17:04:18 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 19MH4GUM075995; Fri, 22 Oct 2021 10:04:16 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 19MH4FDn075994; Fri, 22 Oct 2021 10:04:15 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default In-Reply-To: <20211021192020.6dcb95c1@ernst.home> To: gljennjohn@gmail.com Date: Fri, 22 Oct 2021 10:04:15 -0700 (PDT) CC: Gleb Smirnoff , Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4HbW0f39wfz4lfb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N > On Thu, 21 Oct 2021 10:03:05 -0700 > Gleb Smirnoff wrote: > > > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > > S> > > S> This change disable bell in X11 too. > > S> This is completly disable speaker bell. > > > > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. > > How is that possible that vt(4) affects X11? > > > > He could be right. I don't use vt, but syscons also has a bell setting: > sysctl -d hw.syscons.bell hw.syscons.bell: enable bell > > With this set to 1 a ^G in xterm results in a beep. After setting the > sysctl to 0 a ^G in xterm produces no sound at all. I also suspect that this kills "visual bell" which is a bright flash of the terminal. We need to STOP these "I dont like the 20 year old defaults, so I am going to change them to what I like and use" It is NOT forward progress on making a better system, it is tilting at defaults, very long established defaults, that should probably just be left alone. I dont like a lot of the defaults on a lot of OS's, I tweak them to my needs. FreeBSD keeps tweaking things such that I have to tweak my tweaks to keep things as I see fit. THAT IS A POLA VIOLATION! -- Rod Grimes rgrimes@freebsd.org From nobody Fri Oct 22 17:12:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 016611810AF4; Fri, 22 Oct 2021 17:12:19 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbW9t4nM1z4pL1; Fri, 22 Oct 2021 17:12:18 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 19MHCGTO076029; Fri, 22 Oct 2021 10:12:16 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 19MHCGfO076028; Fri, 22 Oct 2021 10:12:16 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202110221712.19MHCGfO076028@gndrsh.dnsmgr.net> Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default In-Reply-To: <718707f9-57e9-057e-1811-f9229f2da9de@FreeBSD.org> To: Andriy Gapon Date: Fri, 22 Oct 2021 10:12:16 -0700 (PDT) CC: Warner Losh , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4HbW9t4nM1z4pL1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N > On 21/10/2021 22:52, Warner Losh wrote: > > This discussion to date has been data free. I created a poll... > > > > https://twitter.com/bsdimp/status/1451274644439265308 > > > I tried to abstain from this discussion on whether the bike shed should have > been repainted although I do have an opinion :-) > > Don't have we have anything better than twitter for such a poll? > Something on FreeBSD infra maybe? > I recall some polls and surveys in the past and they weren't on twitter. This is a survey of the overlap of people on the freebsd-commit mailling list, and Twitter users, not what I would call a very valid polling of FreeBSD users. Someone register my "continue to make sound" vote. Warner, please fix the broken code with respect to pitch, that is probably WHY people find it overtly annoying. > > Reading some comments on twitter (thankfully I don't need to sign up for that) I > see a valid point about feature discoverability. If it beeps, I know that it > can beep. And if that annoys me, I'll try to research how to disable it. If it > doesn't beep, how would I even know that it can beep? (Asking for a 15 year old > friend). Maybe I would find the beeping useful and pleasant, but what are my > chances of learning that it exists? Interesting perspective, and I agree. I am also concerned about loss of beep function in X11 terminals. -- Rod Grimes rgrimes@freebsd.org From nobody Fri Oct 22 17:16:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D28E31812558; Fri, 22 Oct 2021 17:16:51 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbWH748r8z4qmD; Fri, 22 Oct 2021 17:16:51 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19MHGbwS005943 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Oct 2021 10:16:37 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19MHGbWT005942; Fri, 22 Oct 2021 10:16:37 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 22 Oct 2021 10:16:37 -0700 From: Gleb Smirnoff To: Vladimir Kondratyev Cc: Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> X-Rspamd-Queue-Id: 4HbWH748r8z4qmD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 09:58:31PM +0300, Vladimir Kondratyev wrote: V> On 21.10.2021 20:03, Gleb Smirnoff wrote: V> > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: V> > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then V> > S> V> > S> This change disable bell in X11 too. V> > S> This is completly disable speaker bell. V> > V> > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. V> > How is that possible that vt(4) affects X11? V> > V> pre-evdev X11 got keyboard input from tty subsystem V> V> and post-evdev X11 still affected by it. We have local X11 patch which V> disables bell on ttyv8, otherwise you'll hear annoying sound as soon as V> tty buffer get filled up. V> V> But you have to have custom X11 build to hear bell under X11 I definitely don't have a custom build of X11 and I got bell in xterm. Of course I haven't yet upgaded to the discussed revision. -- Gleb Smirnoff From nobody Fri Oct 22 17:17:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8DB031812E9D; Fri, 22 Oct 2021 17:17:40 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbWJ422Gjz4r0v; Fri, 22 Oct 2021 17:17:40 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19MHHdlW005958 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Oct 2021 10:17:39 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19MHHdP8005957; Fri, 22 Oct 2021 10:17:39 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 22 Oct 2021 10:17:39 -0700 From: Gleb Smirnoff To: Jung-uk Kim Cc: gljennjohn@gmail.com, Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <20211021192020.6dcb95c1@ernst.home> <23455738-85b6-604d-de67-157474811248@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23455738-85b6-604d-de67-157474811248@FreeBSD.org> X-Rspamd-Queue-Id: 4HbWJ422Gjz4r0v X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 21, 2021 at 01:56:32PM -0400, Jung-uk Kim wrote: J> >> S> This is completly disable speaker bell. J> >> J> >> Are you sure? I haven't yet upgraded my desktop to this point, so can't test. J> >> How is that possible that vt(4) affects X11? J> > J> > He could be right. I don't use vt, but syscons also has a bell setting: J> > sysctl -d hw.syscons.bell hw.syscons.bell: enable bell J> > J> > With this set to 1 a ^G in xterm results in a beep. After setting the J> > sysctl to 0 a ^G in xterm produces no sound at all. J> J> FYI, Xorg server beeps via xf86OSRingBell(), i.e., J> J> https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xfree86/os-support/bsd/bsd_bell.c#L61 J> J> IOW, if console cannot beep, xterm does not beep. Oh! Thanks for explanation! -- Gleb Smirnoff From nobody Fri Oct 22 14:21:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 03AD117F059C; Fri, 22 Oct 2021 17:26:59 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_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 4HbWVp5lgqz4vCY; Fri, 22 Oct 2021 17:26:58 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from kent.sdaoden.eu (kent.sdaoden.eu [10.5.0.2]) by sdaoden.eu (Postfix) with ESMTPS id AAE4816056; Fri, 22 Oct 2021 19:26:48 +0200 (CEST) Received: by kent.sdaoden.eu (Postfix, from userid 1000) id 4E59B1927; Fri, 22 Oct 2021 16:21:16 +0200 (CEST) Date: Fri, 22 Oct 2021 16:21:16 +0200 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Andriy Gapon Cc: Warner Losh , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211022142116.h0ROX%steffen@sdaoden.eu> In-Reply-To: <718707f9-57e9-057e-1811-f9229f2da9de@FreeBSD.org> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <718707f9-57e9-057e-1811-f9229f2da9de@FreeBSD.org> User-Agent: s-nail v14.9.22-181-g014ab7c7a4 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 4HbWVp5lgqz4vCY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Andriy Gapon wrote in <718707f9-57e9-057e-1811-f9229f2da9de@FreeBSD.org>: |On 21/10/2021 22:52, Warner Losh wrote: ... |> https://twitter.com/bsdimp/status/1451274644439265308 ... |Don't have we have anything better than twitter for such a poll? |Something on FreeBSD infra maybe? I am not a FreeBSD member, but i loved that. It is nice to see FreeBSD names that you know for twenty years and more, ... more often than not you have to open the browser and look in Phabricator to see their names. But they are there! I am sure there are also other FreeBSD fans who would love to have a ML where that storyboard you see on the right is posted in exactly the same format. This would be noisy of course. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From nobody Fri Oct 22 14:14:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 03AFC17F0700; Fri, 22 Oct 2021 17:26:59 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_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 4HbWVp5lftz4v6s; Fri, 22 Oct 2021 17:26:58 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from kent.sdaoden.eu (kent.sdaoden.eu [10.5.0.2]) by sdaoden.eu (Postfix) with ESMTPS id C510016057; Fri, 22 Oct 2021 19:26:48 +0200 (CEST) Received: by kent.sdaoden.eu (Postfix, from userid 1000) id 9A4521924; Fri, 22 Oct 2021 16:14:26 +0200 (CEST) Date: Fri, 22 Oct 2021 16:14:26 +0200 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Shawn Webb Cc: Warner Losh , Alexey Dokuchaev , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211022141426.CQ2u0%steffen@sdaoden.eu> In-Reply-To: <20211022134229.jrkkgahnu6bz2aec@mutt-hbsd> References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <20211022134229.jrkkgahnu6bz2aec@mutt-hbsd> User-Agent: s-nail v14.9.22-181-g014ab7c7a4 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 4HbWVp5lftz4v6s X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Shawn Webb wrote in <20211022134229.jrkkgahnu6bz2aec@mutt-hbsd>: ... |Tangentially related for curious minds: | |Tom Scott did a video in 2014 about how the types of trucks that beep |when reversing are changing from the traditional beep to a white noise |type of beep: https://www.youtube.com/watch?v=fa28lIGuxq8 Oh! This terrible sound, how i hated when German producers adding this!!! And i always asked myself, why didn't they use something more mindful, say Beethoven ta-ta-ta-taam, or something? American trucks could have used something like Dylan's A Hard Rain's gonna fall, or what do i know from American songbook. The thrill is gone maybe, though with that Baldwin accident maybe not so good. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From nobody Fri Oct 22 17:30:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9459517F1411; Fri, 22 Oct 2021 17:30:43 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbWb71lYPz3Bn7; Fri, 22 Oct 2021 17:30:43 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19MHUelL006018 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Oct 2021 10:30:40 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19MHUeO3006017; Fri, 22 Oct 2021 10:30:40 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 22 Oct 2021 10:30:40 -0700 From: Gleb Smirnoff To: Ian Lepore Cc: Alexey Dokuchaev , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <2d9f9df5958cec23b11d6e23e0b20c236db44574.camel@freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d9f9df5958cec23b11d6e23e0b20c236db44574.camel@freebsd.org> X-Rspamd-Queue-Id: 4HbWb71lYPz3Bn7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, Oct 22, 2021 at 10:59:28AM -0600, Ian Lepore wrote: I> On Fri, 2021-10-22 at 06:28 +0000, Alexey Dokuchaev wrote: I> > > Our users aren't so unsophisticated as to be totally swayed by the I> > > choice of wording. I> > I> > This is not how it works Warner, you don't first offer biased poll I> > and then defend skewed results by appealing to observed ratio and I> > how smart your target audience is. I> I> Do you really believe different words would change the result from 4:1 I> against to some number in favor? Of course you don't, you're only I> complaining because your opinion is VERY CLEARLY the minority one. I don't think unbiased wording would affect voting result if we did the vote within developers@FreeBSD.org. But the vote with biased wording was placed on.. hold my beer! ... on TWITTER, the most unbiased platform in the world! So, Warner has 1280 followers and I would claim that many of them are not FreeBSD users, and some probably doesn't have idea what FreeBSD bell problem is. It was retweeted by 7 people, some of whom has hundreds of followers. Given twitter algorithms, the poll may show up even in feed of people who don't follow Warner or retwitters directly. You know, some people love to express their opinion on social media, so why not to click on the poll, to help those FreeBSD guys? To sum up, we are asking semi-random set of people a question charged with a correct answer. What would you expect? -- Gleb Smirnoff From nobody Fri Oct 22 17:31:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 36BFA17F238C; Fri, 22 Oct 2021 17:31:48 +0000 (UTC) (envelope-from glebius@freebsd.org) 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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbWcM6B4Qz3CRb; Fri, 22 Oct 2021 17:31:47 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19MHVjGC006036 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Oct 2021 10:31:45 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19MHVjKY006035; Fri, 22 Oct 2021 10:31:45 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 22 Oct 2021 10:31:45 -0700 From: Gleb Smirnoff To: Warner Losh Cc: Alexey Dokuchaev , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HbWcM6B4Qz3CRb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Warner, sorry for top quoting. I love this email very much :) Can we please improve the tone of the bell? On Thu, Oct 21, 2021 at 10:55:00PM -0600, Warner Losh wrote: W> FreeBSD controls the pitch and duration of the noise. And there's W> at least one bug in it. W> W> It looks like we want 800Hz: W> W> #define VT_BELLPITCH 800 W> W> But we ring the bell with W> W> sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); W> W> which looks almost sane. 1.193182MHz is the clock frequency W> of the IBM PC PIT square wave generator. And normally it's programmed W> by dividing this base clock by the desired clock. So we're passing W> in 1491 into sysbeep. We have a tuneable for the 8254 frequency that W> the PIT uses, so it's a bug that we're ignoring that and hard coding this W> value. W> W> Now, sysbeep is only defined on x86, where this is W> timer_spkr_setfreq(pitch); W> otherwise it's nothing. So, timer_spkr_setfreq looks like: W> freq = i8254_freq / freq; W> outb(TIMER_CNTR2, freq & 0xff); W> outb(TIMER_CNTR2, freq >> 8); W> so this computation means we are actually playing a 1491Hz tone for 50ms. W> You can verify this will be the frequency with any PC speaker tutorial. W> W> This corresponds to no natural note in western music. F#6 is 1480Hz and F6 W> is 1397Hz. So the tone that's generated is a dissonant note. C4 is middle C, W> so this is two octaves higher and a little bit. W> W> Even the 800Hz is between G5 and G5#. Not a great note, but at least W> it's an octave lower. So even the desired beep is dissonant. W> W> Since most people find music pleasing, that makes it objectively annoying. W> A similar analysis for the other common tunings (where A4 is one of 432, W> 436, W> 438, 440 (the most common these days), 442, 444, and 446Hz) yields W> similar results with varying degrees of subtonal dissonance. W> W> Also, 50ms is 1/20th of a second (give of take), which translates to about W> 600 beats per minute, which is annoyingly fast, as any musician would W> tell you. The only saving grace is that it's done only once. W> W> Also, the poll is running 4 to 1 for silence by default. While any bias in W> wording mighthave pushed it a little one way or the other, when it's this W> lopsided it's hard to argue that such bias affected the actual outcome. Our W> users aren't so unsophisticated as to be totally swayed by the choice of W> wording. The reply tweets suggest people know exactly what I'm talking W> about. Iknow it isn't scientific, but it is highly suggestive given the 60 W> point spread. Even had I used differentwording, my followers on twitter W> are self selecting which is likely a biggersource of error, and lord knows W> what Twitter's algorithms do to distort who sees it. And likely a dozen W> other W> factors I've not even thought of. W> W> Warner W> W> P.S. We likely should fix this bug, and also change the note to 880, which W> is W> A5 (the second A above middle C). Please see W> https://reviews.freebsd.org/D32594 W> for a fix for the bug I found here. -- Gleb Smirnoff From nobody Fri Oct 22 17:39:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 49A7817F6361 for ; Fri, 22 Oct 2021 17:39:14 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2c.ore.mailhop.org (outbound2c.ore.mailhop.org [54.186.10.118]) (using TLSv1.3 with cipher TLS_AES_256_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 4HbWmx714Pz3Flr for ; Fri, 22 Oct 2021 17:39:13 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1634924347; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=leVhWN4306UOctocXpnEnjFoasIfqxUXs6efWd5msWk7iz8XSEPY/Bn5f3m7oVPJe/3MIbTeXUVZN c/qH+jCOPtAs1g1qPVvj22+qcD44aQB0ASR2zh4tqKTqmyhpvdWDVuOpa473a1JnmaeCCgQraPl3LI /JRS9d+7rZZWlDfcuhQ9rEwCKFTrGoyaVSLXcMOh06uZIrReIFnaIi+/P9pv2tXLTfkJViPRn9+ROX dLK0SvoEJoxaReHumWP7Ks8mg4Yx0AmIuxOWBYtah5ylFvgHBc5nMYQu8gJyInFCRvEB3WVTLMHW8A McQ12tgDlvrWvG3avM7Ji1e4vwivcZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=2MD/lar3OLMhDchGyO4D7Ab/p2Eded+i7U7HCQb/1Po=; b=A5003Oe23oQr0Qd5bM3xffZSIw3dKguIYSM09iRBqIL2iJM82GwhB/ckZp5TKNGz+2A1cDHqNb0nA f5kMyAbTthnfgPiYyn5hyI3MJ6353KcokZDVYQ53Z1JZZZsrEbq5xxA4w1SBcjYBuk49FOOLfOZOlv 9B6TZ36xQH+QE3vnLruKpQ6N0BUmKP2KPvI1PQ5p0zLvWM3Gye1YaxsEE0q0mbfw7lz2XJIx5Hqx2Q LQNxhBL5epaJ1NPsx7EtagZMgcfCuL3RVasiKSAM/4jPmHFPKOL6hHe9seqXrJa2cU8M81D/dO608u xLNdfP0S6RLyl3/IhC27xYeN+XCoYHA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=2MD/lar3OLMhDchGyO4D7Ab/p2Eded+i7U7HCQb/1Po=; b=iPtbul42lBDZKQO4GTpyKMtx5/IJlbcV/UJFLU7bgjwtrt4IfFmPzsPvBLnVPLPi95clFooOQPV07 3lPP/RlP4CKaFMqlOGkPtq2oFNP+tKFVkGwpUxg0RGjp2gL4uMd5hp9WebzT5tqOmr6rW6O8VjB4mg nTPQs7MLYxPVHk4MZLjHwZ2FiAL2abStAKswCd70QRYHuAxy3IPA+oRAg0M8swb+QGrKjg8+uyIP5m LKDNVWjdVtbUOgoEDau6V421Xn2oPoJtg/8kWOt7RIHePQNrhHpC81N2T/v3tpAnTA3/b9oLV0mAGl 1XzrQibOu9+bc/137TILzJi7sbX9fpg== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: f4009066-335e-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id f4009066-335e-11ec-a67c-89389772cfc7; Fri, 22 Oct 2021 17:39:06 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19MHd5sU083609; Fri, 22 Oct 2021 11:39:05 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default From: Ian Lepore To: Gleb Smirnoff Cc: Alexey Dokuchaev , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Date: Fri, 22 Oct 2021 11:39:05 -0600 In-Reply-To: References: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <2d9f9df5958cec23b11d6e23e0b20c236db44574.camel@freebsd.org> Content-Type: text/plain; charset="ASCII" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbWmx714Pz3Flr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 2021-10-22 at 10:30 -0700, Gleb Smirnoff wrote: > To sum up, we are asking semi-random set of people a question charged > with > a correct answer. What would you expect? I would expect the winning side to rejoice about the poll supporting their position while the losing side whines about the process being the reason for their loss. -- Ian From nobody Fri Oct 22 17:47:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6C4FA18036C2; Fri, 22 Oct 2021 17:47:25 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbWyN5yHGz3JJV; Fri, 22 Oct 2021 17:47:24 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634924837; 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=MS3L86jMWBBrEQK0itcL7Smid7266DiIBpHeqrAB+Fo=; b=uZS/K3t7yaVMVlyn2+CphzadWaWBpvUnXiE8+lLhBKykTXAvhq37j0tVwYmEO9Q5zD8u38 mDadJY422T/RGjzx0otpebwMamlfvonByW6rcLAvBKCYSaJUXy+LmAIKaUpm8MttwlFly3 LKbkm9YDUQfPVOWjbSjLdHLqyItPXW4= Received: from skull.home.blih.net (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 881b6cd2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 22 Oct 2021 17:47:17 +0000 (UTC) Date: Fri, 22 Oct 2021 19:47:17 +0200 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , gljennjohn@gmail.com, Gleb Smirnoff , Slawa Olhovchenkov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> In-Reply-To: <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbWyN5yHGz3JJV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 22 Oct 2021 10:04:15 -0700 (PDT) "Rodney W. Grimes" wrote: > > On Thu, 21 Oct 2021 10:03:05 -0700 > > Gleb Smirnoff wrote: > > > > > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > > > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > > > S> > > > S> This change disable bell in X11 too. > > > S> This is completly disable speaker bell. > > > > > > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. > > > How is that possible that vt(4) affects X11? > > > > > > > He could be right. I don't use vt, but syscons also has a bell setting: > > sysctl -d hw.syscons.bell hw.syscons.bell: enable bell > > > > With this set to 1 a ^G in xterm results in a beep. After setting the > > sysctl to 0 a ^G in xterm produces no sound at all. > > I also suspect that this kills "visual bell" which is a bright > flash of the terminal. There is no visual bell in vt(4) and this doesn't affect xterm*visualBell obviously. But yes this does affect the bell in xterm (and so I guess any other terminal that default to have a bell) but that was also the point of this change. > We need to STOP these "I dont like the 20 year old defaults, > so I am going to change them to what I like and use" It is NOT > forward progress on making a better system, it is tilting at > defaults, very long established defaults, that should probably > just be left alone. It's not "I don't like", it's "We don't like". If we can't change FreeBSD default to what most of our users want I don't know why we're still working on this OS. > I dont like a lot of the defaults on a lot of OS's, I tweak them > to my needs. FreeBSD keeps tweaking things such that I have to > tweak my tweaks to keep things as I see fit. THAT IS A POLA VIOLATION! > > -- > Rod Grimes rgrimes@freebsd.org The future is now, old man -- Emmanuel Vadot From nobody Fri Oct 22 17:53:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AD5EA18064A4; Fri, 22 Oct 2021 17:53:04 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbX4v75g4z3LjK; Fri, 22 Oct 2021 17:53:03 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634925182; 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=E+mock3xlNC9Tl8/vPiVCsbvUl7rNZ3wwvPcejBsjEA=; b=C3OuWPX3grRdhr9LRtarLd32KroFrw8Xux4/6ZN/BMIZkC7S1OgtH7ZCvtPdvpuj01k+YZ pVL6W3i6Y1EFYzbXU/OTsEE2K2+Y7F/yooFWvX7mE+LspCHNTOe4DWJbjdrKMK5wO1W6ND afoFiXjdN5AmWVsDCwuVo2YxP3Z8reo= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 97c38981 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 22 Oct 2021 17:53:02 +0000 (UTC) Date: Fri, 22 Oct 2021 19:53:02 +0200 From: Emmanuel Vadot To: Gleb Smirnoff Cc: Ian Lepore , Alexey Dokuchaev , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211022195302.4470bc13ca02a35a3169e798@bidouilliste.com> In-Reply-To: References: <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <20211021080214.GB77338@zxy.spb.ru> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <2d9f9df5958cec23b11d6e23e0b20c236db44574.camel@freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbX4v75g4z3LjK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 22 Oct 2021 10:30:40 -0700 Gleb Smirnoff wrote: > On Fri, Oct 22, 2021 at 10:59:28AM -0600, Ian Lepore wrote: > I> On Fri, 2021-10-22 at 06:28 +0000, Alexey Dokuchaev wrote: > I> > > Our users aren't so unsophisticated as to be totally swayed by the > I> > > choice of wording. > I> > > I> > This is not how it works Warner, you don't first offer biased poll > I> > and then defend skewed results by appealing to observed ratio and > I> > how smart your target audience is. > I> > I> Do you really believe different words would change the result from 4:1 > I> against to some number in favor? Of course you don't, you're only > I> complaining because your opinion is VERY CLEARLY the minority one. > > I don't think unbiased wording would affect voting result if we did > the vote within developers@FreeBSD.org. But the vote with biased > wording was placed on.. hold my beer! ... on TWITTER, the most unbiased > platform in the world! So, Warner has 1280 followers and I would claim > that many of them are not FreeBSD users, and some probably doesn't > have idea what FreeBSD bell problem is. It was retweeted by 7 people, > some of whom has hundreds of followers. Given twitter algorithms, the > poll may show up even in feed of people who don't follow Warner or > retwitters directly. You know, some people love to express their opinion > on social media, so why not to click on the poll, to help those FreeBSD guys? > To sum up, we are asking semi-random set of people a question charged with > a correct answer. What would you expect? > > -- > Gleb Smirnoff Let's ask our community then : https://discord.com/channels/727023752348434432/757543661058654269/901166071078322267 -- Emmanuel Vadot From nobody Fri Oct 22 17:59:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C88561809489; Fri, 22 Oct 2021 17:59:34 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbXDQ4pVkz3NbX; Fri, 22 Oct 2021 17:59:34 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x530.google.com with SMTP id e19so6036765edy.0; Fri, 22 Oct 2021 10:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=7QVSQ93AHteGVg+oKJfUDZ3loYzwKb4ZiaZTXsXSA/M=; b=egAUYQolaULLSznWVkDQ5zcOb0tan/1OMYv01ciAxU8z5xiQt8hYyX941ByypwSZoV xNiL5Ysc6gWwW8617QDAtc1PldO0WeJIo4Z8vcbRXqI+hGoIANFy++qSgIndenclWZoJ QFDxgv3GHJt3vDXtZeywRc9Wx0OElXyBkhDvC9vZb7m9uXjLpYqdkIoFGnB/NiN3dOT3 StUsIw35bQZrSwIaRK03xa7cobJrS7jcZ7sYCknYdq6ePofA4XNpI05rQd7uiOrBrgai NA13yXhll8Ayb/vW6odu4LojXkdhHmLT9eTWPiep7zDl0M2pO1CIW8cjN8ilDd0xEm/Y CsxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=7QVSQ93AHteGVg+oKJfUDZ3loYzwKb4ZiaZTXsXSA/M=; b=ULcEjR2Z9EDi6j1xvkuVEF0bFrvUBsK/8TyU/cxZrGMirvApVI1oobKYnK7PtnKwJ1 b0umuMHoEZEQ8qAe7rt1x0zejDs7oYuQwgW+oPiJxtT63jLCjA/D9dWUEafWdTXvguCi 2kkw3wdFF6dbspWBP0mTzzOw4ADa6FmafZoHXeOMSuRQUHtAaTY8mTMEiTLu5YwRghEv OpVDtOAbg+gldvwXc2aNJMIn6IUACxbjq87y784kr/GW2BexZ4LebSdyX7WcllKEEUdw wJhhczfC5ctN09pk4VgBvfwNLJK8BqSF0Hw2j2AXse12WNftWqm3uYRCCqI1v4I06Ji2 Ch7g== X-Gm-Message-State: AOAM531S4XqLtlF3z8rchmyEoDqlfxkKkIBC50ZwxMMy68ZOWVqBthgg dZAdE7KH14dCbZeN2N5ZLEY= X-Google-Smtp-Source: ABdhPJytCSbFwvQNmCwEacvnElkz2VcB+C7EL+kAbOhfSNtUQ3lIyLrU+UeSN4aH0nfJsvOGzmS5hw== X-Received: by 2002:aa7:da16:: with SMTP id r22mr1971374eds.75.1634925573657; Fri, 22 Oct 2021 10:59:33 -0700 (PDT) Received: from ernst.home (p5b3becad.dip0.t-ipconnect.de. [91.59.236.173]) by smtp.gmail.com with ESMTPSA id go33sm1140088ejc.120.2021.10.22.10.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:59:32 -0700 (PDT) Date: Fri, 22 Oct 2021 19:59:29 +0200 From: Gary Jennejohn To: "Rodney W. Grimes" Cc: rgrimes@freebsd.org, Gleb Smirnoff , Slawa Olhovchenkov , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <20211022195929.4e25c1d0@ernst.home> In-Reply-To: <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HbXDQ4pVkz3NbX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 22 Oct 2021 10:04:15 -0700 (PDT) "Rodney W. Grimes" wrote: > > On Thu, 21 Oct 2021 10:03:05 -0700 > > Gleb Smirnoff wrote: > > > > > On Thu, Oct 21, 2021 at 11:02:14AM +0300, Slawa Olhovchenkov wrote: > > > S> > laptops. If somebody is using vt(4) instead of X on a laptop, then > > > S> > > > S> This change disable bell in X11 too. > > > S> This is completly disable speaker bell. > > > > > > Are you sure? I haven't yet upgraded my desktop to this point, so can't test. > > > How is that possible that vt(4) affects X11? > > > > > > > He could be right. I don't use vt, but syscons also has a bell setting: > > sysctl -d hw.syscons.bell hw.syscons.bell: enable bell > > > > With this set to 1 a ^G in xterm results in a beep. After setting the > > sysctl to 0 a ^G in xterm produces no sound at all. > > I also suspect that this kills "visual bell" which is a bright > flash of the terminal. > Yes, it does. I use mrxvt, which is set up to use a visual bell. With the syscons bell sysctl set to 0 there's no visual bell. As jkim@ explained in his reply, if the console can't beep then Xorg also can't beep/flash, irregardless of whether it's vt or syscons. > We need to STOP these "I dont like the 20 year old defaults, > so I am going to change them to what I like and use" It is NOT > forward progress on making a better system, it is tilting at > defaults, very long established defaults, that should probably > just be left alone. > > I dont like a lot of the defaults on a lot of OS's, I tweak them > to my needs. FreeBSD keeps tweaking things such that I have to > tweak my tweaks to keep things as I see fit. THAT IS A POLA VIOLATION! > -- Gary Jennejohn From nobody Fri Oct 22 18:27:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E42E318161C8; Fri, 22 Oct 2021 18:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbXrW5zK2z3mhH; Fri, 22 Oct 2021 18:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACD8713B13; Fri, 22 Oct 2021 18:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MIRNt2005897; Fri, 22 Oct 2021 18:27:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MIRNvQ005896; Fri, 22 Oct 2021 18:27:23 GMT (envelope-from git) Date: Fri, 22 Oct 2021 18:27:23 GMT Message-Id: <202110221827.19MIRNvQ005896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: fba15546837f - stable/13 - Mark sppp(4) as gone in FreeBSD 14. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: fba15546837fe7285a15487a3fee93e551dc5be2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=fba15546837fe7285a15487a3fee93e551dc5be2 commit fba15546837fe7285a15487a3fee93e551dc5be2 Author: Gleb Smirnoff AuthorDate: 2021-10-22 18:27:00 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-22 18:27:00 +0000 Mark sppp(4) as gone in FreeBSD 14. --- sbin/spppcontrol/spppcontrol.8 | 10 +++++++++- share/man/man4/ng_sppp.4 | 8 +++++++- share/man/man4/sppp.4 | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sbin/spppcontrol/spppcontrol.8 b/sbin/spppcontrol/spppcontrol.8 index 4d948a60651a..b92ca4a883c9 100644 --- a/sbin/spppcontrol/spppcontrol.8 +++ b/sbin/spppcontrol/spppcontrol.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2001 +.Dd October 22, 2021 .Dt SPPPCONTROL 8 .Os .Sh NAME @@ -36,6 +36,14 @@ .Ar ifname .Op Ar parameter Ns Op Li = Ns Ar value .Op Ar ... +.Sh DEPRECATION NOTICE +The +.Xr sppp 4 +module and the +.Nm +utility is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Xr sppp 4 diff --git a/share/man/man4/ng_sppp.4 b/share/man/man4/ng_sppp.4 index 685d45f1500e..8ca493ce4008 100644 --- a/share/man/man4/ng_sppp.4 +++ b/share/man/man4/ng_sppp.4 @@ -12,7 +12,7 @@ .\" Cronyx Id: ng_sppp.4,v 1.1.2.3 2004/03/30 14:28:34 rik Exp $ .\" $FreeBSD$ .\" -.Dd February 3, 2005 +.Dd October 22, 2021 .Dt NG_SPPP 4 .Os .Sh NAME @@ -20,6 +20,12 @@ .Nd sppp netgraph node type .Sh SYNOPSIS .In netgraph/ng_sppp.h +.Sh DEPRECATION NOTICE +The +.Nm +module is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION An .Nm sppp diff --git a/share/man/man4/sppp.4 b/share/man/man4/sppp.4 index 0420bb45ab80..585459b6d6c0 100644 --- a/share/man/man4/sppp.4 +++ b/share/man/man4/sppp.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 25, 2008 +.Dd October 22, 2021 .Dt SPPP 4 .Os .Sh NAME @@ -33,6 +33,12 @@ .Nd point to point protocol network layer for synchronous lines .Sh SYNOPSIS .Cd "device sppp" +.Sh DEPRECATION NOTICE +The +.Nm +module is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm From nobody Fri Oct 22 18:41:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7EFC5181C2F2; Fri, 22 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbY9K37dVz3rtV; Fri, 22 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B76414099; Fri, 22 Oct 2021 18:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MIfvLt029122; Fri, 22 Oct 2021 18:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MIfvqY029121; Fri, 22 Oct 2021 18:41:57 GMT (envelope-from git) Date: Fri, 22 Oct 2021 18:41:57 GMT Message-Id: <202110221841.19MIfvqY029121@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: 6aae3517ed25 - main - Retire synchronous PPP kernel driver sppp(4). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 6aae3517ed2500fb963ba0a4264b4756088dd0f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6aae3517ed2500fb963ba0a4264b4756088dd0f4 commit 6aae3517ed2500fb963ba0a4264b4756088dd0f4 Author: Gleb Smirnoff AuthorDate: 2021-10-21 04:08:13 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-22 18:41:36 +0000 Retire synchronous PPP kernel driver sppp(4). The last two drivers that required sppp are cp(4) and ce(4). These devices are still produced and can be purchased at Cronyx . Since Roman Kurakin has quit them, they no longer support FreeBSD officially. Later they have dropped support for Linux drivers to. As of mid-2020 they don't even have a developer to maintain their Windows driver. However, their support verbally told me that they could provide aid to a FreeBSD developer with documentaion in case if there appears a new customer for their devices. These drivers have a feature to not use sppp(4) and create an interface, but instead expose the device as netgraph(4) node. Then, you can attach ng_ppp(4) with help of ports/net/mpd5 on top of the node and get your synchronous PPP. Alternatively you can attach ng_frame_relay(4) or ng_cisco(4) for HDLC. Actually, last time I used cp(4) back in 2004, using netgraph(4) instead of sppp(4) was already the right way to do. Thus, remove the sppp(4) related part of the drivers and enable by default the negraph(4) part. Further maintenance of these drivers in the tree shouldn't be a big deal. While doing that, remove some cruft and enable cp(4) compilation on amd64. The ce(4) for some unknown reason marks its internal DDK functions with __attribute__ fastcall, which most likely is safe to remove, but without hardware I'm not going to do that, so ce(4) remains i386-only. Reviewed by: emaste, imp, donner Differential Revision: https://reviews.freebsd.org/D32590 See also: https://reviews.freebsd.org/D23928 --- ObsoleteFiles.inc | 11 + UPDATING | 5 + lib/libc/net/getnameinfo.c | 2 +- lib/libnetgraph/debug.c | 2 - libexec/rc/netstart | 1 - libexec/rc/rc.conf | 6 - libexec/rc/rc.d/Makefile | 1 - libexec/rc/rc.d/netif | 2 +- libexec/rc/rc.d/sppp | 37 - rescue/rescue/Makefile | 2 +- sbin/Makefile | 1 - sbin/sconfig/sconfig.8 | 5 - sbin/spppcontrol/Makefile | 9 - sbin/spppcontrol/Makefile.depend | 17 - sbin/spppcontrol/spppcontrol.8 | 275 -- sbin/spppcontrol/spppcontrol.c | 266 -- share/man/man4/Makefile | 2 - share/man/man4/man4.i386/ce.4 | 44 +- share/man/man4/man4.i386/cp.4 | 44 +- share/man/man4/netgraph.4 | 1 - share/man/man4/ng_sppp.4 | 172 - share/man/man4/sppp.4 | 238 -- share/man/man5/rc.conf.5 | 15 - sys/conf/NOTES | 5 - sys/conf/files | 6 +- sys/conf/files.i386 | 3 - sys/conf/files.x86 | 3 + sys/conf/options.i386 | 3 - sys/dev/ce/if_ce.c | 328 +- sys/dev/ce/ng_ce.h | 4 - sys/{i386/include => dev/cp}/cserial.h | 0 sys/dev/cp/if_cp.c | 316 +- sys/dev/cp/ng_cp.h | 4 - sys/i386/conf/NOTES | 9 +- sys/modules/Makefile | 2 - sys/modules/ce/Makefile | 21 +- sys/modules/cp/Makefile | 21 +- sys/modules/netgraph/Makefile | 1 - sys/modules/netgraph/sppp/Makefile | 7 - sys/modules/sppp/Makefile | 18 - sys/net/if_sppp.h | 234 -- sys/net/if_spppfr.c | 611 ---- sys/net/if_spppsubr.c | 5418 ------------------------------- sys/netgraph/ng_sppp.c | 411 --- sys/netgraph/ng_sppp.h | 39 - sys/x86/conf/NOTES | 5 + targets/pseudo/userland/Makefile.depend | 1 - 47 files changed, 71 insertions(+), 8557 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7c5e534d21d4..b6a2d299bc8c 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20211022 +OLD_FILES+=sbin/spppcontrol +.if ${TARGET_ARCH} == "i386" +OLD_FILES+=usr/include/machine/cserial.h +.endif +OLD_FILES+=usr/include/net/if_sppp.h +OLD_FILES+=usr/include/netgraph/ng_sppp.h +OLD_FILES+=usr/share/man/man4/ng_sppp.4.gz +OLD_FILES+=usr/share/man/man4/sppp.4.gz +OLD_FILES+=usr/share/man/man8/spppcontrol.8.gz + # 20210929: OLD_FILES+=usr/sbin/hcseriald OLD_FILES+=usr/share/man/man8/hcseriald.8.gz diff --git a/UPDATING b/UPDATING index 8028c5f192cb..765722b62617 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20211022: + The synchronous PPP kernel driver sppp(4) has been removed. + The cp(4) and ce(4) drivers are now always compiled with netgraph(4) + support, formerly enabled by NETGRAPH_CRONYX option. + 20211020: sh(1) is now the default shell for the root user. To force root to use the csh shell, please run the following command as root: diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c index ad54920aa793..b72734e56ed3 100644 --- a/lib/libc/net/getnameinfo.c +++ b/lib/libc/net/getnameinfo.c @@ -467,7 +467,7 @@ getnameinfo_link(const struct afd *afd, * The following have zero-length addresses. * IFT_GIF (net/if_gif.c) * IFT_LOOP (net/if_loop.c) - * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c) + * IFT_PPP (net/if_tuntap.c) * IFT_SLIP (net/if_sl.c, net/if_strip.c) * IFT_STF (net/if_stf.c) * IFT_L2VLAN (net/if_vlan.c) diff --git a/lib/libnetgraph/debug.c b/lib/libnetgraph/debug.c index f44504140b8b..513d3350760d 100644 --- a/lib/libnetgraph/debug.c +++ b/lib/libnetgraph/debug.c @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -172,7 +171,6 @@ static const struct ng_cookie cookies[] = { COOKIE(SOCKET), COOKIE(SOURCE), COOKIE(SPLIT), - COOKIE(SPPP), COOKIE(TAG), COOKIE(TCPMSS), COOKIE(TEE), diff --git a/libexec/rc/netstart b/libexec/rc/netstart index fa4ce382e4ff..d40ee05edd4d 100755 --- a/libexec/rc/netstart +++ b/libexec/rc/netstart @@ -43,7 +43,6 @@ _start=quietstart /etc/rc.d/ipfilter ${_start} /etc/rc.d/ipnat ${_start} /etc/rc.d/ipfs ${_start} -/etc/rc.d/sppp ${_start} /etc/rc.d/netif ${_start} /etc/rc.d/ipsec ${_start} /etc/rc.d/ppp ${_start} diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 6f4a3a1eb3f3..0cfee2d9c194 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -262,12 +262,6 @@ cloned_interfaces="" # List of cloned network interfaces to create. # #autobridge_interfaces="bridge0" # List of bridges to check #autobridge_bridge0="tap* vlan0" # Interface glob to automatically add to the bridge -# -# If you have any sppp(4) interfaces above, you might also want to set -# the following parameters. Refer to spppcontrol(8) for their meaning. -sppp_interfaces="" # List of sppp interfaces. -#sppp_interfaces="...0" # example: sppp over ... -#spppconfig_...0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'" # User ppp configuration. ppp_enable="NO" # Start user-ppp (or NO). diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 5981b3b03d17..4c7267552526 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -96,7 +96,6 @@ CONFS= DAEMON \ savecore \ securelevel \ serial \ - sppp \ statd \ static_arp \ static_ndp \ diff --git a/libexec/rc/rc.d/netif b/libexec/rc/rc.d/netif index 3dbb3e1a9588..ae30299bfc52 100755 --- a/libexec/rc/rc.d/netif +++ b/libexec/rc/rc.d/netif @@ -26,7 +26,7 @@ # # PROVIDE: netif -# REQUIRE: FILESYSTEMS iovctl serial sppp sysctl +# REQUIRE: FILESYSTEMS iovctl serial sysctl # REQUIRE: hostid # KEYWORD: nojailvnet diff --git a/libexec/rc/rc.d/sppp b/libexec/rc/rc.d/sppp deleted file mode 100755 index b6b02876d4fe..000000000000 --- a/libexec/rc/rc.d/sppp +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# - -# PROVIDE: sppp -# REQUIRE: root -# BEFORE: netif -# KEYWORD: nojail - -. /etc/rc.subr - -name="sppp" -desc="Point to point protocol network layer for synchronous lines" -start_cmd="sppp_start" -stop_cmd=":" - -sppp_start() -{ - # Special options for sppp(4) interfaces go here. These need - # to go _before_ the general ifconfig since in the case - # of hardwired (no link1 flag) but required authentication, you - # cannot pass auth parameters down to the already running interface. - # - for ifn in ${sppp_interfaces}; do - eval spppcontrol_args=\$spppconfig_${ifn} - if [ -n "${spppcontrol_args}" ]; then - # The auth secrets might contain spaces; in order - # to retain the quotation, we need to eval them - # here. - eval spppcontrol ${ifn} ${spppcontrol_args} - fi - done -} - -load_rc_config $name -run_rc_command "$1" diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 42094340e768..90aaea3cb709 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -101,7 +101,7 @@ CRUNCH_PROGS_sbin= \ mount_udf mount_unionfs newfs \ newfs_msdos nos-tun ping reboot \ restore rcorder route savecore \ - shutdown spppcontrol swapon sysctl tunefs umount + shutdown swapon sysctl tunefs umount .if ${MK_CCD} != "no" CRUNCH_PROGS_sbin+= ccdconfig diff --git a/sbin/Makefile b/sbin/Makefile index 6d6b647651ad..ade73fc8b0ee 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -63,7 +63,6 @@ SUBDIR=adjkerntz \ savecore \ setkey \ shutdown \ - spppcontrol \ swapon \ sysctl \ tunefs \ diff --git a/sbin/sconfig/sconfig.8 b/sbin/sconfig/sconfig.8 index 713f76d88c9d..a55bf911e3dd 100644 --- a/sbin/sconfig/sconfig.8 +++ b/sbin/sconfig/sconfig.8 @@ -216,9 +216,6 @@ Select the Frame Relay synchronous protocol T1.617 Annex D). .It Cm ppp Select the synchronous PPP protocol. -PPP parameters can be configured using the -.Xr spppcontrol 8 -utility. .It Sm Cm keepalive No = Bro Cm on , off Brc Sm Turn on/off transmission of keepalive messages. This option is used only for synchronous PPP. @@ -569,10 +566,8 @@ Test error (G.703 only). .Sh SEE ALSO .Xr stty 1 , .Xr ioctl 2 , -.Xr sppp 4 , .Xr ifconfig 8 , .Xr route 8 , -.Xr spppcontrol 8 .\"-------------------------------------------------------------- .Sh HISTORY The diff --git a/sbin/spppcontrol/Makefile b/sbin/spppcontrol/Makefile deleted file mode 100644 index 04173201cfde..000000000000 --- a/sbin/spppcontrol/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -PACKAGE= ppp - -PROG= spppcontrol -MAN= spppcontrol.8 -WARNS?= 2 - -.include diff --git a/sbin/spppcontrol/Makefile.depend b/sbin/spppcontrol/Makefile.depend deleted file mode 100644 index 6cfaab1c3644..000000000000 --- a/sbin/spppcontrol/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sbin/spppcontrol/spppcontrol.8 b/sbin/spppcontrol/spppcontrol.8 deleted file mode 100644 index 4d948a60651a..000000000000 --- a/sbin/spppcontrol/spppcontrol.8 +++ /dev/null @@ -1,275 +0,0 @@ -.\" Copyright (C) 1997, 2001 by Joerg Wunsch, Dresden -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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. -.\" -.\" $FreeBSD$ -.\" -.Dd December 30, 2001 -.Dt SPPPCONTROL 8 -.Os -.Sh NAME -.Nm spppcontrol -.Nd display or set parameters for an sppp interface -.Sh SYNOPSIS -.Nm -.Op Fl v -.Ar ifname -.Op Ar parameter Ns Op Li = Ns Ar value -.Op Ar ... -.Sh DESCRIPTION -The -.Xr sppp 4 -driver might require a number of additional arguments or optional -parameters besides the settings that can be adjusted with -.Xr ifconfig 8 . -These are things like authentication protocol parameters, but also -other tunable configuration variables. -The -.Nm -utility can be used to display the current settings, or adjust these -parameters as required. -.Pp -For whatever intent -.Nm -is being called, at least the parameter -.Ar ifname -needs to be specified, naming the interface for which the settings -are to be performed or displayed. -Use -.Xr ifconfig 8 , -or -.Xr netstat 1 -to see which interfaces are available. -.Pp -If no other parameter is given, -.Nm -will just list the current settings for -.Ar ifname -and exit. -The reported settings include the current PPP phase the -interface is in, which can be one of the names -.Em dead , -.Em establish , -.Em authenticate , -.Em network , -or -.Em terminate . -If an authentication protocol is configured for the interface, the -name of the protocol to be used, as well as the system name to be used -or expected will be displayed, plus any possible options to the -authentication protocol if applicable. -Note that the authentication -secrets (sometimes also called -.Em keys ) -are not being returned by the underlying system call, and are thus not -displayed. -.Pp -If any additional parameter is supplied, superuser privileges are -required, and the command works in the -.Dq set -mode. -This is normally done quietly, unless the option -.Fl v -is also enabled, which will cause a final printout of the settings as -described above once all other actions have been taken. -Use of this -mode will be rejected if the interface is currently in any other phase -than -.Em dead . -Note that you can force an interface into -.Em dead -phase by calling -.Xr ifconfig 8 -with the parameter -.Cm down . -.Pp -The currently supported parameters include: -.Bl -tag -offset indent -width indent -.It Va authproto Ns Li = Ns Ar protoname -Set both, his and my authentication protocol to -.Ar protoname . -The protocol name can be one of -.Dq Li chap , -.Dq Li pap , -or -.Dq Li none . -In the latter case, the use of an authentication protocol will be -turned off for the named interface. -This has the side-effect of -clearing the other authentication-related parameters for this -interface as well (i.e., system name and authentication secret will -be forgotten). -.It Va myauthproto Ns Li = Ns Ar protoname -Same as above, but only for my end of the link. -I.e., this is the -protocol when remote is authenticator, and I am the peer required to -authenticate. -.It Va hisauthproto Ns Li = Ns Ar protoname -Same as above, but only for his end of the link. -.It Va myauthname Ns Li = Ns Ar name -Set my system name for the authentication protocol. -.It Va hisauthname Ns Li = Ns Ar name -Set his system name for the authentication protocol. -For CHAP, this -will only be used as a hint, causing a warning message if remote did -supply a different name. -For PAP, it is the name remote must use to -authenticate himself (in connection with his secret). -.It Va myauthsecret Ns Li = Ns Ar secret -Set my secret (key, password) for use in the authentication phase. -For CHAP, this will be used to compute the response hash value, based -on remote's challenge. -For PAP, it will be transmitted as plain text -together with the system name. -Do not forget to quote the secrets from -the shell if they contain shell metacharacters (or white space). -.It Va myauthkey Ns Li = Ns Ar secret -Same as above. -.It Va hisauthsecret Ns Li = Ns Ar secret -Same as above, to be used if we are an authenticator and the remote peer -needs to authenticate. -.It Va hisauthkey Ns Li = Ns Va secret -Same as above. -.It Va callin -Require remote to authenticate himself only when he is calling in, but -not when we are caller. -This is required for some peers that do not -implement the authentication protocols symmetrically (like Ascend -routers, for example). -.It Va always -The opposite of -.Va callin . -Require remote to always authenticate, regardless of which side is -placing the call. -This is the default, and will not be explicitly -displayed in the -.Dq list -mode. -.It Va norechallenge -Only meaningful with CHAP. -Do not re-challenge peer once the initial -CHAP handshake was successful. -Used to work around broken peer -implementations that cannot grok being re-challenged once the -connection is up. -.It Ar rechallenge -With CHAP, send re-challenges at random intervals while the connection -is in network phase. -(The intervals are currently in the range of 300 -through approximately 800 seconds.) -This is the default, and will not -be explicitly displayed in the -.Dq list -mode. -.It Va lcp-timeout Ns Li = Ns Ar timeout-value -Allows to change the value of the LCP restart timer. -Values are -specified in milliseconds. -The value must be between 10 and 20000 ms, -defaulting to 3000 ms. -.It Va enable-vj -Enable negotiation of Van Jacobsen header compression. -(Enabled by default.) -.It Va disable-vj -Disable negotiation of Van Jacobsen header compression. -.It Va enable-ipv6 -Enable negotiation of the IPv6 network control protocol. -(Enabled by default if the kernel has IPv6 enabled.) -.It Va disable-ipv6 -Disable negotiation of the IPv6 network control protocol. -Since every -IPv4 interface in an IPv6-enabled kernel automatically gets an IPv6 -address assigned, this option provides for a way to administratively -prevent the link from attempting to negotiate IPv6. -Note that -initialization of an IPv6 interface causes a multicast packet to be -sent, which can cause unwanted traffic costs (for dial-on-demand -interfaces). -.El -.Sh EXAMPLES -.Bd -literal -# spppcontrol bppp0 -bppp0: phase=dead - myauthproto=chap myauthname="uriah" - hisauthproto=chap hisauthname="ifb-gw" norechallenge - lcp-timeout=3000 - enable-vj - enable-ipv6 -.Ed -.Pp -Display the settings for -.Li bppp0 . -The interface is currently in -.Em dead -phase, i.e., the LCP layer is down, and no traffic is possible. -Both -ends of the connection use the CHAP protocol, my end tells remote the -system name -.Dq Li uriah , -and remote is expected to authenticate by the name -.Dq Li ifb-gw . -Once the initial CHAP handshake was successful, no further CHAP -challenges will be transmitted. -There are supposedly some known CHAP -secrets for both ends of the link which are not being shown. -.Bd -literal -# spppcontrol bppp0 \e - authproto=chap \e - myauthname=uriah myauthsecret='some secret' \e - hisauthname=ifb-gw hisauthsecret='another' \e - norechallenge -.Ed -.Pp -A possible call to -.Nm -that could have been used to bring the interface into the state shown -by the previous example. -.Sh SEE ALSO -.Xr netstat 1 , -.Xr sppp 4 , -.Xr ifconfig 8 -.Rs -.%A B. Lloyd -.%A W. Simpson -.%T "PPP Authentication Protocols" -.%O RFC 1334 -.Re -.Rs -.%A W. Simpson, Editor -.%T "The Point-to-Point Protocol (PPP)" -.%O RFC 1661 -.Re -.Rs -.%A W. Simpson -.%T "PPP Challenge Handshake Authentication Protocol (CHAP)" -.%O RFC 1994 -.Re -.Sh HISTORY -The -.Nm -utility appeared in -.Fx 3.0 . -.Sh AUTHORS -The program was written by -.An J\(:org Wunsch , -Dresden. diff --git a/sbin/spppcontrol/spppcontrol.c b/sbin/spppcontrol/spppcontrol.c deleted file mode 100644 index e56310c635e9..000000000000 --- a/sbin/spppcontrol/spppcontrol.c +++ /dev/null @@ -1,266 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1997, 2001 Joerg Wunsch - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -static void usage(void); -void print_vals(const char *ifname, struct spppreq *sp); -const char *phase_name(enum ppp_phase phase); -const char *proto_name(u_short proto); -const char *authflags(u_short flags); - -#define PPP_PAP 0xc023 -#define PPP_CHAP 0xc223 - -int -main(int argc, char **argv) -{ - int s, c; - int errs = 0, verbose = 0; - size_t off; - long to; - char *endp; - const char *ifname, *cp; - struct ifreq ifr; - struct spppreq spr; - - while ((c = getopt(argc, argv, "v")) != -1) - switch (c) { - case 'v': - verbose++; - break; - - default: - errs++; - break; - } - argv += optind; - argc -= optind; - - if (errs || argc < 1) - usage(); - - ifname = argv[0]; - strncpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); - - /* use a random AF to create the socket */ - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - err(EX_UNAVAILABLE, "ifconfig: socket"); - - argc--; - argv++; - - spr.cmd = (uintptr_t) SPPPIOGDEFS; - ifr.ifr_data = (caddr_t)&spr; - - if (ioctl(s, SIOCGIFGENERIC, &ifr) == -1) - err(EX_OSERR, "SIOCGIFGENERIC(SPPPIOGDEFS)"); - - if (argc == 0) { - /* list only mode */ - print_vals(ifname, &spr); - return 0; - } - -#define startswith(s) strncmp(argv[0], s, (off = strlen(s))) == 0 - - while (argc > 0) { - if (startswith("authproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("myauthproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.myauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.myauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.myauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("myauthname=")) - strncpy(spr.defs.myauth.name, argv[0] + off, - AUTHNAMELEN); - else if (startswith("myauthsecret=") || - startswith("myauthkey=")) - strncpy(spr.defs.myauth.secret, argv[0] + off, - AUTHKEYLEN); - else if (startswith("hisauthproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.hisauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.hisauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.hisauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("hisauthname=")) - strncpy(spr.defs.hisauth.name, argv[0] + off, - AUTHNAMELEN); - else if (startswith("hisauthsecret=") || - startswith("hisauthkey=")) - strncpy(spr.defs.hisauth.secret, argv[0] + off, - AUTHKEYLEN); - else if (strcmp(argv[0], "callin") == 0) - spr.defs.hisauth.flags |= AUTHFLAG_NOCALLOUT; - else if (strcmp(argv[0], "always") == 0) - spr.defs.hisauth.flags &= ~AUTHFLAG_NOCALLOUT; - else if (strcmp(argv[0], "norechallenge") == 0) - spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE; - else if (strcmp(argv[0], "rechallenge") == 0) - spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE; - else if (startswith("lcp-timeout=")) { - cp = argv[0] + off; - to = strtol(cp, &endp, 10); - if (*cp == '\0' || *endp != '\0' || - /* - * NB: 10 ms is the minimal possible value for - * hz=100. We assume no kernel has less clock - * frequency than that... - */ - to < 10 || to > 20000) - errx(EX_DATAERR, "bad lcp timeout value: %s", - cp); - spr.defs.lcp.timeout = to; - } else if (strcmp(argv[0], "enable-vj") == 0) - spr.defs.enable_vj = 1; - else if (strcmp(argv[0], "disable-vj") == 0) - spr.defs.enable_vj = 0; - else if (strcmp(argv[0], "enable-ipv6") == 0) - spr.defs.enable_ipv6 = 1; - else if (strcmp(argv[0], "disable-ipv6") == 0) - spr.defs.enable_ipv6 = 0; - else - errx(EX_DATAERR, "bad parameter: \"%s\"", argv[0]); - - argv++; - argc--; - } - - spr.cmd = (uintptr_t)SPPPIOSDEFS; - - if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1) - err(EX_OSERR, "SIOCSIFGENERIC(SPPPIOSDEFS)"); - - if (verbose) - print_vals(ifname, &spr); - - return 0; -} - -static void -usage(void) -{ - fprintf(stderr, "%s\n%s\n", - "usage: spppcontrol [-v] ifname [{my|his}auth{proto|name|secret}=...]", - " spppcontrol [-v] ifname callin|always"); - exit(EX_USAGE); -} - -void -print_vals(const char *ifname, struct spppreq *sp) -{ - printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase)); - if (sp->defs.myauth.proto) { - printf("\tmyauthproto=%s myauthname=\"%.*s\"\n", - proto_name(sp->defs.myauth.proto), - AUTHNAMELEN, sp->defs.myauth.name); - } - if (sp->defs.hisauth.proto) { - printf("\thisauthproto=%s hisauthname=\"%.*s\"%s\n", - proto_name(sp->defs.hisauth.proto), - AUTHNAMELEN, sp->defs.hisauth.name, - authflags(sp->defs.hisauth.flags)); - } - printf("\tlcp-timeout=%d ms\n", sp->defs.lcp.timeout); - printf("\t%sable-vj\n", sp->defs.enable_vj? "en": "dis"); - printf("\t%sable-ipv6\n", sp->defs.enable_ipv6? "en": "dis"); -} - -const char * -phase_name(enum ppp_phase phase) -{ - switch (phase) { - case PHASE_DEAD: return "dead"; - case PHASE_ESTABLISH: return "establish"; - case PHASE_TERMINATE: return "terminate"; - case PHASE_AUTHENTICATE: return "authenticate"; - case PHASE_NETWORK: return "network"; - } - return "illegal"; -} - -const char * -proto_name(u_short proto) -{ - static char buf[12]; - switch (proto) { - case PPP_PAP: return "pap"; - case PPP_CHAP: return "chap"; - } - sprintf(buf, "0x%x", (unsigned)proto); - return buf; -} - -const char * -authflags(u_short flags) -{ - static char buf[30]; - buf[0] = '\0'; - if (flags & AUTHFLAG_NOCALLOUT) - strcat(buf, " callin"); - if (flags & AUTHFLAG_NORECHALLENGE) - strcat(buf, " norechallenge"); - return buf; -} diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index af3ad94c9e2e..e2f68f619f37 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -379,7 +379,6 @@ MAN= aac.4 \ ng_socket.4 \ ng_source.4 \ ng_split.4 \ - ng_sppp.4 \ ng_sscfu.4 \ ng_sscop.4 \ ng_tag.4 \ @@ -529,7 +528,6 @@ MAN= aac.4 \ spigen.4 \ ${_spkr.4} \ splash.4 \ - sppp.4 \ ste.4 \ stf.4 \ stge.4 \ diff --git a/share/man/man4/man4.i386/ce.4 b/share/man/man4/man4.i386/ce.4 index 531904fd539c..451f9fb22da0 100644 --- a/share/man/man4/man4.i386/ce.4 +++ b/share/man/man4/man4.i386/ce.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2006 +.Dd October 22, 2021 .Dt CE 4 i386 .Os .Sh NAME @@ -44,29 +44,19 @@ module at boot time, place the following line in .Bd -literal -offset indent if_ce_load="YES" .Ed -.Pp -Additional options: -.Cd "device sppp" -.Cd "options NETGRAPH" -.Cd "options NETGRAPH_CRONYX" .Sh DESCRIPTION The .Nm -driver needs either -.Xr sppp 4 -or -.Xr netgraph 4 . -Which one to use is determined by the -.Dv NETGRAPH_CRONYX -option. -If this option is present in your kernel configuration file, the -.Nm -driver will be compiled with +driver creates a .Xr netgraph 4 -support. -Otherwise, it will be compiled with -.Xr sppp 4 -support. +node for each device found. +The node is usually paired with +.Xr ng_async 4 , +.Xr ng_cisco 4 , +.Xr ng_frame_relay 4 +or with +.Xr ng_ppp 4 +under control of net/mpd5 port. .Pp Refer to .Xr sconfig 8 @@ -89,12 +79,8 @@ with 32 HDLC channels. .El .Sh SEE ALSO .Xr cp 4 , -.Xr ctau 4 , -.Xr cx 4 , -.Xr sppp 4 , -.Xr ifconfig 8 , -.Xr sconfig 8 , -.Xr spppcontrol 8 *** 8694 LINES SKIPPED *** From nobody Fri Oct 22 19:20:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3449E1804FBB; Fri, 22 Oct 2021 19:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbZ1v0sFCz4WRw; Fri, 22 Oct 2021 19:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2E641453E; Fri, 22 Oct 2021 19:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MJKYgA080743; Fri, 22 Oct 2021 19:20:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MJKY99080742; Fri, 22 Oct 2021 19:20:34 GMT (envelope-from git) Date: Fri, 22 Oct 2021 19:20:34 GMT Message-Id: <202110221920.19MJKY99080742@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: 70f51f0e474f - main - Revert "Handle partial reads in zfs_read" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70f51f0e474ffe1fb74cb427423a2fba3637544d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=70f51f0e474ffe1fb74cb427423a2fba3637544d commit 70f51f0e474ffe1fb74cb427423a2fba3637544d Author: Mark Johnston AuthorDate: 2021-10-22 18:55:14 +0000 Commit: Mark Johnston CommitDate: 2021-10-22 19:16:42 +0000 Revert "Handle partial reads in zfs_read" This reverts commit 59eab1093a361ca76849ca76b2ec079c8736e8e3. The change suppressed EFAULT originating from uiomove(). The deadlock avoidance mechanism implemented by vn_io_fault1() in the VFS handles such errors by wiring the user pages and retrying, but this change caused read() to return early instead. This can result in short I/O, causing misbehaviour in some applications, and possibly other consequences. Until this is resolved somehow, revert the commit. Approved by: mm --- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c index 9bd75c011ef9..8229bc9a93e5 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c @@ -254,7 +254,6 @@ zfs_read(struct znode *zp, zfs_uio_t *uio, int ioflag, cred_t *cr) } ASSERT(zfs_uio_offset(uio) < zp->z_size); - ssize_t start_offset = zfs_uio_offset(uio); ssize_t n = MIN(zfs_uio_resid(uio), zp->z_size - zfs_uio_offset(uio)); ssize_t start_resid = n; @@ -277,13 +276,6 @@ zfs_read(struct znode *zp, zfs_uio_t *uio, int ioflag, cred_t *cr) /* convert checksum errors into IO errors */ if (error == ECKSUM) error = SET_ERROR(EIO); - /* - * if we actually read some bytes, bubbling EFAULT - * up to become EAGAIN isn't what we want here. - */ - if (error == EFAULT && - (zfs_uio_offset(uio) - start_offset) != 0) - error = 0; break; } From nobody Fri Oct 22 20:19:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 77E7A181C6B2; Fri, 22 Oct 2021 20:20:05 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbbLY2dCJz4lwk; Fri, 22 Oct 2021 20:20:05 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-ua1-x929.google.com with SMTP id e5so2851184uam.11; Fri, 22 Oct 2021 13:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0HHwmJWIPS/0GhwgKDTgvhxTVXsB/fCjhzJHKtSnbcc=; b=nzXYZq7jtV1ci+UuLi1M8CnaH1A7QmFMr/p4tJOX4qUHh++4bJs44IyGW+CXY9l+Fc Z66avDLe0MjkmEvA5WE1UndpefMTVuzD5sYielCB+z6B6geyTSN7b82aq0krRHlt4BKj ij6gYGNcnSE6NW6j10taMRYtU/GK//n3m2LqMtblhhFEya4+qSojIZ1k1pgDAH1oIA7+ CEQlR6vZNHajwg3+xcc7nmqfsI0kwPAHc2qCB8U+Y/3uNPgLq2KSJRfUfVsRXoP7BbY2 4Uij/0z8S7NXuWi2Z0xjKRcECvuCHFOyg34pAufc2Ves9y5NH0FMF3BcPKdE/b3XtBFJ tOHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0HHwmJWIPS/0GhwgKDTgvhxTVXsB/fCjhzJHKtSnbcc=; b=xcyRQoVdqiBMFg1Pk+T6rdP28Cj3JiQ8xGme6tjlQhGhtFHAhs6qe2+pH3NuyWrgLW JSUtChDQ0uueb/ckHGFonq+Q/GmT5OJhIn/E/3I9avsc6zQAuy6sJGM5dCkX6nn00R9q nnIIl/jLPpe4YIju+SQgJWj0AUNxTmPbcuSuFRq2y/X8WDI/Dua+gLpxnOpAZY+ZT4eU ncOWv4T19I0AE8ClpQmiWlSn3gSlOEPUz17uCUsYVxMMDySX0PC/I4D+61W91DNoS1X8 vvRSzXyc9oL0bUqQ9GfjcOL54nPmE/wmSQvLToKgG6p/pE5KouJgrchQrNojEAKuqluH HGUg== X-Gm-Message-State: AOAM533SrLxZ6cgp5yMoze7hATQovWah12u6DKAUVGiCW7rDEEfRBnrQ yB8US2FBf2jDCiRYVEsj6wnwJpB70wZN2GSHrQEePb+X8cE= X-Google-Smtp-Source: ABdhPJyJG1FE7VetXxWxvfdiiw9fB4G8yyPUhM34TCs41GDt8zmQ5Avo17r6YZw1mWO02JLtTHoPFIj+mVNJARDWqf8= X-Received: by 2002:a67:cb87:: with SMTP id h7mr2942199vsl.0.1634934005002; Fri, 22 Oct 2021 13:20:05 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> In-Reply-To: <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> From: Benjamin Kaduk Date: Fri, 22 Oct 2021 13:19:54 -0700 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: Emmanuel Vadot Cc: "Rodney W. Grimes" , "Rodney W. Grimes" , gljennjohn@gmail.com, Gleb Smirnoff , Slawa Olhovchenkov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000009977a905cef6bc5a" X-Rspamd-Queue-Id: 4HbbLY2dCJz4lwk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000009977a905cef6bc5a Content-Type: text/plain; charset="UTF-8" On Fri, Oct 22, 2021 at 10:47 AM Emmanuel Vadot wrote: > On Fri, 22 Oct 2021 10:04:15 -0700 (PDT) > "Rodney W. Grimes" wrote: > > > We need to STOP these "I dont like the 20 year old defaults, > > so I am going to change them to what I like and use" It is NOT > > forward progress on making a better system, it is tilting at > > defaults, very long established defaults, that should probably > > just be left alone. > > It's not "I don't like", it's "We don't like". If we can't change > FreeBSD default to what most of our users want I don't know why we're > still working on this OS. > **We** can change the defaults. But to know that we, as a community, have consensus to make the change, we need to have a conversation. Having that conversation before making the change seems like a much better [*] approach than presenting the change as a fait accompli and waiting for dissent. In other words, I am okay with changing the default (I personally do not feel a need for it), but am unhappy that there was no conversation about it other than a phabricator review that was apparently only open for about a day. -Ben * I have some other, more precise, adjectives I would like to use, but I think the risk of them being interpreted harmfully is too high to use them in this forum. I'm happy to talk more in some other forum if you want. --0000000000009977a905cef6bc5a-- From nobody Fri Oct 22 20:30:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E0CE617F0717; Fri, 22 Oct 2021 20:30: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbbZw62Rjz4pZd; Fri, 22 Oct 2021 20:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEFAB154BB; Fri, 22 Oct 2021 20:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MKUmQN073914; Fri, 22 Oct 2021 20:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MKUmSR073913; Fri, 22 Oct 2021 20:30:48 GMT (envelope-from git) Date: Fri, 22 Oct 2021 20:30:48 GMT Message-Id: <202110222030.19MKUmSR073913@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: c2426723394b - main - Fix sconfig(8) build. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: c2426723394ba9ab8ffa0d69bd132af1aaa2ea12 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c2426723394ba9ab8ffa0d69bd132af1aaa2ea12 commit c2426723394ba9ab8ffa0d69bd132af1aaa2ea12 Author: Gleb Smirnoff AuthorDate: 2021-10-22 20:28:44 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-22 20:28:44 +0000 Fix sconfig(8) build. Missed that since sconfig(8) was built on i386 only. Since I enabled cp(4) on amd64, enable sconfig(8) as well. Fixes: 6aae3517ed25 --- sbin/Makefile | 4 ---- sbin/Makefile.amd64 | 1 + sbin/sconfig/Makefile | 2 +- sbin/sconfig/sconfig.c | 5 +---- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sbin/Makefile b/sbin/Makefile index ade73fc8b0ee..b4da58680458 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -93,10 +93,6 @@ SUBDIR.${MK_TESTS}+= tests SUBDIR_PARALLEL= -# Add architecture-specific manpages -# to be included anyway -MAN= sconfig/sconfig.8 - .include .include diff --git a/sbin/Makefile.amd64 b/sbin/Makefile.amd64 index 2d231b0cb2b0..4135c44082c9 100644 --- a/sbin/Makefile.amd64 +++ b/sbin/Makefile.amd64 @@ -2,3 +2,4 @@ SUBDIR += bsdlabel SUBDIR += fdisk +SUBDIR += sconfig diff --git a/sbin/sconfig/Makefile b/sbin/sconfig/Makefile index bce914f40868..96fb46434d7a 100644 --- a/sbin/sconfig/Makefile +++ b/sbin/sconfig/Makefile @@ -4,7 +4,7 @@ PACKAGE=runtime PROG= sconfig MAN= sconfig.8 -MANSUBDIR= /i386 WARNS?= 2 +CFLAGS+= -I${SRCTOP}/sys/dev/cp .include diff --git a/sbin/sconfig/sconfig.c b/sbin/sconfig/sconfig.c index eebf6013e167..48363036e412 100644 --- a/sbin/sconfig/sconfig.c +++ b/sbin/sconfig/sconfig.c @@ -29,10 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include +#include "cserial.h" #define MAXCHAN 128 From nobody Fri Oct 22 20:55:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C50AE1805383; Fri, 22 Oct 2021 20:55:43 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbc7g1Dm6z3DBv; Fri, 22 Oct 2021 20:55:42 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1634936141; 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=Xi02XAFA+D8sBuQaJVZN1TA0dAQkl/Nk9KSicA35r0s=; b=e/4Mm3aYZHrZESsVUB7XHkN4iouQdSP7Pfki9cQFKeyvq3Iyz8MArYRm9viHAvnoTCb4xT aX/pthNwmM4JIxwHaptCxMSjAnxCR7K1lAWTnMv3aqqdVyFRAwOrc/3vze1RnbowuNss7W aJRiJ/52OrEqZCnRSOpXuwl50Px4Ukg= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id c5365e59 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 22 Oct 2021 20:55:41 +0000 (UTC) Date: Fri, 22 Oct 2021 22:55:40 +0200 From: Emmanuel Vadot To: Benjamin Kaduk Cc: "Rodney W. Grimes" , "Rodney W. Grimes" , gljennjohn@gmail.com, Gleb Smirnoff , Slawa Olhovchenkov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-Id: <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> In-Reply-To: References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Hbc7g1Dm6z3DBv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 22 Oct 2021 13:19:54 -0700 Benjamin Kaduk wrote: > On Fri, Oct 22, 2021 at 10:47 AM Emmanuel Vadot > wrote: > > > On Fri, 22 Oct 2021 10:04:15 -0700 (PDT) > > "Rodney W. Grimes" wrote: > > > > > We need to STOP these "I dont like the 20 year old defaults, > > > so I am going to change them to what I like and use" It is NOT > > > forward progress on making a better system, it is tilting at > > > defaults, very long established defaults, that should probably > > > just be left alone. > > > > It's not "I don't like", it's "We don't like". If we can't change > > FreeBSD default to what most of our users want I don't know why we're > > still working on this OS. > > > > **We** can change the defaults. But to know that we, as a community, have > consensus to make the change, we need to have a conversation. Having that > conversation before making the change seems like a much better [*] approach > than presenting the change as a fait accompli and waiting for dissent. > > In other words, I am okay with changing the default (I personally do not > feel a need for it), but am unhappy that there was no conversation about it > other than a phabricator review that was apparently only open for about a > day. > > -Ben > > * I have some other, more precise, adjectives I would like to use, but I > think the risk of them being interpreted harmfully is too high to use them > in this forum. I'm happy to talk more in some other forum if you want. If I knew that this change would have caused that much mails I would have send a mail to current or whatever before and left the review opened for more time. I honestly thought that this setting was something that you setup once when you installed a new machine (which doesn't happens very often) and forget about it, you know another "ah crap yes I forgot about this, why do we have such insane default. Oh well now that I disabled it locally I don't have to think about it and won't change the default". Instead this time I didn't say to myself that I won't change it and I did. -- Emmanuel Vadot From nobody Fri Oct 22 21:55:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A2BD91801ACD; Fri, 22 Oct 2021 21:55: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbdSY4F0Bz3ng0; Fri, 22 Oct 2021 21:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 704E71677E; Fri, 22 Oct 2021 21:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MLtP28083883; Fri, 22 Oct 2021 21:55:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MLtPhI083882; Fri, 22 Oct 2021 21:55:25 GMT (envelope-from git) Date: Fri, 22 Oct 2021 21:55:25 GMT Message-Id: <202110222155.19MLtPhI083882@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: c8ee75f2315e - main - Use network epoch to protect local IPv4 addresses hash. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: c8ee75f2315e8267ad814dc5b4645ef205f0e0e1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c8ee75f2315e8267ad814dc5b4645ef205f0e0e1 commit c8ee75f2315e8267ad814dc5b4645ef205f0e0e1 Author: Gleb Smirnoff AuthorDate: 2021-10-10 17:02:26 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-22 21:40:53 +0000 Use network epoch to protect local IPv4 addresses hash. The modification to the hash are already naturally locked by in_control_sx. Convert the hash lists to CK lists. Remove the in_ifaddr_rmlock. Assert the network epoch where necessary. Most cases when the hash lookup is done the epoch is already entered. Cover a few cases, that need entering the epoch, which mostly is initial configuration of tunnel interfaces and multicast addresses. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D32584 --- sys/net/if_ipsec.c | 3 +++ sys/net/if_me.c | 3 +++ sys/net/if_stf.c | 6 +----- sys/netinet/if_ether.c | 13 +++---------- sys/netinet/in.c | 46 ++++++++++++++++++++-------------------------- sys/netinet/in.h | 2 +- sys/netinet/in_debug.c | 6 +++--- sys/netinet/in_gif.c | 3 +++ sys/netinet/in_mcast.c | 28 +++++++++++++++------------- sys/netinet/in_var.h | 24 +++++++----------------- sys/netinet/ip_gre.c | 3 +++ sys/netinet/ip_icmp.c | 7 +------ sys/netinet/ip_input.c | 12 ++++-------- sys/netpfil/pf/pf.c | 17 +++-------------- 14 files changed, 70 insertions(+), 103 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index b9931286a735..b170ac177a64 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -1014,6 +1014,7 @@ static int ipsec_set_tunnel(struct ipsec_softc *sc, struct sockaddr *src, struct sockaddr *dst, uint32_t reqid) { + struct epoch_tracker et; struct secpolicy *sp[IPSEC_SPCOUNT]; int i; @@ -1037,7 +1038,9 @@ ipsec_set_tunnel(struct ipsec_softc *sc, struct sockaddr *src, sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; return (ENOMEM); } + NET_EPOCH_ENTER(et); ipsec_set_running(sc); + NET_EPOCH_EXIT(et); return (0); } diff --git a/sys/net/if_me.c b/sys/net/if_me.c index 067ab22cd84d..e1b932bdb16c 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -403,6 +403,7 @@ me_srcaddr(void *arg __unused, const struct sockaddr *sa, static int me_set_tunnel(struct me_softc *sc, in_addr_t src, in_addr_t dst) { + struct epoch_tracker et; struct me_softc *tmp; sx_assert(&me_ioctl_sx, SA_XLOCKED); @@ -429,7 +430,9 @@ me_set_tunnel(struct me_softc *sc, in_addr_t src, in_addr_t dst) CK_LIST_INSERT_HEAD(&ME_HASH(src, dst), sc, chain); CK_LIST_INSERT_HEAD(&ME_SRCHASH(src), sc, srchash); + NET_EPOCH_ENTER(et); me_set_running(sc); + NET_EPOCH_EXIT(et); if_link_state_change(ME2IFP(sc), LINK_STATE_UP); return (0); } diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index f7d6758d052c..de442a133fc6 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -87,7 +87,6 @@ #include #include #include -#include #include #include @@ -369,7 +368,6 @@ stf_encapcheck(const struct mbuf *m, int off, int proto, void *arg) static int stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask) { - struct rm_priotracker in_ifa_tracker; struct ifaddr *ia; struct in_ifaddr *ia4; struct in6_ifaddr *ia6; @@ -386,11 +384,9 @@ stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask) continue; bcopy(GET_V4(&sin6->sin6_addr), &in, sizeof(in)); - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash) + CK_LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash) if (ia4->ia_addr.sin_addr.s_addr == in.s_addr) break; - IN_IFADDR_RUNLOCK(&in_ifa_tracker); if (ia4 == NULL) continue; diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 45ce04117948..f54df9937936 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -779,7 +778,6 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUTO, allow_multicast, CTLFLAG_RW, static void in_arpinput(struct mbuf *m) { - struct rm_priotracker in_ifa_tracker; struct arphdr *ah; struct ifnet *ifp = m->m_pkthdr.rcvif; struct llentry *la = NULL, *la_tmp; @@ -846,24 +844,21 @@ in_arpinput(struct mbuf *m) * of the receive interface. (This will change slightly * when we have clusters of interfaces). */ - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { + CK_LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge == ifp->if_bridge) || ia->ia_ifp == ifp) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr && (ia->ia_ifa.ifa_carp == NULL || (*carp_iamatch_p)(&ia->ia_ifa, &enaddr))) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } - LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) + CK_LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) if (((bridged && ia->ia_ifp->if_bridge == ifp->if_bridge) || ia->ia_ifp == ifp) && isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } @@ -878,17 +873,15 @@ in_arpinput(struct mbuf *m) * meant to be destined to the bridge member. */ if (is_bridge) { - LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { + CK_LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (BDG_MEMBER_MATCHES_ARP(itaddr.s_addr, ifp, ia)) { ifa_ref(&ia->ia_ifa); ifp = ia->ia_ifp; - IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } } #undef BDG_MEMBER_MATCHES_ARP - IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * No match, use the first inet address on the receive interface diff --git a/sys/netinet/in.c b/sys/netinet/in.c index aa87546be2d4..8eb20f0f2d27 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -124,21 +123,18 @@ in_localaddr(struct in_addr in) * Return 1 if an internet address is for the local host and configured * on one of its interfaces. */ -int +bool in_localip(struct in_addr in) { - struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) { - if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) { - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (1); - } - } - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (0); + NET_EPOCH_ASSERT(); + + CK_LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) + if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) + return (true); + + return (false); } /* @@ -170,24 +166,24 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) static struct in_ifaddr * in_localip_more(struct in_ifaddr *original_ia) { - struct rm_priotracker in_ifa_tracker; + struct epoch_tracker et; in_addr_t original_addr = IA_SIN(original_ia)->sin_addr.s_addr; uint32_t original_fib = original_ia->ia_ifa.ifa_ifp->if_fib; struct in_ifaddr *ia; - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) { + NET_EPOCH_ENTER(et); + CK_LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) { in_addr_t addr = IA_SIN(ia)->sin_addr.s_addr; uint32_t fib = ia->ia_ifa.ifa_ifp->if_fib; if (!V_rt_add_addr_allfibs && (original_fib != fib)) continue; if ((original_ia != ia) && (original_addr == addr)) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); + NET_EPOCH_EXIT(et); return (ia); } } - IN_IFADDR_RUNLOCK(&in_ifa_tracker); + NET_EPOCH_EXIT(et); return (NULL); } @@ -500,10 +496,10 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ - IN_IFADDR_WLOCK(); + sx_assert(&in_control_sx, SA_XLOCKED); CK_STAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); - LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, ia_hash); - IN_IFADDR_WUNLOCK(); + CK_LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, + ia_hash); /* * Give the interface a chance to initialize @@ -575,10 +571,9 @@ fail1: IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ - IN_IFADDR_WLOCK(); + sx_assert(&in_control_sx, SA_XLOCKED); CK_STAILQ_REMOVE(&V_in_ifaddrhead, ia, in_ifaddr, ia_link); - LIST_REMOVE(ia, ia_hash); - IN_IFADDR_WUNLOCK(); + CK_LIST_REMOVE(ia, ia_hash); ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ return (error); @@ -639,10 +634,9 @@ in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ - IN_IFADDR_WLOCK(); + sx_assert(&in_control_sx, SA_XLOCKED); CK_STAILQ_REMOVE(&V_in_ifaddrhead, ia, in_ifaddr, ia_link); - LIST_REMOVE(ia, ia_hash); - IN_IFADDR_WUNLOCK(); + CK_LIST_REMOVE(ia, ia_hash); /* * in_scrubprefix() kills the interface route. diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 0206fd16d2fe..0506f1739e9b 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -649,7 +649,7 @@ int in_broadcast(struct in_addr, struct ifnet *); int in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); int in_canforward(struct in_addr); int in_localaddr(struct in_addr); -int in_localip(struct in_addr); +bool in_localip(struct in_addr); int in_ifhasaddr(struct ifnet *, struct in_addr); struct in_ifaddr *in_findlocal(uint32_t, bool); int inet_aton(const char *, struct in_addr *); /* in libkern */ diff --git a/sys/netinet/in_debug.c b/sys/netinet/in_debug.c index d39c528dd9cd..00bc2636b436 100644 --- a/sys/netinet/in_debug.c +++ b/sys/netinet/in_debug.c @@ -90,9 +90,9 @@ in_show_in_ifaddr(struct in_ifaddr *ia) IA_DB_RPINTF_PTR("%p", ia_ifa); IA_DB_RPINTF("0x%08lx", ia_subnet); IA_DB_RPINTF("0x%08lx", ia_subnetmask); - IA_DB_RPINTF("%p", ia_hash.le_next); - IA_DB_RPINTF("%p", ia_hash.le_prev); - IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev); + IA_DB_RPINTF("%p", ia_hash.cle_next); + IA_DB_RPINTF("%p", ia_hash.cle_prev); + IA_DB_RPINTF_DPTR("%p", ia_hash.cle_prev); IA_DB_RPINTF("%p", ia_link.cstqe_next); IA_DB_RPINTF_PTR("%p", ia_addr); IA_DB_RPINTF_PTR("%p", ia_dstaddr); diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index a9f3d384fb5a..6290de6cb31e 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -196,6 +196,7 @@ int in_gif_ioctl(struct gif_softc *sc, u_long cmd, caddr_t data) { struct ifreq *ifr = (struct ifreq *)data; + struct epoch_tracker et; struct sockaddr_in *dst, *src; struct ip *ip; int error; @@ -245,7 +246,9 @@ in_gif_ioctl(struct gif_softc *sc, u_long cmd, caddr_t data) sc->gif_family = AF_INET; sc->gif_iphdr = ip; in_gif_attach(sc); + NET_EPOCH_ENTER(et); in_gif_set_running(sc); + NET_EPOCH_EXIT(et); break; case SIOCGIFPSRCADDR: case SIOCGIFPDSTADDR: diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index f307be283e64..6ac81aa98e44 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1378,7 +1377,6 @@ static int inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) { struct group_source_req gsr; - struct rm_priotracker in_ifa_tracker; sockunion_t *gsa, *ssa; struct ifnet *ifp; struct in_mfilter *imf; @@ -1416,9 +1414,12 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) ssa->sin.sin_addr = mreqs.imr_sourceaddr; if (!in_nullhost(mreqs.imr_interface)) { - IN_IFADDR_RLOCK(&in_ifa_tracker); + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); INADDR_TO_IFP(mreqs.imr_interface, ifp); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); + /* XXXGL: ifref? */ + NET_EPOCH_EXIT(et); } if (sopt->sopt_name == IP_BLOCK_SOURCE) doblock = 1; @@ -1871,7 +1872,6 @@ static struct ifnet * inp_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in *gsin, const struct in_addr ina) { - struct rm_priotracker in_ifa_tracker; struct ifnet *ifp; struct nhop_object *nh; @@ -1883,11 +1883,9 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, ifp = NULL; if (!in_nullhost(ina)) { - IN_IFADDR_RLOCK(&in_ifa_tracker); INADDR_TO_IFP(ina, ifp); if (ifp != NULL) if_ref(ifp); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); } else { nh = fib4_lookup(inp->inp_inc.inc_fibnum, gsin->sin_addr, 0, NHR_NONE, 0); if (nh != NULL) { @@ -2247,7 +2245,6 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt) { struct group_source_req gsr; struct ip_mreq_source mreqs; - struct rm_priotracker in_ifa_tracker; sockunion_t *gsa, *ssa; struct ifnet *ifp; struct in_mfilter *imf; @@ -2307,9 +2304,12 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt) * using an IPv4 address as a key is racy. */ if (!in_nullhost(mreqs.imr_interface)) { - IN_IFADDR_RLOCK(&in_ifa_tracker); + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); INADDR_TO_IFP(mreqs.imr_interface, ifp); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); + /* XXXGL ifref? */ + NET_EPOCH_EXIT(et); } CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p", __func__, ntohl(mreqs.imr_interface.s_addr), ifp); @@ -2465,7 +2465,6 @@ out_inp_locked: static int inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) { - struct rm_priotracker in_ifa_tracker; struct in_addr addr; struct ip_mreqn mreqn; struct ifnet *ifp; @@ -2504,9 +2503,12 @@ inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) if (in_nullhost(addr)) { ifp = NULL; } else { - IN_IFADDR_RLOCK(&in_ifa_tracker); + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); INADDR_TO_IFP(addr, ifp); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); + /* XXXGL ifref? */ + NET_EPOCH_EXIT(et); if (ifp == NULL) return (EADDRNOTAVAIL); } diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index c33098e2c79c..a6902159e739 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -79,7 +79,7 @@ struct in_ifaddr { /* ia_subnet{,mask} in host order */ u_long ia_subnet; /* subnet address */ u_long ia_subnetmask; /* mask of subnet */ - LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ + CK_LIST_ENTRY(in_ifaddr) ia_hash; /* hash of internet addresses */ CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ struct sockaddr_in ia_addr; /* reserve space for interface name */ struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ @@ -108,7 +108,7 @@ extern u_char inetctlerrmap[]; * Hash table for IP addresses. */ CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); -LIST_HEAD(in_ifaddrhashhead, in_ifaddr); +CK_LIST_HEAD(in_ifaddrhashhead, in_ifaddr); VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); VNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead); @@ -124,16 +124,6 @@ VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ #define INADDR_HASH(x) \ (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) -extern struct rmlock in_ifaddr_lock; - -#define IN_IFADDR_LOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_LOCKED) -#define IN_IFADDR_RLOCK(t) rm_rlock(&in_ifaddr_lock, (t)) -#define IN_IFADDR_RLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_RLOCKED) -#define IN_IFADDR_RUNLOCK(t) rm_runlock(&in_ifaddr_lock, (t)) -#define IN_IFADDR_WLOCK() rm_wlock(&in_ifaddr_lock) -#define IN_IFADDR_WLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_WLOCKED) -#define IN_IFADDR_WUNLOCK() rm_wunlock(&in_ifaddr_lock) - /* * Macro for finding the internet address structure (in_ifaddr) * corresponding to one of our IP addresses (in_addr). @@ -141,11 +131,11 @@ extern struct rmlock in_ifaddr_lock; #define INADDR_TO_IFADDR(addr, ia) \ /* struct in_addr addr; */ \ /* struct in_ifaddr *ia; */ \ -do { \ -\ - LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ - if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ - break; \ +do { \ + NET_EPOCH_ASSERT(); \ + CK_LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ + if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ + break; \ } while (0) /* diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 0afd490944a4..6a2135fa32cd 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -363,6 +363,7 @@ fail: static int in_gre_attach(struct gre_softc *sc) { + struct epoch_tracker et; struct grehdr *gh; int error; @@ -397,7 +398,9 @@ in_gre_attach(struct gre_softc *sc) sc, srchash); /* Set IFF_DRV_RUNNING if interface is ready */ + NET_EPOCH_ENTER(et); in_gre_set_running(sc); + NET_EPOCH_EXIT(et); return (0); } diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index f8dfc21df8f3..463ac8c8e04d 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -756,7 +755,6 @@ freeit: static void icmp_reflect(struct mbuf *m) { - struct rm_priotracker in_ifa_tracker; struct ip *ip = mtod(m, struct ip *); struct ifaddr *ifa; struct ifnet *ifp; @@ -785,15 +783,12 @@ icmp_reflect(struct mbuf *m) * If the incoming packet was addressed directly to one of our * own addresses, use dst as the src for the reply. */ - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) { + CK_LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) { if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) { t = IA_SIN(ia)->sin_addr; - IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } - IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * If the incoming packet was addressed to one of our broadcast diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 465c00e4dac7..dc122dd62e99 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -102,9 +102,6 @@ extern void ipreass_slowtimo(void); extern void ipreass_destroy(void); #endif -struct rmlock in_ifaddr_lock; -RM_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); - VNET_DEFINE(int, rsvp_on); VNET_DEFINE(int, ipforwarding); @@ -180,6 +177,9 @@ VNET_DEFINE(struct in_ifaddrhead, in_ifaddrhead); /* first inet address */ VNET_DEFINE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); /* inet addr hash table */ VNET_DEFINE(u_long, in_ifaddrhmask); /* mask for hash table */ +/* Make sure it is safe to use hashinit(9) on CK_LIST. */ +CTASSERT(sizeof(struct in_ifaddrhashhead) == sizeof(LIST_HEAD(, in_addr))); + #ifdef IPCTL_DEFMTU SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, mtu, CTLFLAG_RW, &ip_mtu, 0, "Default MTU"); @@ -453,7 +453,6 @@ void ip_input(struct mbuf *m) { MROUTER_RLOCK_TRACKER; - struct rm_priotracker in_ifa_tracker; struct ip *ip = NULL; struct in_ifaddr *ia = NULL; struct ifaddr *ifa; @@ -689,8 +688,7 @@ passin: /* * Check for exact addresses in the hash bucket. */ - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { + CK_LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { /* * If the address matches, verify that the packet * arrived via the correct interface if checking is @@ -701,11 +699,9 @@ passin: counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); counter_u64_add(ia->ia_ifa.ifa_ibytes, m->m_pkthdr.len); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto ours; } } - IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * Check for broadcast addresses. diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 17253373628c..bb7667a3e270 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1593,20 +1593,9 @@ pf_isforlocal(struct mbuf *m, int af) switch (af) { #ifdef INET case AF_INET: { - struct rm_priotracker in_ifa_tracker; - struct ip *ip; - struct in_ifaddr *ia = NULL; - - ip = mtod(m, struct ip *); - IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { - if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr) { - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (true); - } - } - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - break; + struct ip *ip = mtod(m, struct ip *); + + return (in_localip(ip->ip_dst)); } #endif #ifdef INET6 From nobody Fri Oct 22 22:53:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5857181AB9E; Fri, 22 Oct 2021 22:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbfm24kSPz4b17; Fri, 22 Oct 2021 22:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83A5616B7D; Fri, 22 Oct 2021 22:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MMrsG6064687; Fri, 22 Oct 2021 22:53:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MMrssX064686; Fri, 22 Oct 2021 22:53:54 GMT (envelope-from git) Date: Fri, 22 Oct 2021 22:53:54 GMT Message-Id: <202110222253.19MMrssX064686@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: 5fff2859ec5d - main - bsnmpd: Remove "All Rights Reserved" from FreeBSD Foundation copyrights List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fff2859ec5de6ed4bcf0c4df1ceabcf14ff72dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5fff2859ec5de6ed4bcf0c4df1ceabcf14ff72dd commit 5fff2859ec5de6ed4bcf0c4df1ceabcf14ff72dd Author: Ed Maste AuthorDate: 2021-10-22 22:52:05 +0000 Commit: Ed Maste CommitDate: 2021-10-22 22:53:35 +0000 bsnmpd: Remove "All Rights Reserved" from FreeBSD Foundation copyrights Sponsored by: The FreeBSD Foundation --- usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt | 1 - usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 | 1 - usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c | 1 - usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h | 1 - usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c | 3 +-- usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def | 1 - 6 files changed, 1 insertion(+), 7 deletions(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt index 27f5be7d68f5..69873eddf33d 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt @@ -1,6 +1,5 @@ -- -- Copyright (C) 2010 The FreeBSD Foundation --- All rights reserved. -- -- This documentation was written by Shteryana Sotirova Shopova under -- sponsorship from the FreeBSD Foundation. diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 index d027fc8876cb..f1bf983f579b 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 @@ -1,6 +1,5 @@ .\"- .\" Copyright (C) 2010 The FreeBSD Foundation -.\" All rights reserved. .\" .\" This documentation was written by Shteryana Sotirova Shopova under .\" sponsorship from the FreeBSD Foundation. diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c index aa156a2f2321..aaa2b3071352 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Shteryana Sotirova Shopova under * sponsorship from the FreeBSD Foundation. diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h index d72db2995c2f..f5fce0e3a01f 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Shteryana Sotirova Shopova under * sponsorship from the FreeBSD Foundation. diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c index c714f1fa4211..3ac2d63d105d 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c @@ -2,8 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 The FreeBSD Foundation - * All rights reserved. - + * * This software was developed by Shteryana Sotirova Shopova under * sponsorship from the FreeBSD Foundation. * diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def index e0ae2a0030a1..630e46392f77 100644 --- a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def +++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def @@ -1,6 +1,5 @@ #- # Copyright (C) 2010 The FreeBSD Foundation -# All rights reserved. # # This software was developed by Shteryana Sotirova Shopova under # sponsorship from the FreeBSD Foundation. From nobody Fri Oct 22 23:31:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9FEDA180CE26; Fri, 22 Oct 2021 23:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbgbV4BQ2z4p57; Fri, 22 Oct 2021 23:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70C5F17C9A; Fri, 22 Oct 2021 23:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MNVYV7018014; Fri, 22 Oct 2021 23:31:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MNVYlE018013; Fri, 22 Oct 2021 23:31:34 GMT (envelope-from git) Date: Fri, 22 Oct 2021 23:31:34 GMT Message-Id: <202110222331.19MNVYlE018013@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: 362c6d8dec6d - main - nehemiah: manually assemble xstore(-rng) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 362c6d8dec6dfbedc5717e45769042279a1dd3df Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=362c6d8dec6dfbedc5717e45769042279a1dd3df commit 362c6d8dec6dfbedc5717e45769042279a1dd3df Author: Konstantin Belousov AuthorDate: 2021-10-20 22:42:05 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:31:16 +0000 nehemiah: manually assemble xstore(-rng) It seems that clang IAS erronously adds repz prefix which should not be there. Cpu would try to store around %ecx bytes of random, while we only expect a word. PR: 259218 Reported and tested by: Dennis Clarke Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/random/nehemiah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c index ba0dfb200ba0..3ad18005c935 100644 --- a/sys/dev/random/nehemiah.c +++ b/sys/dev/random/nehemiah.c @@ -68,7 +68,7 @@ VIA_RNG_store(void *buf) #ifdef __GNUCLIKE_ASM __asm __volatile( "movl $0,%%edx\n\t" - "xstore" + ".byte 0x0f, 0xa7, 0xc0" : "=a" (retval), "+d" (rate), "+D" (buf) : : "memory" From nobody Sat Oct 23 00:00:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9563A1818392; Sat, 23 Oct 2021 00:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbhDg3Xfqz3CVf; Sat, 23 Oct 2021 00:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A2A71811C; Sat, 23 Oct 2021 00:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N00J3W052896; Sat, 23 Oct 2021 00:00:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N00JIK052888; Sat, 23 Oct 2021 00:00:19 GMT (envelope-from git) Date: Sat, 23 Oct 2021 00:00:19 GMT Message-Id: <202110230000.19N00JIK052888@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: 7b1e19ad78c6 - main - Add libfido2 to the build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b1e19ad78c6a3f84f81cb1a16a39500f0337062 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7b1e19ad78c6a3f84f81cb1a16a39500f0337062 commit 7b1e19ad78c6a3f84f81cb1a16a39500f0337062 Author: Ed Maste AuthorDate: 2021-10-07 01:52:05 +0000 Commit: Ed Maste CommitDate: 2021-10-22 23:57:57 +0000 Add libfido2 to the build From https://github.com/Yubico/libfido2: libfido2 provides library functionality and command-line tools to communicate with a FIDO device over USB, and to verify attestation and assertion signatures. libfido2 supports the FIDO U2F (CTAP 1) and FIDO 2.0 (CTAP 2) protocols. libfido2 will be used by ssh to support FIDO/U2F keys. It is currently intended only for use by ssh, and so is installed as a PRIVATELIB and is placed in the ssh pkgbase package. This is currently disabled for the 32-bit library build as libfido2 is not compatible with the COMPAT_32BIT hack in usb_ioctl.h. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32448 --- lib/Makefile | 2 +- lib/libfido2/Makefile | 73 ++++++++++++++++++++++++++++++++ share/mk/src.libnames.mk | 3 ++ tools/build/mk/OptionalObsoleteFiles.inc | 3 ++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index d39bbd37c910..81ace36ba990 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -216,7 +216,7 @@ SUBDIR.${MK_BHYVE}+= libvmmapi SUBDIR.${MK_OPENMP}+= libomp .endif .if !defined(COMPAT_32BIT) -SUBDIR.${MK_OPENSSH}+= libcbor +SUBDIR.${MK_OPENSSH}+= libcbor libfido2 .endif SUBDIR.${MK_OPENSSL}+= libmp SUBDIR.${MK_PF}+= libpfctl diff --git a/lib/libfido2/Makefile b/lib/libfido2/Makefile new file mode 100644 index 000000000000..edf737b9dafc --- /dev/null +++ b/lib/libfido2/Makefile @@ -0,0 +1,73 @@ +PACKAGE=ssh +LIB= fido2 +PRIVATELIB= +DIST= ${SRCTOP}/contrib/libfido2 + +.PATH: ${DIST}/src ${DIST} + +SRCS+= aes256.c +SRCS+= assert.c +SRCS+= authkey.c +SRCS+= bio.c +SRCS+= blob.c +SRCS+= buf.c +SRCS+= cbor.c +SRCS+= compress.c +SRCS+= config.c +SRCS+= cred.c +SRCS+= credman.c +SRCS+= dev.c +SRCS+= ecdh.c +SRCS+= eddsa.c +SRCS+= err.c +SRCS+= es256.c +SRCS+= hid_freebsd.c +SRCS+= hid_unix.c +SRCS+= hid.c +SRCS+= info.c +SRCS+= io.c +SRCS+= iso7816.c +SRCS+= largeblob.c +SRCS+= log.c +SRCS+= pin.c +SRCS+= random.c +SRCS+= reset.c +SRCS+= rs256.c +SRCS+= u2f.c + +SRCS+= openbsd-compat/freezero.c +SRCS+= openbsd-compat/recallocarray.c + +CFLAGS+= -I ${DIST}/src -I${SRCTOP}/contrib/libcbor/src -I${.CURDIR}/../libcbor +CFLAGS+= -D_FIDO_INTERNAL +CFLAGS+= -DHAVE_ARC4RANDOM_BUF +CFLAGS+= -DHAVE_CLOCK_GETTIME +CFLAGS+= -DHAVE_DEV_URANDOM +CFLAGS+= -DHAVE_ERR_H +CFLAGS+= -DHAVE_EXPLICIT_BZERO +CFLAGS+= -DHAVE_GETLINE +CFLAGS+= -DHAVE_GETOPT +CFLAGS+= -DHAVE_GETPAGESIZE +CFLAGS+= -DHAVE_GETRANDOM +CFLAGS+= -DHAVE_OPENSSLV_H +CFLAGS+= -DHAVE_READPASSPHRASE +CFLAGS+= -DHAVE_SIGNAL_H +CFLAGS+= -DHAVE_STRLCAT +CFLAGS+= -DHAVE_STRLCPY +CFLAGS+= -DHAVE_STRSEP +CFLAGS+= -DHAVE_SYSCONF +CFLAGS+= -DHAVE_SYS_RANDOM_H +CFLAGS+= -DHAVE_TIMESPECSUB +CFLAGS+= -DHAVE_TIMINGSAFE_BCMP +CFLAGS+= -DHAVE_UNISTD_H +CFLAGS+= -DTLS=__thread +CFLAGS+= -D_FIDO_MAJOR=1 +CFLAGS+= -D_FIDO_MINOR=9 +CFLAGS+= -D_FIDO_PATCH=0 + +LIBADD= crypto z + +WARNS=2 +MAN= + +.include diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index a3cf355de372..227691804e2a 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -20,6 +20,7 @@ _PRIVATELIBS= \ cbor \ devdctl \ event1 \ + fido2 \ gmock \ gtest \ gmock_main \ @@ -339,6 +340,7 @@ _DP_pam= radius tacplus opie md util _DP_pam+= krb5 .endif .if ${MK_OPENSSH} != "no" +_DP_fido2+= crypto z _DP_pam+= ssh .endif .if ${MK_NIS} != "no" @@ -690,6 +692,7 @@ LIBCAP_SYSCTLDIR= ${OBJTOP}/lib/libcasper/services/cap_sysctl LIBCAP_SYSLOGDIR= ${OBJTOP}/lib/libcasper/services/cap_syslog LIBCBORDIR= ${OBJTOP}/lib/libcbor LIBBSDXMLDIR= ${OBJTOP}/lib/libexpat +LIBFIDO2DIR= ${OBJTOP}/lib/libfido2 LIBKVMDIR= ${OBJTOP}/lib/libkvm LIBPTHREADDIR= ${OBJTOP}/lib/libthr LIBMDIR= ${OBJTOP}/lib/msun diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 141f691ba83e..3fd4a00bfb02 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -7124,6 +7124,9 @@ OLD_FILES+=usr/bin/ssh-keyscan OLD_FILES+=usr/lib/libprivatecbor.a OLD_FILES+=usr/lib/libprivatecbor.so OLD_LIBS+=usr/lib/libprivatecbor.so.5 +OLD_FILES+=/usr/lib/libprivatefido2.a +OLD_FILES+=/usr/lib/libprivatefido2.so +OLD_LIBS+=/usr/lib/libprivatefido2.so.5 OLD_FILES+=usr/lib/pam_ssh.so OLD_LIBS+=usr/lib/pam_ssh.so.6 OLD_FILES+=usr/lib/libprivatessh.a From nobody Sat Oct 23 00:26:49 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 71EF91822194 for ; Sat, 23 Oct 2021 00:26:51 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbhqH2Vpbz3KNg for ; Sat, 23 Oct 2021 00:26:51 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f41.google.com with SMTP id l38-20020a05600c1d2600b0030d80c3667aso3712121wms.5 for ; Fri, 22 Oct 2021 17:26:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tO3mfJdmdYe6Xp1Siz0LOXpOQoj/RdjdZqmTfYfjUmM=; b=j+HT/KiMWo/qm5o1eiM1pNnH16UoPs4DncEDw99MvC7ZRnGq85XCZSP59HwpqV41Am IS7CyXEdWSGek9Ti10RshT8SaGOdSwIRsni31V4B3q07zsBuP7wh+l5pIvv81i4OTimM h7oRmduxDlCAg8sSx+SGJw83Tb0ibUSu9PbMb1Eeh2imrEFgA9Hkv5y/7IbxXqOsFwCL ZIihONA4CKbDZ8XOBSkmb5EHYhiI3YnRKS5J+h1trwW6W7LbkxbcayEvi4UMsOMpTKdB BibieKiksp8cX1acWcjc5P7G+6xHBl8ehlEZRPeDTd+ictofdOtJwJ5rx3JYeSQ9bEHR WlKQ== X-Gm-Message-State: AOAM530DaIsmmIvvJT7j4lDdzHaxvxfjmhJgzg+4BztsXSZ9bMZf2EvU /L2FCHN/AiVCaBdQnB28vm6PNrw+4eJ6tA== X-Google-Smtp-Source: ABdhPJyZi+L3wYubGa/KFYpGqiDJCsNRodfTemkkRxz9gwlyC6mcz7bv3q3goFoOyTcp+8sp3hq0Uw== X-Received: by 2002:a1c:4489:: with SMTP id r131mr2110349wma.1.1634948810278; Fri, 22 Oct 2021 17:26:50 -0700 (PDT) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id e18sm564361wrv.44.2021.10.22.17.26.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Oct 2021 17:26:50 -0700 (PDT) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 362c6d8dec6d - main - nehemiah: manually assemble xstore(-rng) From: Jessica Clarke In-Reply-To: <202110222331.19MNVYlE018013@gitrepo.freebsd.org> Date: Sat, 23 Oct 2021 01:26:49 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202110222331.19MNVYlE018013@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HbhqH2Vpbz3KNg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 23 Oct 2021, at 00:31, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D362c6d8dec6dfbedc5717e4576904227= 9a1dd3df >=20 > commit 362c6d8dec6dfbedc5717e45769042279a1dd3df > Author: Konstantin Belousov > AuthorDate: 2021-10-20 22:42:05 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-10-22 23:31:16 +0000 >=20 > nehemiah: manually assemble xstore(-rng) >=20 > It seems that clang IAS erronously adds repz prefix which should = not be > there. Cpu would try to store around %ecx bytes of random, while = we > only expect a word. FYI: https://reviews.llvm.org/D112355 Jess From nobody Sat Oct 23 01:10:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A83F3180E66F; Sat, 23 Oct 2021 01:10:25 +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 4HbjnY2LlMz3nYZ; Sat, 23 Oct 2021 01:10:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19N1AHTd071267 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 23 Oct 2021 04:10:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19N1AHTd071267 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19N1AHCK071265; Sat, 23 Oct 2021 04:10:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 23 Oct 2021 04:10:17 +0300 From: Konstantin Belousov To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 362c6d8dec6d - main - nehemiah: manually assemble xstore(-rng) Message-ID: References: <202110222331.19MNVYlE018013@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HbjnY2LlMz3nYZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sat, Oct 23, 2021 at 01:26:49AM +0100, Jessica Clarke wrote: > On 23 Oct 2021, at 00:31, Konstantin Belousov wrote: > > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=362c6d8dec6dfbedc5717e45769042279a1dd3df > > > > commit 362c6d8dec6dfbedc5717e45769042279a1dd3df > > Author: Konstantin Belousov > > AuthorDate: 2021-10-20 22:42:05 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-10-22 23:31:16 +0000 > > > > nehemiah: manually assemble xstore(-rng) > > > > It seems that clang IAS erronously adds repz prefix which should not be > > there. Cpu would try to store around %ecx bytes of random, while we > > only expect a word. > > FYI: https://reviews.llvm.org/D112355 Thanks. Feel free to revert this commit after llvm in tree is fixed. From nobody Sat Oct 23 01:12:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AAA31180F19D; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjqt4Sgpz3plH; Sat, 23 Oct 2021 01:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 795A2190DE; Sat, 23 Oct 2021 01:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CQ1w051340; Sat, 23 Oct 2021 01:12:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CQEb051339; Sat, 23 Oct 2021 01:12:26 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:26 GMT Message-Id: <202110230112.19N1CQEb051339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: cf12f7ba97dc - stable/13 - crt_malloc: use uintptr_t instead of long for arithmetic on addresses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cf12f7ba97dcb8d415414e491b5e4d68f1605190 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf12f7ba97dcb8d415414e491b5e4d68f1605190 commit cf12f7ba97dcb8d415414e491b5e4d68f1605190 Author: Konstantin Belousov AuthorDate: 2021-10-12 21:39:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 crt_malloc: use uintptr_t instead of long for arithmetic on addresses (cherry picked from commit 0b72d2965d68113bce16f6cccea77257283ef0a7) --- libexec/rtld-elf/rtld_malloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index 6604aa7201f8..f22c3c727c73 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -259,7 +259,7 @@ morepages(int n) int offset; if (pagepool_end - pagepool_start > pagesz) { - addr = (caddr_t)roundup2((long)pagepool_start, pagesz); + addr = roundup2(pagepool_start, pagesz); if (munmap(addr, pagepool_end - addr) != 0) { #ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": " @@ -269,8 +269,8 @@ morepages(int n) } } - offset = (long)pagepool_start - rounddown2((long)pagepool_start, - pagesz); + offset = (uintptr_t)pagepool_start - rounddown2( + (uintptr_t)pagepool_start, pagesz); pagepool_start = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); From nobody Sat Oct 23 01:12:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 232EB180F323; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjqv5sR6z3pRl; Sat, 23 Oct 2021 01:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6C2F1913C; Sat, 23 Oct 2021 01:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CR7R051364; Sat, 23 Oct 2021 01:12:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CR6Q051363; Sat, 23 Oct 2021 01:12:27 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:27 GMT Message-Id: <202110230112.19N1CR6Q051363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e5a8b8152ade - stable/13 - crt_malloc: Be more persistent when handling mmap() failure List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5a8b8152ade3c658a9a180f0bd2f6ae82302948 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e5a8b8152ade3c658a9a180f0bd2f6ae82302948 commit e5a8b8152ade3c658a9a180f0bd2f6ae82302948 Author: Konstantin Belousov AuthorDate: 2021-10-11 16:13:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 crt_malloc: Be more persistent when handling mmap() failure PR: 259076 (cherry picked from commit 19e008e7f79ce55182d227be8513b3fa520471d8) --- libexec/rtld-elf/rtld_malloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index f22c3c727c73..64218b5bb786 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -184,7 +184,9 @@ morecore(int bucket) nblks = 1; } if (amt > pagepool_end - pagepool_start) - if (morepages(amt/pagesz + NPOOLPAGES) == 0) + if (morepages(amt / pagesz + NPOOLPAGES) == 0 && + /* Retry with min required size */ + morepages(amt / pagesz) == 0) return; op = (union overhead *)pagepool_start; pagepool_start += amt; @@ -269,6 +271,8 @@ morepages(int n) } } + if (pagepool_start == MAP_FAILED) + pagepool_start = 0; offset = (uintptr_t)pagepool_start - rounddown2( (uintptr_t)pagepool_start, pagesz); From nobody Sat Oct 23 01:12:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAACA180EFD1; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjqx0g0lz3pg0; Sat, 23 Oct 2021 01:12:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C98231913D; Sat, 23 Oct 2021 01:12:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CSIg051388; Sat, 23 Oct 2021 01:12:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CSb7051387; Sat, 23 Oct 2021 01:12:28 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:28 GMT Message-Id: <202110230112.19N1CSb7051387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 00df149452bf - stable/13 - crt_malloc: more accurate handling of mmap(2) failure List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00df149452bfd1b9eee9acba842bb6bc874c5ae3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=00df149452bfd1b9eee9acba842bb6bc874c5ae3 commit 00df149452bfd1b9eee9acba842bb6bc874c5ae3 Author: Konstantin Belousov AuthorDate: 2021-10-15 17:59:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 crt_malloc: more accurate handling of mmap(2) failure PR: 259076 (cherry picked from commit 73dddffc3175581ba99f6ced9a2e508a0e880e59) --- libexec/rtld-elf/rtld_malloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index 64218b5bb786..63fa6f5e2ee7 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -271,21 +271,21 @@ morepages(int n) } } - if (pagepool_start == MAP_FAILED) - pagepool_start = 0; offset = (uintptr_t)pagepool_start - rounddown2( (uintptr_t)pagepool_start, pagesz); - pagepool_start = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, + addr = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); - if (pagepool_start == MAP_FAILED) { + if (addr == MAP_FAILED) { #ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: " "cannot mmap anonymous memory: %s\n", rtld_strerror(errno)); #endif + pagepool_start = pagepool_end = NULL; return (0); } + pagepool_start = addr; pagepool_end = pagepool_start + n * pagesz; pagepool_start += offset; From nobody Sat Oct 23 01:12:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 31A33180F2BD; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjqy4jzhz3pcn; Sat, 23 Oct 2021 01:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E055418BE0; Sat, 23 Oct 2021 01:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CT49051412; Sat, 23 Oct 2021 01:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CTgb051411; Sat, 23 Oct 2021 01:12:29 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:29 GMT Message-Id: <202110230112.19N1CTgb051411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5fb00264be3f - stable/13 - sys: Add definitions for RELR relative relocation format List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5fb00264be3f9e3ede49bec69baa4d3e53e02f88 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5fb00264be3f9e3ede49bec69baa4d3e53e02f88 commit 5fb00264be3f9e3ede49bec69baa4d3e53e02f88 Author: Fangrui Song AuthorDate: 2021-10-16 21:31:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 sys: Add definitions for RELR relative relocation format (cherry picked from commit 1cf06333160a9a6a4dabeba19f6d67ab55f0dac2) --- sys/sys/elf32.h | 2 ++ sys/sys/elf64.h | 2 ++ sys/sys/elf_common.h | 3 +++ sys/sys/elf_generic.h | 1 + 4 files changed, 8 insertions(+) diff --git a/sys/sys/elf32.h b/sys/sys/elf32.h index ad44b7cf970a..c328ce3b2f80 100644 --- a/sys/sys/elf32.h +++ b/sys/sys/elf32.h @@ -152,6 +152,8 @@ typedef struct { /* Macro for constructing r_info from field values. */ #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) +typedef Elf32_Word Elf32_Relr; + /* * Note entry header */ diff --git a/sys/sys/elf64.h b/sys/sys/elf64.h index 880166a3e83a..cc5c682e07da 100644 --- a/sys/sys/elf64.h +++ b/sys/sys/elf64.h @@ -166,6 +166,8 @@ typedef struct { #define ELF64_R_TYPE_INFO(data, type) \ (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type)) +typedef Elf64_Xword Elf64_Relr; + /* * Note entry header */ diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index d914ab8d4731..3243a8aca13c 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -617,6 +617,9 @@ typedef struct { #define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of pre-initialization functions. */ #define DT_MAXPOSTAGS 34 /* number of positive tags */ +#define DT_RELRSZ 35 /* Total size of ElfNN_Relr relocations. */ +#define DT_RELR 36 /* Address of ElfNN_Relr relocations. */ +#define DT_RELRENT 37 /* Size of each ElfNN_Relr relocation. */ #define DT_LOOS 0x6000000d /* First OS-specific */ #define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */ #define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */ diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h index dcd44fe93b14..177de7339d3f 100644 --- a/sys/sys/elf_generic.h +++ b/sys/sys/elf_generic.h @@ -71,6 +71,7 @@ __ElfType(Phdr); __ElfType(Dyn); __ElfType(Rel); __ElfType(Rela); +__ElfType(Relr); __ElfType(Sym); __ElfType(Verdef); __ElfType(Verdaux); From nobody Sat Oct 23 01:12:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5F80180F330; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjqz21yCz3pZd; Sat, 23 Oct 2021 01:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C741191B3; Sat, 23 Oct 2021 01:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CUD0051442; Sat, 23 Oct 2021 01:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CU4x051441; Sat, 23 Oct 2021 01:12:30 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:30 GMT Message-Id: <202110230112.19N1CU4x051441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c99fa2c634b3 - stable/13 - rtld: Support DT_RELR relative relocation format List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c99fa2c634b3349cae6a6678d60352ade22abf51 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c99fa2c634b3349cae6a6678d60352ade22abf51 commit c99fa2c634b3349cae6a6678d60352ade22abf51 Author: Fangrui Song AuthorDate: 2021-10-16 21:34:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 rtld: Support DT_RELR relative relocation format (cherry picked from commit a7d137fcbcac7182d4fcdc97a46b10edc5c7041d) --- libexec/rtld-elf/rtld.c | 36 ++++++++++++++++++++++++++++++++++++ libexec/rtld-elf/rtld.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 6c304f98253a..d598bb044f8e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1255,6 +1255,18 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath, assert(dynp->d_un.d_val == sizeof(Elf_Rela)); break; + case DT_RELR: + obj->relr = (const Elf_Relr *)(obj->relocbase + dynp->d_un.d_ptr); + break; + + case DT_RELRSZ: + obj->relrsize = dynp->d_un.d_val; + break; + + case DT_RELRENT: + assert(dynp->d_un.d_val == sizeof(Elf_Relr)); + break; + case DT_PLTREL: plttype = dynp->d_un.d_val; assert(dynp->d_un.d_val == DT_REL || plttype == DT_RELA); @@ -3148,6 +3160,29 @@ reloc_textrel_prot(Obj_Entry *obj, bool before) return (0); } +/* Process RELR relative relocations. */ +static void +reloc_relr(Obj_Entry *obj) +{ + const Elf_Relr *relr, *relrlim; + Elf_Addr *where; + + relrlim = (const Elf_Relr *)((const char *)obj->relr + obj->relrsize); + for (relr = obj->relr; relr < relrlim; relr++) { + Elf_Relr entry = *relr; + + if ((entry & 1) == 0) { + where = (Elf_Addr *)(obj->relocbase + entry); + *where++ += (Elf_Addr)obj->relocbase; + } else { + for (long i = 0; (entry >>= 1) != 0; i++) + if ((entry & 1) != 0) + where[i] += (Elf_Addr)obj->relocbase; + where += CHAR_BIT * sizeof(Elf_Relr) - 1; + } + } +} + /* * Relocate single object. * Returns 0 on success, or -1 on failure. @@ -3174,6 +3209,7 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, /* Process the non-PLT non-IFUNC relocations. */ if (reloc_non_plt(obj, rtldobj, flags, lockstate)) return (-1); + reloc_relr(obj); /* Re-protected the text segment. */ if (obj->textrel && reloc_textrel_prot(obj, false) != 0) diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 060b83b2cdad..b216e80115bc 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -174,6 +174,8 @@ typedef struct Struct_Obj_Entry { unsigned long relsize; /* Size in bytes of relocation info */ const Elf_Rela *rela; /* Relocation entries with addend */ unsigned long relasize; /* Size in bytes of addend relocation info */ + const Elf_Relr *relr; /* RELR relocation entries */ + unsigned long relrsize; /* Size in bytes of RELR relocations */ const Elf_Rel *pltrel; /* PLT relocation entries */ unsigned long pltrelsize; /* Size in bytes of PLT relocation info */ const Elf_Rela *pltrela; /* PLT relocation entries with addend */ From nobody Sat Oct 23 01:12:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A795F180F2EE; Sat, 23 Oct 2021 01:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbjr10M5Bz3plq; Sat, 23 Oct 2021 01:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C89F190E3; Sat, 23 Oct 2021 01:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1CWLs051466; Sat, 23 Oct 2021 01:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1CWAT051465; Sat, 23 Oct 2021 01:12:32 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:12:32 GMT Message-Id: <202110230112.19N1CWAT051465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a3876ab1eb87 - stable/13 - rtld-elf/paths.h: Make it usable outside rtld List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3876ab1eb8724f5fc4c3b5c44925603882426da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a3876ab1eb8724f5fc4c3b5c44925603882426da commit a3876ab1eb8724f5fc4c3b5c44925603882426da Author: Konstantin Belousov AuthorDate: 2021-10-12 15:50:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-22 23:32:27 +0000 rtld-elf/paths.h: Make it usable outside rtld (cherry picked from commit 33dba3bb0ec2a0f0a401bed145cc0ef95f37a5c3) --- libexec/rtld-elf/arm/reloc.c | 2 +- libexec/rtld-elf/libmap.c | 2 +- libexec/rtld-elf/rtld.c | 2 +- libexec/rtld-elf/rtld_malloc.c | 2 +- libexec/rtld-elf/{paths.h => rtld_paths.h} | 18 ++++++++++++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index 7779169667be..4eb3fc7e6929 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -16,7 +16,7 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "rtld.h" -#include "paths.h" +#include "rtld_paths.h" #ifdef __ARM_FP /* diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index e4388d14b951..854c73f39ef7 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -16,7 +16,7 @@ #include "debug.h" #include "rtld.h" #include "libmap.h" -#include "paths.h" +#include "rtld_paths.h" #include "rtld_libc.h" TAILQ_HEAD(lm_list, lm); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index d598bb044f8e..8b1f84c6901a 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "rtld.h" #include "libmap.h" -#include "paths.h" +#include "rtld_paths.h" #include "rtld_tls.h" #include "rtld_printf.h" #include "rtld_malloc.h" diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c index 63fa6f5e2ee7..d08254b67d9f 100644 --- a/libexec/rtld-elf/rtld_malloc.c +++ b/libexec/rtld-elf/rtld_malloc.c @@ -55,7 +55,7 @@ static char *rcsid = "$FreeBSD$"; #include #include "rtld.h" #include "rtld_printf.h" -#include "paths.h" +#include "rtld_paths.h" /* * Pre-allocate mmap'ed pages diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/rtld_paths.h similarity index 88% rename from libexec/rtld-elf/paths.h rename to libexec/rtld-elf/rtld_paths.h index 75f3b1d47dd4..4ce423ce6dbb 100644 --- a/libexec/rtld-elf/paths.h +++ b/libexec/rtld-elf/rtld_paths.h @@ -26,15 +26,19 @@ * $FreeBSD$ */ -#ifndef PATHS_H -#define PATHS_H +#ifndef _RTLD_PATHS_H +#define _RTLD_PATHS_H #undef _PATH_ELF_HINTS +#ifndef _COMPAT32_BASENAME_RTLD +#define _COMPAT32_BASENAME_RTLD "ld-elf32.so.1" +#endif + #ifdef COMPAT_32BIT #define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints" #define _PATH_LIBMAP_CONF "/etc/libmap32.conf" -#define _BASENAME_RTLD "ld-elf32.so.1" +#define _BASENAME_RTLD _COMPAT32_BASENAME_RTLD #define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32" #define LD_ "LD_32_" #endif @@ -55,6 +59,10 @@ #define _PATH_RTLD "/libexec/" _BASENAME_RTLD #endif +#ifndef _COMPAT32_PATH_RTLD +#define _COMPAT32_PATH_RTLD "/libexec/" _COMPAT32_BASENAME_RTLD +#endif + #ifndef STANDARD_LIBRARY_PATH #define STANDARD_LIBRARY_PATH "/lib/casper:/lib:/usr/lib" #endif @@ -69,10 +77,12 @@ #define SOFT_STANDARD_LIBRARY_PATH "/usr/libsoft" #define LD_SOFT_ "LD_SOFT_" +#ifdef IN_RTLD extern const char *ld_elf_hints_default; extern const char *ld_path_libmap_conf; extern const char *ld_path_rtld; extern const char *ld_standard_library_path; extern const char *ld_env_prefix; +#endif -#endif /* PATHS_H */ +#endif /* _RTLD_PATHS_H */ From nobody Sat Oct 23 01:54:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C4131181FFEE; Sat, 23 Oct 2021 01:54: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbkm457l9z4Wkh; Sat, 23 Oct 2021 01:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9023119C1F; Sat, 23 Oct 2021 01:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N1sCmR004062; Sat, 23 Oct 2021 01:54:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N1sC39004061; Sat, 23 Oct 2021 01:54:12 GMT (envelope-from git) Date: Sat, 23 Oct 2021 01:54:12 GMT Message-Id: <202110230154.19N1sC39004061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 9a00da73a3dc - stable/13 - ffs: retire unused fsckpid mount option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9a00da73a3dc15b5316e6eea805da8d2eeac4310 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=9a00da73a3dc15b5316e6eea805da8d2eeac4310 commit 9a00da73a3dc15b5316e6eea805da8d2eeac4310 Author: Robert Wing AuthorDate: 2021-10-02 23:11:40 +0000 Commit: Robert Wing CommitDate: 2021-10-23 01:37:17 +0000 ffs: retire unused fsckpid mount option The fsckpid mount option was introduced in 927a12ae16433b50 along with a couple sysctl's to support SU+J with snapshots. However, those sysctl's were never used and eventually removed in f2620e9ceb3ede02. There are no in-tree consumers of this mount option. Reviewed by: mckusick, kib Differential Revision: https://reviews.freebsd.org/D32015 (cherry picked from commit 9acea16404117f2f54475640ff036c12130707d8) --- sys/ufs/ffs/ffs_alloc.c | 3 +- sys/ufs/ffs/ffs_inode.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 117 ++--------------------------------------------- sys/ufs/ufs/ufsmount.h | 2 - 4 files changed, 6 insertions(+), 118 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 771377b7cefc..6a262a798d1b 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -3236,8 +3236,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) return (EINVAL); } ump = VFSTOUFS(mp); - if ((mp->mnt_flag & MNT_RDONLY) && - ump->um_fsckpid != td->td_proc->p_pid) { + if (mp->mnt_flag & MNT_RDONLY) { vn_finished_write(mp); fdrop(fp, td); return (EROFS); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 6bb7521cef4c..b78f46ae4ba0 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -132,7 +132,7 @@ ffs_update(vp, waitfor) if (waitfor) ip->i_flag &= ~(IN_SIZEMOD | IN_IBLKDATA); fs = ITOFS(ip); - if (fs->fs_ronly && ITOUMP(ip)->um_fsckpid == 0) + if (fs->fs_ronly) return (0); /* * If we are updating a snapshot and another process is currently diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index d5f20690793d..fb00218f5d3a 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -147,7 +147,7 @@ static struct buf_ops ffs_ops = { */ static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "noclusterw", "noexec", "export", "force", "from", "groupquota", - "multilabel", "nfsv4acls", "fsckpid", "snapshot", "nosuid", "suiddir", + "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync", "union", "userquota", "untrusted", NULL }; static int ffs_enxio_enable = 1; @@ -374,7 +374,6 @@ ffs_mount(struct mount *mp) struct thread *td; struct ufsmount *ump = NULL; struct fs *fs; - pid_t fsckpid = 0; int error, error1, flags; uint64_t mntorflags, saved_mnt_flag; accmode_t accmode; @@ -422,31 +421,6 @@ ffs_mount(struct mount *mp) vfs_deleteopt(mp->mnt_opt, "snapshot"); } - if (vfs_getopt(mp->mnt_optnew, "fsckpid", NULL, NULL) == 0 && - vfs_scanopt(mp->mnt_optnew, "fsckpid", "%d", &fsckpid) == 1) { - /* - * Once we have set the restricted PID, do not - * persist "fsckpid" in the options list. - */ - vfs_deleteopt(mp->mnt_optnew, "fsckpid"); - vfs_deleteopt(mp->mnt_opt, "fsckpid"); - if (mp->mnt_flag & MNT_UPDATE) { - if (VFSTOUFS(mp)->um_fs->fs_ronly == 0 && - vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - } else if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - /* Set to -1 if we are done */ - if (fsckpid == 0) - fsckpid = -1; - } - if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { vfs_mount_error(mp, @@ -470,18 +444,6 @@ ffs_mount(struct mount *mp) fs = ump->um_fs; odevvp = ump->um_odevvp; devvp = ump->um_devvp; - if (fsckpid == -1 && ump->um_fsckpid > 0) { - if ((error = ffs_flushfiles(mp, WRITECLOSE, td)) != 0 || - (error = ffs_sbupdate(ump, MNT_WAIT, 0)) != 0) - return (error); - g_topology_lock(); - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - g_topology_unlock(); - ump->um_fsckpid = 0; - } if (fs->fs_ronly == 0 && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { /* @@ -569,14 +531,6 @@ ffs_mount(struct mount *mp) return (error); if (fs->fs_ronly && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - /* - * If we are running a checker, do not allow upgrade. - */ - if (ump->um_fsckpid > 0) { - vfs_mount_error(mp, - "Active checker, cannot upgrade to write"); - return (EINVAL); - } /* * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. @@ -686,39 +640,6 @@ ffs_mount(struct mount *mp) mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); } - /* - * If this is a request from fsck to clean up the filesystem, - * then allow the specified pid to proceed. - */ - if (fsckpid > 0) { - if (ump->um_fsckpid != 0) { - vfs_mount_error(mp, - "Active checker already running on %s", - fs->fs_fsmnt); - return (EINVAL); - } - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - vfs_mount_error(mp, - "Checker activation failed on %s", - fs->fs_fsmnt); - return (error); - } - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_fmod = 1; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } /* * If this is a snapshot request, take the snapshot. @@ -798,29 +719,6 @@ ffs_mount(struct mount *mp) vrele(devvp); return (error); } - if (fsckpid > 0) { - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - ump = VFSTOUFS(mp); - fs = ump->um_fs; - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - printf("WARNING: %s: Checker activation " - "failed\n", fs->fs_fsmnt); - } else { - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } - } } MNT_ILOCK(mp); @@ -1541,7 +1439,7 @@ ffs_unmount(mp, mntflags) if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); MPASS(ump->um_softdep == NULL); - if (fs->fs_ronly == 0 || ump->um_fsckpid > 0) { + if (fs->fs_ronly == 0) { fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1; error = ffs_sbupdate(ump, MNT_WAIT, 0); if (ffs_fsfail_cleanup(ump, error)) @@ -1561,13 +1459,6 @@ ffs_unmount(mp, mntflags) free (ump->um_trimhash, M_TRIM); } g_topology_lock(); - if (ump->um_fsckpid > 0) { - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - ump->um_fsckpid = 0; - } g_vfs_close(ump->um_cp); g_topology_unlock(); BO_LOCK(&ump->um_odevvp->v_bufobj); @@ -1833,7 +1724,7 @@ ffs_sync(mp, waitfor) suspended = 0; td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + if (fs->fs_fmod != 0 && fs->fs_ronly != 0) panic("%s: ffs_sync: modification on read-only filesystem", fs->fs_fsmnt); if (waitfor == MNT_LAZY) { @@ -2304,7 +2195,7 @@ ffs_sbupdate(ump, waitfor, suspended) fs = ump->um_fs; if (fs->fs_ronly == 1 && (ump->um_mountp->mnt_flag & (MNT_RDONLY | MNT_UPDATE)) != - (MNT_RDONLY | MNT_UPDATE) && ump->um_fsckpid == 0) + (MNT_RDONLY | MNT_UPDATE)) panic("ffs_sbupdate: write read-only filesystem"); /* * We use the superblock's buf to serialize calls to ffs_sbupdate(). diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index 0b90cae95ff5..2e7865070025 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -85,7 +85,6 @@ struct fsfail_task { * i - ufsmount interlock (UFS_LOCK / UFS_UNLOCK) * q - associated quota file is locked * r - ref to parent mount structure is held (vfs_busy / vfs_unbusy) - * u - managed by user process fsck_ufs */ struct ufsmount { struct mount *um_mountp; /* (r) filesystem vfs struct */ @@ -105,7 +104,6 @@ struct ufsmount { struct mtx um_lock; /* (c) Protects ufsmount & fs */ struct sx um_checkpath_lock; /* (c) Protects ufs_checkpath() result */ - pid_t um_fsckpid; /* (u) PID can do fsck sysctl */ struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */ struct vnode *um_quotas[MAXQUOTAS]; /* (q) pointer to quota files */ struct ucred *um_cred[MAXQUOTAS]; /* (q) quota file access cred */ From nobody Sat Oct 23 04:04:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3EBC2180E8B0; Sat, 23 Oct 2021 04:04: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbnfB1N0vz3MZg; Sat, 23 Oct 2021 04:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EDA41B6C6; Sat, 23 Oct 2021 04:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N44HaL078589; Sat, 23 Oct 2021 04:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N44H5G078588; Sat, 23 Oct 2021 04:04:17 GMT (envelope-from git) Date: Sat, 23 Oct 2021 04:04:17 GMT Message-Id: <202110230404.19N44H5G078588@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: 3550a49f6814 - main - msun: Add copyright notices List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 3550a49f6814af38c21b0033ef8746953451dade Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3550a49f6814af38c21b0033ef8746953451dade commit 3550a49f6814af38c21b0033ef8746953451dade Author: Warner Losh AuthorDate: 2021-10-23 04:00:54 +0000 Commit: Warner Losh CommitDate: 2021-10-23 04:00:54 +0000 msun: Add copyright notices These files were copied from MUSL. Add the standard copyright notice and SPDX-License-Identifier: MIT consistent with our new draft license policy. It reads word for word the same as the MIT license on the SPDX web site. Add a pointer to the MUSL COPYIRGHT file which contains a list of all authors of MUSL. Sponsored by: Netflix Noticed by: Steve Kargl --- lib/msun/src/s_scalbn.c | 8 ++++++++ lib/msun/src/s_scalbnf.c | 8 ++++++++ lib/msun/src/s_scalbnl.c | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/lib/msun/src/s_scalbn.c b/lib/msun/src/s_scalbn.c index 3de663f8b670..2d4f7a3c6164 100644 --- a/lib/msun/src/s_scalbn.c +++ b/lib/msun/src/s_scalbn.c @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2005-2020 Rich Felker, et al. + * + * SPDX-License-Identifier: MIT + * + * Please see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT + * for all contributors to musl. + */ #include #include #include diff --git a/lib/msun/src/s_scalbnf.c b/lib/msun/src/s_scalbnf.c index 3a46470b5661..8cf1e01150da 100644 --- a/lib/msun/src/s_scalbnf.c +++ b/lib/msun/src/s_scalbnf.c @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2005-2020 Rich Felker, et al. + * + * SPDX-License-Identifier: MIT + * + * Please see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT + * for all contributors to musl. + */ #include #include diff --git a/lib/msun/src/s_scalbnl.c b/lib/msun/src/s_scalbnl.c index a79f79b33480..6044c1b1d4f7 100644 --- a/lib/msun/src/s_scalbnl.c +++ b/lib/msun/src/s_scalbnl.c @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2005-2020 Rich Felker, et al. + * + * SPDX-License-Identifier: MIT + * + * Please see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT + * for all contributors to musl. + */ #include #include #include "math_private.h" From nobody Sat Oct 23 06:40:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9A2C917F3912; Sat, 23 Oct 2021 06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hbs623yJfz4lWC; Sat, 23 Oct 2021 06:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67AE71DA96; Sat, 23 Oct 2021 06:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N6eAT7080609; Sat, 23 Oct 2021 06:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N6eA5T080606; Sat, 23 Oct 2021 06:40:10 GMT (envelope-from git) Date: Sat, 23 Oct 2021 06:40:10 GMT Message-Id: <202110230640.19N6eA5T080606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 50b8e3efaf9e - main - stress2: Fix typo List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50b8e3efaf9e3ec554723c23acd1f0765190067a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=50b8e3efaf9e3ec554723c23acd1f0765190067a commit 50b8e3efaf9e3ec554723c23acd1f0765190067a Author: Peter Holm AuthorDate: 2021-10-23 06:39:36 +0000 Commit: Peter Holm CommitDate: 2021-10-23 06:39:36 +0000 stress2: Fix typo --- tools/test/stress2/misc/force9.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/stress2/misc/force9.sh b/tools/test/stress2/misc/force9.sh index 325b227888a6..a62e00242a67 100755 --- a/tools/test/stress2/misc/force9.sh +++ b/tools/test/stress2/misc/force9.sh @@ -31,7 +31,7 @@ # "panic: ffs_checkblk: cylinder group read failed" seen: # https://people.freebsd.org/~pho/stress/log/log0170.txt -" "panic: softdep_update_inodeblock inconsistent ip ..." seen: +# "panic: softdep_update_inodeblock inconsistent ip ..." seen: # https://people.freebsd.org/~pho/stress/log/log0184.txt [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 From nobody Sat Oct 23 08:15:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 843BC180D8A2; Sat, 23 Oct 2021 08:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbvCX20qVz3QH4; Sat, 23 Oct 2021 08:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0761E1EFA1; Sat, 23 Oct 2021 08:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N8F3Jm010181; Sat, 23 Oct 2021 08:15:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N8F3DZ010180; Sat, 23 Oct 2021 08:15:03 GMT (envelope-from git) Date: Sat, 23 Oct 2021 08:15:03 GMT Message-Id: <202110230815.19N8F3DZ010180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 3417c29851b6 - main - linux: Constify bsd_to_linux_regset() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3417c29851b6fce32b4c459b4c0a197b2e33018b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=3417c29851b6fce32b4c459b4c0a197b2e33018b commit 3417c29851b6fce32b4c459b4c0a197b2e33018b Author: Edward Tomasz Napierala AuthorDate: 2021-10-23 07:33:48 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 07:33:58 +0000 linux: Constify bsd_to_linux_regset() No functional changes. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32599 --- sys/amd64/linux/linux.h | 2 +- sys/amd64/linux/linux_machdep.c | 2 +- sys/amd64/linux32/linux.h | 2 +- sys/amd64/linux32/linux32_machdep.c | 3 ++- sys/arm64/linux/linux.h | 2 +- sys/arm64/linux/linux_machdep.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 9080bcb36cbc..519b6bd200ac 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -459,7 +459,7 @@ struct linux_pt_regset { struct reg; -void bsd_to_linux_regset(struct reg *b_reg, +void bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset); #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index dc6b6140f60c..c34d98e86d0b 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -299,7 +299,7 @@ DEFINE_IFUNC(, int, futex_xorl, (int, uint32_t *, int *)) } void -bsd_to_linux_regset(struct reg *b_reg, struct linux_pt_regset *l_regset) +bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset) { l_regset->r15 = b_reg->r_r15; diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 8d7a36eedee9..f1f877181e47 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -634,7 +634,7 @@ struct linux_pt_regset32 { struct reg32; -void bsd_to_linux_regset32(struct reg32 *b_reg, +void bsd_to_linux_regset32(const struct reg32 *b_reg, struct linux_pt_regset32 *l_regset); #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 5801fac7f126..86f7bdc918d8 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -678,7 +678,8 @@ linux_set_thread_area(struct thread *td, } void -bsd_to_linux_regset32(struct reg32 *b_reg, struct linux_pt_regset32 *l_regset) +bsd_to_linux_regset32(const struct reg32 *b_reg, + struct linux_pt_regset32 *l_regset) { l_regset->ebx = b_reg->r_ebx; diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index b5273498a5aa..5e4bf3ae0680 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -322,7 +322,7 @@ struct linux_pt_regset { struct reg; -void bsd_to_linux_regset(struct reg *b_reg, +void bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset); #endif /* _ARM64_LINUX_H_ */ diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index fae5bd11653b..c874f86a5f0c 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -133,7 +133,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } void -bsd_to_linux_regset(struct reg *b_reg, struct linux_pt_regset *l_regset) +bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset) { KASSERT(sizeof(l_regset->x) == sizeof(b_reg->x) + sizeof(l_ulong), From nobody Sat Oct 23 08:27:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E66D01810E6C; Sat, 23 Oct 2021 08:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbvTJ5wDgz3j16; Sat, 23 Oct 2021 08:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB76A1EEEC; Sat, 23 Oct 2021 08:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N8R0qQ023388; Sat, 23 Oct 2021 08:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N8R0iO023387; Sat, 23 Oct 2021 08:27:00 GMT (envelope-from git) Date: Sat, 23 Oct 2021 08:27:00 GMT Message-Id: <202110230827.19N8R0iO023387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 2c7f79828254 - main - linux: Fix ENOTSOCK handling in sendfile(2) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c7f7982825442c851e8bb17555a086a232ef4d9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=2c7f7982825442c851e8bb17555a086a232ef4d9 commit 2c7f7982825442c851e8bb17555a086a232ef4d9 Author: Edward Tomasz Napierala AuthorDate: 2021-10-23 08:15:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 08:15:58 +0000 linux: Fix ENOTSOCK handling in sendfile(2) The Linux way for sendfile(2) to tell the application to fallback to another way of copying data is by EINVAL, not ENOTSOCK. This fixes package installation scripts for Mono packages from Focal. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32604 --- sys/compat/linux/linux_socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 9ae44b909d80..a2b45edf7bdc 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -2101,6 +2101,8 @@ linux_sendfile_common(struct thread *td, l_int out, l_int in, td->td_retval[0] = (ssize_t)bytes_read; drop: fdrop(fp, td); + if (error == ENOTSOCK) + error = EINVAL; return (error); } From nobody Sat Oct 23 08:31:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4E9E51813EBD; Sat, 23 Oct 2021 08:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbvZr1qVDz3kpL; Sat, 23 Oct 2021 08:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E5881EFDE; Sat, 23 Oct 2021 08:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19N8VmO4032857; Sat, 23 Oct 2021 08:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19N8Vmbr032856; Sat, 23 Oct 2021 08:31:48 GMT (envelope-from git) Date: Sat, 23 Oct 2021 08:31:48 GMT Message-Id: <202110230831.19N8Vmbr032856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: e3a83df1195c - main - linux: Improve debug for PTRACE_GETREGSET List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3a83df1195cc4f48f2908b423b5c80dd9c49a21 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e3a83df1195cc4f48f2908b423b5c80dd9c49a21 commit e3a83df1195cc4f48f2908b423b5c80dd9c49a21 Author: Edward Tomasz Napierala AuthorDate: 2021-10-22 18:58:52 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 08:30:06 +0000 linux: Improve debug for PTRACE_GETREGSET No functional changes. Sponsored By: EPSRC --- sys/amd64/linux/linux_ptrace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 370b1c818b6f..b8123221f463 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_O_SUSPEND_SECCOMP 2097152 #define LINUX_NT_PRSTATUS 0x1 +#define LINUX_NT_PRFPREG 0x2 #define LINUX_NT_X86_XSTATE 0x202 #define LINUX_PTRACE_O_MASK (LINUX_PTRACE_O_TRACESYSGOOD | \ @@ -541,6 +542,10 @@ linux_ptrace_getregset(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) switch (addr) { case LINUX_NT_PRSTATUS: return (linux_ptrace_getregset_prstatus(td, pid, data)); + case LINUX_NT_PRFPREG: + linux_msg(td, "PTRAGE_GETREGSET NT_PRFPREG not implemented; " + "returning EINVAL"); + return (EINVAL); case LINUX_NT_X86_XSTATE: linux_msg(td, "PTRAGE_GETREGSET NT_X86_XSTATE not implemented; " "returning EINVAL"); From nobody Sat Oct 23 12:45:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3F1DC1801CF2; Sat, 23 Oct 2021 12:45:52 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from mailgate.Leidinger.net (bastille.leidinger.net [89.238.82.207]) (using TLSv1.3 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 (P-256) client-digest SHA256) (Client CN "mailgate.leidinger.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc1Cz6zDsz3mwj; Sat, 23 Oct 2021 12:45:51 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from outgoing.leidinger.net (p508d5160.dip0.t-ipconnect.de [80.141.81.96]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256 client-signature ECDSA (P-256) client-digest SHA256) (Client CN "outgoing.leidinger.net", Issuer "R3" (verified OK)) by mailgate.Leidinger.net (Postfix) with ESMTPSA id C541F296D8; Sat, 23 Oct 2021 14:45:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leidinger.net; s=outgoing-alex; t=1634993142; 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=jZngrhoBkyR1MUemWQCFcmPbCTrIjYapEGDo4e0Jg5k=; b=nZpvVktJelAh+dX5mgwHsdHXeJrw9zgyl+aWT7/nFQOIDOL9CzL928IYeEiiT/1rfy+L3r KQTxs7PFT2AZu/+2xhh0hAMrOhi4GI+BTWeNUBT+4vgx+hgRYE+Wp7nT7EtHqpVmHjQ5EB O0IJNUdp8QywnCCXQdrXp2w+Q6bHffoJh405q4wwuHROBaoIA/A9R4AOAF00suPAp/Oyyq QcrYXsCQmYPSeDbjaCMj7tfCDXs/JKq13OPiw2ThlS7B5lDxKuGizgY0wkKOJs2xodrwq4 90BgZ+rciJz+rvoRn1ueYUoEiuc2K37h3uy3/qErb96j0URKDL48cGfQAuyqaQ== Received: from webmail.leidinger.net (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (Client did not present a certificate) by outgoing.leidinger.net (Postfix) with ESMTPS id AF0CB62D5; Sat, 23 Oct 2021 14:45:38 +0200 (CEST) Date: Sat, 23 Oct 2021 14:45:36 +0200 Message-ID: <20211023144536.Horde.FrlbSo1SLHpgxnKlAIimdzS@webmail.leidinger.net> To: Emmanuel Vadot Cc: Benjamin Kaduk , "Rodney W. Grimes" , "Rodney W. Grimes" , gljennjohn@gmail.com, Gleb Smirnoff , Slawa Olhovchenkov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> In-Reply-To: <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> Accept-Language: de,en Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Queue-Id: 4Hc1Cz6zDsz3mwj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: Alexander@leidinger.net From: Alexander Leidinger via dev-commits-src-all X-Original-From: Alexander Leidinger X-ThisMailContainsUnwantedMimeParts: N Quoting Emmanuel Vadot (from Fri, 22 Oct 2021 22:55:40 +0200): > I honestly thought that this setting was something that you setup once > when you installed a new machine (which doesn't happens very often) and > forget about it, you know another "ah crap yes I forgot about this, why > do we have such insane default. Oh well now that I disabled it locally > I don't have to think about it and won't change the default". Instead > this time I didn't say to myself that I won't change it and I did. May I offer another perspective into this? Something outside of 0 and 1... I wonder if it is really the default of bell=on is what is crap, or if the bug Warner found is what makes it crap, or if the frequency of the current setting is what makes it crap (or the two last items together). Personally I dislike the bell, but not as much that I want to disable it. I don't mind to have it disabled (I simply enabled it directly in sysctl.conf even as I haven't updated to past the commit), as I think it gives usefull feedback. It may not give useful feedback in all cases where it goes off, but that's something we have influence on, don't we? What I don't like about the bell is the noise it makes. So what about changing the noise it makes to something more pleasant and asking if this is better and maybe acceptable to those which don't like the bell? I also think that disabling a feature you know it exists but you don't like is much more easy than to enable a feature you don't know exists. Basically I question in this email the problem you want to solve by disabling the bell. Does it really need to be disabled, or would a change of the sound and volume make it acceptable for you (you = all people which complain or agree to "the current one is crap -> disable it" .... which basically means we would need to make some kind of usability test what sounds better before deciding if it shall be disabled or not)? For me the issue with the bell would be solved if it sounds "better" and is less loud. I assume we could even make it configurable to some extend (override a hardcoded frequency and volume with a sysctl). Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF From nobody Sat Oct 23 18:10:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 914A21825EE5; Sat, 23 Oct 2021 18:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc8QJ1QYTz4tHP; Sat, 23 Oct 2021 18:10:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E37A5267F7; Sat, 23 Oct 2021 18:10:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NIAFmX000437; Sat, 23 Oct 2021 18:10:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NIAFhc000431; Sat, 23 Oct 2021 18:10:15 GMT (envelope-from git) Date: Sat, 23 Oct 2021 18:10:15 GMT Message-Id: <202110231810.19NIAFhc000431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 2558bb8e9166 - main - linux: Make PTRACE_GET_SYSCALL_INFO handle EJUSTRETURN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2558bb8e9166395dce26afcfac91fc692621de7b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=2558bb8e9166395dce26afcfac91fc692621de7b commit 2558bb8e9166395dce26afcfac91fc692621de7b Author: Edward Tomasz Napierala AuthorDate: 2021-10-23 17:56:29 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 17:56:39 +0000 linux: Make PTRACE_GET_SYSCALL_INFO handle EJUSTRETURN This fixes panic when trying to run strace(8) from Focal. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32355 --- sys/amd64/linux/linux_ptrace.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index b8123221f463..37f136856ef0 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -616,6 +616,15 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, if (sr.sr_error == 0) { si.exit.rval = sr.sr_retval[0]; si.exit.is_error = 0; + } else if (sr.sr_error == EJUSTRETURN) { + /* + * EJUSTRETURN means the actual value to return + * has already been put into td_frame; instead + * of extracting it and trying to determine whether + * it's an error or not just bail out and let + * the ptracing process fall back to another method. + */ + si.op = LINUX_PTRACE_SYSCALL_INFO_NONE; } else { si.exit.rval = bsd_to_linux_errno(sr.sr_error); si.exit.is_error = 1; From nobody Sat Oct 23 18:20:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 104A91802A7B; Sat, 23 Oct 2021 18:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc8fB00Htz4wk9; Sat, 23 Oct 2021 18:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3C0F26E08; Sat, 23 Oct 2021 18:20:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NIKX9H016583; Sat, 23 Oct 2021 18:20:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NIKXSM016582; Sat, 23 Oct 2021 18:20:33 GMT (envelope-from git) Date: Sat, 23 Oct 2021 18:20:33 GMT Message-Id: <202110231820.19NIKXSM016582@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: 4b9725184e31 - main - Fix clang's internal assembler adding unwanted prefix to VIA xstore List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b9725184e315596aa401cecb230033c6d6d5f29 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=4b9725184e315596aa401cecb230033c6d6d5f29 commit 4b9725184e315596aa401cecb230033c6d6d5f29 Author: Dimitry Andric AuthorDate: 2021-10-23 18:19:26 +0000 Commit: Dimitry Andric CommitDate: 2021-10-23 18:20:00 +0000 Fix clang's internal assembler adding unwanted prefix to VIA xstore Merge commit 2d8c18fbbdd1 from llvm git (by Jessica Clarke): [X86] Don't add implicit REP prefix to VIA PadLock xstore Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock instructions, but GNU as doesn't add one to xstore, only all the others. This resulted in a kernel panic regression in FreeBSD upon updating to LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in question. This partially reverts that commit. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D112355 MFC after: 3 days --- contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td index eb8740896e5d..89b6dbdab5dc 100644 --- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td +++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td @@ -585,7 +585,7 @@ def XRSTORS64 : RI<0xC7, MRM3m, (outs), (ins opaquemem:$dst), //===----------------------------------------------------------------------===// // VIA PadLock crypto instructions let Defs = [RAX, RDI], Uses = [RDX, RDI], SchedRW = [WriteSystem] in - def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB, REP; + def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB; def : InstAlias<"xstorerng", (XSTORE)>; From nobody Sat Oct 23 18:46:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D06A9180F076; Sat, 23 Oct 2021 18:46: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc9DB5db6z53v3; Sat, 23 Oct 2021 18:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 969CF26F7E; Sat, 23 Oct 2021 18:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NIkY2M047889; Sat, 23 Oct 2021 18:46:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NIkYg9047888; Sat, 23 Oct 2021 18:46:34 GMT (envelope-from git) Date: Sat, 23 Oct 2021 18:46:34 GMT Message-Id: <202110231846.19NIkYg9047888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6e66030c4c05 - main - linux: implement PTRACE_EVENT_EXEC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e66030c4c05331f9b0adf87c31f2f233dd3ae1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6e66030c4c05331f9b0adf87c31f2f233dd3ae1f commit 6e66030c4c05331f9b0adf87c31f2f233dd3ae1f Author: Edward Tomasz Napierala AuthorDate: 2021-10-23 18:13:14 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 18:46:26 +0000 linux: implement PTRACE_EVENT_EXEC This fixes strace(1) from Ubuntu Focal. Reviewed By: jhb Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32367 --- sys/amd64/linux/linux_ptrace.c | 9 +++++++-- sys/kern/subr_syscall.c | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 37f136856ef0..d7dffc92dd11 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_SEIZE 0x4206 #define LINUX_PTRACE_GET_SYSCALL_INFO 0x420e +#define LINUX_PTRACE_EVENT_EXEC 4 #define LINUX_PTRACE_EVENT_EXIT 6 #define LINUX_PTRACE_O_TRACESYSGOOD 1 @@ -151,8 +152,12 @@ linux_ptrace_status(struct thread *td, pid_t pid, int status) lwpinfo.pl_flags & PL_FLAG_SCE) status |= (LINUX_SIGTRAP | 0x80) << 8; if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && - lwpinfo.pl_flags & PL_FLAG_SCX) - status |= (LINUX_SIGTRAP | 0x80) << 8; + lwpinfo.pl_flags & PL_FLAG_SCX) { + if (lwpinfo.pl_flags & PL_FLAG_EXEC) + status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXEC << 8) << 8; + else + status |= (LINUX_SIGTRAP | 0x80) << 8; + } if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACEEXIT) && lwpinfo.pl_flags & PL_FLAG_EXITED) status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXIT << 8) << 8; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index ada2053bc87c..fab67a68b0a3 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -254,6 +254,18 @@ syscallret(struct thread *td) if (__predict_false(traced || (td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0)) { PROC_LOCK(p); + /* + * Linux debuggers expect an additional stop for exec, + * between the usual syscall entry and exit. Raise + * the exec event now and then clear TDB_EXEC so that + * the next stop is reported as a syscall exit by + * linux_ptrace_status(). + */ + if ((td->td_dbgflags & TDB_EXEC) != 0 && + SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) { + ptracestop(td, SIGTRAP, NULL); + td->td_dbgflags &= ~TDB_EXEC; + } /* * If tracing the execed process, trap to the debugger * so that breakpoints can be set before the program From nobody Sat Oct 23 18:53:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ED7BB18121E8; Sat, 23 Oct 2021 18:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc9NV6NnTz55b4; Sat, 23 Oct 2021 18:53:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB761274AF; Sat, 23 Oct 2021 18:53:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NIrkGV060783; Sat, 23 Oct 2021 18:53:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NIrk3H060782; Sat, 23 Oct 2021 18:53:46 GMT (envelope-from git) Date: Sat, 23 Oct 2021 18:53:46 GMT Message-Id: <202110231853.19NIrk3H060782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 2ec26ae402fc - main - linux: Improve debug for PTRACE_GETEVENTMSG List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ec26ae402fc2589cb97bb5aa713b6d0ba080c17 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=2ec26ae402fc2589cb97bb5aa713b6d0ba080c17 commit 2ec26ae402fc2589cb97bb5aa713b6d0ba080c17 Author: Edward Tomasz Napierala AuthorDate: 2021-10-23 18:53:12 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-23 18:53:12 +0000 linux: Improve debug for PTRACE_GETEVENTMSG No functional changes. Sponsored By: EPSRC --- sys/amd64/linux/linux_ptrace.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index d7dffc92dd11..b7d0838fb054 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_DETACH 17 #define LINUX_PTRACE_SYSCALL 24 #define LINUX_PTRACE_SETOPTIONS 0x4200 +#define LINUX_PTRACE_GETEVENTMSG 0x4201 #define LINUX_PTRACE_GETSIGINFO 0x4202 #define LINUX_PTRACE_GETREGSET 0x4204 #define LINUX_PTRACE_SEIZE 0x4206 @@ -393,6 +394,14 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, &mask, sizeof(mask))); } +static int +linux_ptrace_geteventmsg(struct thread *td, pid_t pid, l_ulong data) +{ + + linux_msg(td, "PTRACE_GETEVENTMSG not implemented; returning EINVAL"); + return (EINVAL); +} + static int linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) { @@ -735,6 +744,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) case LINUX_PTRACE_SETOPTIONS: error = linux_ptrace_setoptions(td, pid, uap->data); break; + case LINUX_PTRACE_GETEVENTMSG: + error = linux_ptrace_geteventmsg(td, pid, uap->data); + break; case LINUX_PTRACE_GETSIGINFO: error = linux_ptrace_getsiginfo(td, pid, uap->data); break; From nobody Sat Oct 23 19:02:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 64DA01815539; Sat, 23 Oct 2021 19:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc9ZD2TkQz57dS; Sat, 23 Oct 2021 19:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3598827616; Sat, 23 Oct 2021 19:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NJ2Cir075315; Sat, 23 Oct 2021 19:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NJ2C7W075314; Sat, 23 Oct 2021 19:02:12 GMT (envelope-from git) Date: Sat, 23 Oct 2021 19:02:12 GMT Message-Id: <202110231902.19NJ2C7W075314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: aba2dc46dfa5 - stable/12 - cmp: initialize limit to avoid stack garbage limits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: aba2dc46dfa51cf9e1b1987ca4e91f703ae7e368 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=aba2dc46dfa51cf9e1b1987ca4e91f703ae7e368 commit aba2dc46dfa51cf9e1b1987ca4e91f703ae7e368 Author: Kyle Evans AuthorDate: 2021-10-21 16:30:55 +0000 Commit: Kyle Evans CommitDate: 2021-10-23 19:01:39 +0000 cmp: initialize limit to avoid stack garbage limits Pointy hat: kevans Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]") Sponsored by: Klara, Inc. (cherry picked from commit f1f7f31366e5830f4f5b96c6394a0b91475744f4) --- usr.bin/cmp/cmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 98ae96c73375..83ea7ae7eee0 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -105,7 +105,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; - skip1 = skip2 = 0; + limit = skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { From nobody Sat Oct 23 19:02:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99B7E181582C; Sat, 23 Oct 2021 19:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hc9ZN1tv6z57nH; Sat, 23 Oct 2021 19:02:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1621F274D9; Sat, 23 Oct 2021 19:02:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19NJ2JSv075436; Sat, 23 Oct 2021 19:02:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19NJ2JH0075435; Sat, 23 Oct 2021 19:02:19 GMT (envelope-from git) Date: Sat, 23 Oct 2021 19:02:19 GMT Message-Id: <202110231902.19NJ2JH0075435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b6aec7884750 - stable/13 - cmp: initialize limit to avoid stack garbage limits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b6aec78847501c4f7a79552651991e0842ecaec3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b6aec78847501c4f7a79552651991e0842ecaec3 commit b6aec78847501c4f7a79552651991e0842ecaec3 Author: Kyle Evans AuthorDate: 2021-10-21 16:30:55 +0000 Commit: Kyle Evans CommitDate: 2021-10-23 19:01:00 +0000 cmp: initialize limit to avoid stack garbage limits Pointy hat: kevans Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]") Sponsored by: Klara, Inc. (cherry picked from commit f1f7f31366e5830f4f5b96c6394a0b91475744f4) --- usr.bin/cmp/cmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 98ae96c73375..83ea7ae7eee0 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -105,7 +105,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; - skip1 = skip2 = 0; + limit = skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { From nobody Sat Oct 23 22:12:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D5760181DF08; Sat, 23 Oct 2021 22:12:48 +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 4HcFp84MKsz4l7D; Sat, 23 Oct 2021 22:12:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19NMCY1P084186 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 24 Oct 2021 01:12:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19NMCY1P084186 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19NMCYM1084185; Sun, 24 Oct 2021 01:12:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 24 Oct 2021 01:12:34 +0300 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6e66030c4c05 - main - linux: implement PTRACE_EVENT_EXEC Message-ID: References: <202110231846.19NIkYg9047888@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202110231846.19NIkYg9047888@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HcFp84MKsz4l7D X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sat, Oct 23, 2021 at 06:46:34PM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=6e66030c4c05331f9b0adf87c31f2f233dd3ae1f > > commit 6e66030c4c05331f9b0adf87c31f2f233dd3ae1f > Author: Edward Tomasz Napierala > AuthorDate: 2021-10-23 18:13:14 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-10-23 18:46:26 +0000 > > linux: implement PTRACE_EVENT_EXEC > > This fixes strace(1) from Ubuntu Focal. > > Reviewed By: jhb > Sponsored By: EPSRC > Differential Revision: https://reviews.freebsd.org/D32367 > --- > sys/amd64/linux/linux_ptrace.c | 9 +++++++-- > sys/kern/subr_syscall.c | 12 ++++++++++++ > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c > index 37f136856ef0..d7dffc92dd11 100644 > --- a/sys/amd64/linux/linux_ptrace.c > +++ b/sys/amd64/linux/linux_ptrace.c > @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); > #define LINUX_PTRACE_SEIZE 0x4206 > #define LINUX_PTRACE_GET_SYSCALL_INFO 0x420e > > +#define LINUX_PTRACE_EVENT_EXEC 4 > #define LINUX_PTRACE_EVENT_EXIT 6 > > #define LINUX_PTRACE_O_TRACESYSGOOD 1 > @@ -151,8 +152,12 @@ linux_ptrace_status(struct thread *td, pid_t pid, int status) > lwpinfo.pl_flags & PL_FLAG_SCE) > status |= (LINUX_SIGTRAP | 0x80) << 8; > if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && > - lwpinfo.pl_flags & PL_FLAG_SCX) > - status |= (LINUX_SIGTRAP | 0x80) << 8; > + lwpinfo.pl_flags & PL_FLAG_SCX) { > + if (lwpinfo.pl_flags & PL_FLAG_EXEC) > + status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXEC << 8) << 8; > + else > + status |= (LINUX_SIGTRAP | 0x80) << 8; > + } > if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACEEXIT) && > lwpinfo.pl_flags & PL_FLAG_EXITED) > status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXIT << 8) << 8; > diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c > index ada2053bc87c..fab67a68b0a3 100644 > --- a/sys/kern/subr_syscall.c > +++ b/sys/kern/subr_syscall.c > @@ -254,6 +254,18 @@ syscallret(struct thread *td) > if (__predict_false(traced || > (td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0)) { > PROC_LOCK(p); > + /* > + * Linux debuggers expect an additional stop for exec, > + * between the usual syscall entry and exit. Raise > + * the exec event now and then clear TDB_EXEC so that > + * the next stop is reported as a syscall exit by > + * linux_ptrace_status(). > + */ > + if ((td->td_dbgflags & TDB_EXEC) != 0 && > + SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) { > + ptracestop(td, SIGTRAP, NULL); > + td->td_dbgflags &= ~TDB_EXEC; > + } > /* > * If tracing the execed process, trap to the debugger > * so that breakpoints can be set before the program You committed before we finished the discussion. In fact I do not think it is right. Now it generates spurious stop for FreeBSD native debugger, and probably de-synchronize SCX/SCE pairing for it as well. In other words, you need to generate this stop based on ABI of the debugger, not debuggeeeeee. From nobody Sun Oct 24 00:27:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D7F4C180DF61; Sun, 24 Oct 2021 00:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcJnH5l2Lz3r5J; Sun, 24 Oct 2021 00:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A17E7345A; Sun, 24 Oct 2021 00:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19O0RFa5004652; Sun, 24 Oct 2021 00:27:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19O0RFbe004651; Sun, 24 Oct 2021 00:27:15 GMT (envelope-from git) Date: Sun, 24 Oct 2021 00:27:15 GMT Message-Id: <202110240027.19O0RFbe004651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 311b95bbcda7 - main - sys/mount.h: remove dead prototype List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 311b95bbcda7b8b3314e599b61ae538da3305517 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=311b95bbcda7b8b3314e599b61ae538da3305517 commit 311b95bbcda7b8b3314e599b61ae538da3305517 Author: Robert Wing AuthorDate: 2021-10-24 00:13:20 +0000 Commit: Robert Wing CommitDate: 2021-10-24 00:13:20 +0000 sys/mount.h: remove dead prototype vfs_getrootfsid() was removed in 245efbba4d6a3e60a0d6d16d18d9a5fad6260733 Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D32606 --- sys/sys/mount.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 8368595b685b..68211785b7c5 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1014,7 +1014,6 @@ void vfs_deallocate_syncvnode(struct mount *); int vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions); void vfs_getnewfsid(struct mount *); -struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ struct mount *vfs_busyfs(fsid_t *); int vfs_modevent(module_t, int, void *); From nobody Sun Oct 24 03:13:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EBED3180EA89; Sun, 24 Oct 2021 03: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcNT16PHQz3NdM; Sun, 24 Oct 2021 03:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC45A60BE; Sun, 24 Oct 2021 03:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19O3DPu5031486; Sun, 24 Oct 2021 03:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19O3DPpo031485; Sun, 24 Oct 2021 03:13:25 GMT (envelope-from git) Date: Sun, 24 Oct 2021 03:13:25 GMT Message-Id: <202110240313.19O3DPpo031485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: bee91a0e8b97 - releng/12.3 - contrib/tzdata: correct DST in Fiji List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/releng/12.3 X-Git-Reftype: branch X-Git-Commit: bee91a0e8b97dd9b424c6d72b25ec8591c180549 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=bee91a0e8b97dd9b424c6d72b25ec8591c180549 commit bee91a0e8b97dd9b424c6d72b25ec8591c180549 Author: Philip Paeps AuthorDate: 2021-10-18 06:19:42 +0000 Commit: Philip Paeps CommitDate: 2021-10-24 03:11:20 +0000 contrib/tzdata: correct DST in Fiji Direct commit to stable/12. Unfortunately, there is still no clear consensus on the tz mailing list about some of the changes introduced by tzdata 2021b and later releases. Pending consensus, only merge the recently announced DST transition date for Fiji and corrections to commentary from tzdata 2021d. This corrects future timestamps in Fiji. Approved by: re (gjb) (cherry picked from commit 74a0f31dbbd0b32689d63d8c965c611bdfc4da2f) --- contrib/tzdata/australasia | 24 +++++++++++++++++++----- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index a2c5ee86eecf..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Sun Oct 24 04:11:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6E41D1822D65; Sun, 24 Oct 2021 04:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcPm71DtTz3rmv; Sun, 24 Oct 2021 04:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B8646BDB; Sun, 24 Oct 2021 04:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19O4BY81006896; Sun, 24 Oct 2021 04:11:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19O4BY8v006895; Sun, 24 Oct 2021 04:11:34 GMT (envelope-from git) Date: Sun, 24 Oct 2021 04:11:34 GMT Message-Id: <202110240411.19O4BY8v006895@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: dfd704b7fb2c - main - Allow biodone() to be used as a completion routine. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: dfd704b7fb2c81f290e1d62db081416bae0d83d3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=dfd704b7fb2c81f290e1d62db081416bae0d83d3 commit dfd704b7fb2c81f290e1d62db081416bae0d83d3 Author: Kirk McKusick AuthorDate: 2021-10-23 14:25:49 +0000 Commit: Kirk McKusick CommitDate: 2021-10-23 21:11:57 +0000 Allow biodone() to be used as a completion routine. An ordered series of BIO_READ and BIO_WRITE operations are typically done as: while (work to do) { setup bp for I/O g_io_request(bp, consumer); biowait(bp); } Here you need to have biodone() called at the completion of the I/O to set the BIO_DONE flag and awaken the biowait(). The obvious way to do this would be to set bio_done = biodone, but biodone() will only take the desired action if bio_done == NULL. The relevant code at the end of biodone() is: done = bp->bio_done; if (done == NULL) { mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); } else done(bp); This code would infinitely recurse if biodone() is specified as the routine to use at completion. So before this change, a wrapper done function had to be written: static void g_io_done(struct bio *bp) { bp->bio_done = NULL; biodone(bp); bp->bio_done = g_io_done; } This commit changes if (done == NULL) to if (done == NULL || done == biodone) which eliminates the need for the wrapper function. Reviewed by: kib Sponsored by: Netflix --- sys/kern/vfs_bio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 352c341d05f7..034bbccc437d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4384,7 +4384,11 @@ biodone(struct bio *bp) atomic_add_int(&inflight_transient_maps, -1); } done = bp->bio_done; - if (done == NULL) { + /* + * The check for done == biodone is to allow biodone to be + * used as a bio_done routine. + */ + if (done == NULL || done == biodone) { mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); bp->bio_flags |= BIO_DONE; From nobody Sun Oct 24 04:24:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 533BB1827F78; Sun, 24 Oct 2021 04:24: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcQ3Y1RhFz3wDD; Sun, 24 Oct 2021 04:24:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 118536DE8; Sun, 24 Oct 2021 04:24:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19O4OuNw024697; Sun, 24 Oct 2021 04:24:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19O4OuVt024696; Sun, 24 Oct 2021 04:24:56 GMT (envelope-from git) Date: Sun, 24 Oct 2021 04:24:56 GMT Message-Id: <202110240424.19O4OuVt024696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 010e3bc77275 - stable/13 - Avoid lost buffers in fsck_ffs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 010e3bc772753e282ccbf12df3600f6d1a33d3fe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=010e3bc772753e282ccbf12df3600f6d1a33d3fe commit 010e3bc772753e282ccbf12df3600f6d1a33d3fe Author: Kirk McKusick AuthorDate: 2021-10-07 22:51:56 +0000 Commit: Kirk McKusick CommitDate: 2021-10-24 04:24:08 +0000 Avoid lost buffers in fsck_ffs. Sponsored by: Netflix (cherry picked from commit 4313e2ae44ba4e416a7ddaeaccf8ad311902f1c8) --- sbin/fsck_ffs/inode.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index ba2d5892238e..dafc99bd92da 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -264,6 +264,8 @@ ino_blkatoff(union dinode *dp, ino_t ino, ufs_lbn_t lbn, int *frags, int i; *frags = 0; + if (bpp != NULL) + *bpp = NULL; /* * Handle extattr blocks first. */ @@ -300,6 +302,8 @@ ino_blkatoff(union dinode *dp, ino_t ino, ufs_lbn_t lbn, int *frags, continue; if (lbn > 0 && lbn >= next) continue; + if (DIP(dp, di_ib[i]) == 0) + return (0); return (indir_blkatoff(DIP(dp, di_ib[i]), ino, -cur - i, lbn, bpp)); } @@ -321,8 +325,6 @@ indir_blkatoff(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t cur, ufs_lbn_t lbn, ufs_lbn_t base; int i, level; - if (blk == 0) - return (0); level = lbn_level(cur); if (level == -1) pfatal("Invalid indir lbn %jd in ino %ju\n", @@ -352,12 +354,14 @@ indir_blkatoff(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t cur, ufs_lbn_t lbn, return (0); blk = IBLK(bp, i); bp->b_index = i; - if (bpp != NULL) - *bpp = bp; - else - brelse(bp); - if (cur == lbn) + if (cur == lbn || blk == 0) { + if (bpp != NULL) + *bpp = bp; + else + brelse(bp); return (blk); + } + brelse(bp); if (level == 0) pfatal("Invalid lbn %jd at level 0 for ino %ju\n", lbn, (uintmax_t)ino); From nobody Sun Oct 24 06:05:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2A31B180AFD5 for ; Sun, 24 Oct 2021 06:05:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92a.google.com (mail-ua1-x92a.google.com [IPv6:2607:f8b0:4864:20::92a]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcSHK5sWqz4rLQ for ; Sun, 24 Oct 2021 06:05:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92a.google.com with SMTP id e10so15771168uab.3 for ; Sat, 23 Oct 2021 23:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6u3JcK7hwaZcxSnue6vl1bukfJ0HB9JAAD5AfbvF5eU=; b=DOBYE1gGpFFVIvOyQqGRw/NyQVBmIzjwLB1Ct4Uehw3JEz9bIGlJT79Ic84axD/uBE VC3YNmt22VVpdSJEgTSsURrYE36sjGUghMoTX8HXtba/mMGDGppcTf9Is4pCy2mtpOoz DZd+aCi8U/hBYbBsLlICKZIONDeBTmPCCsoBxTcRrwwxSWVFIMIwlAxBK4pqHbwZM5wG RpZMinAwsNyDdKeRO5DtYOT9LaFGPlnbl7j3GZY8fkoyZoEwedPYa2EjbjIU7ECv+QK9 hn8tQXtt3ZGxH2dxfbLGg7v4gotseqrQXs41x2FrRv7gCwwFBiRtSvryF2lJFBSp3wHG Ql6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6u3JcK7hwaZcxSnue6vl1bukfJ0HB9JAAD5AfbvF5eU=; b=dz+dZ2AimoDRd61nCuLOsoHZuqCCxza3iL/xEA/3jnvgDdQIigMsio0dS6oNQ0vOx4 bxKlBBPUr2UnTIuVTk6LMmROf34Y6rkKxtWqK5go2DV6ab5V7cJyMteV1cpopsfKeRJH G4zjZ6GK/8eolFNDW5Nto0TrEHp/E1sGVDsVVfO5CbAPyTagNV7H2yt/Loww6usgC1W/ 9cGX+3chNSxOZ4COFoDiwwEIKWAkvKvp/HpqizNhZR39GiX0ahdrGrgfJ33vosnPNMfb 9rFcp80zUKwrVbYK+0SXNgLsVWXPutDYNl54B6qNCcnrOT/9eCuosAzWavIuu4FOaA0k sSPA== X-Gm-Message-State: AOAM5302g+i+WQ0yQMbEzj/ixzTmSkIKu6ZFYZw0Xd9ct8ZzWwLkdvao prfSW6mHyztYIRu+n0uHgvJdKBbEFAr9PDEry0W2RdXJ+sImIA== X-Google-Smtp-Source: ABdhPJwVLLpY9dF7kjNpENFpRQ6XMR09ECqRg/h94MTYHNIWtcBUmz5gaD/S2y7nETD5IPjOZD/BnnGdtyAWbdZMdHA= X-Received: by 2002:a05:6102:31ab:: with SMTP id d11mr80693vsh.42.1635055517237; Sat, 23 Oct 2021 23:05:17 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> <20211023144536.Horde.FrlbSo1SLHpgxnKlAIimdzS@webmail.leidinger.net> In-Reply-To: <20211023144536.Horde.FrlbSo1SLHpgxnKlAIimdzS@webmail.leidinger.net> From: Warner Losh Date: Sun, 24 Oct 2021 00:05:06 -0600 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: Alexander Leidinger Cc: Emmanuel Vadot , Benjamin Kaduk , "Rodney W. Grimes" , "Rodney W. Grimes" , Gary Jennejohn , Gleb Smirnoff , Slawa Olhovchenkov , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000004b163105cf1307bf" X-Rspamd-Queue-Id: 4HcSHK5sWqz4rLQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000004b163105cf1307bf Content-Type: text/plain; charset="UTF-8" On Sat, Oct 23, 2021 at 6:45 AM Alexander Leidinger wrote: > Quoting Emmanuel Vadot (from Fri, 22 Oct 2021 > 22:55:40 +0200): > > > I honestly thought that this setting was something that you setup once > > when you installed a new machine (which doesn't happens very often) and > > forget about it, you know another "ah crap yes I forgot about this, why > > do we have such insane default. Oh well now that I disabled it locally > > I don't have to think about it and won't change the default". Instead > > this time I didn't say to myself that I won't change it and I did. > > May I offer another perspective into this? Something outside of 0 and 1... > > I wonder if it is really the default of bell=on is what is crap, or if > the bug Warner found is what makes it crap, or if the frequency of the > current setting is what makes it crap (or the two last items together). > > Personally I dislike the bell, but not as much that I want to disable > it. I don't mind to have it disabled (I simply enabled it directly in > sysctl.conf even as I haven't updated to past the commit), as I think > it gives usefull feedback. It may not give useful feedback in all > cases where it goes off, but that's something we have influence on, > don't we? > > What I don't like about the bell is the noise it makes. So what about > changing the noise it makes to something more pleasant and asking if > this is better and maybe acceptable to those which don't like the bell? > https://reviews.freebsd.org/D32619 and https://reviews.freebsd.org/D32620 might be of interest. They are only lightly tested at this point and may be buggy. But they let you set the duration and pitch of the bell, like we used to be able to do with syscons(4). There's likely some bugs in this area still, but it's a start. Warner > I also think that disabling a feature you know it exists but you don't > like is much more easy than to enable a feature you don't know exists. > > Basically I question in this email the problem you want to solve by > disabling the bell. Does it really need to be disabled, or would a > change of the sound and volume make it acceptable for you (you = all > people which complain or agree to "the current one is crap -> disable > it" .... which basically means we would need to make some kind of > usability test what sounds better before deciding if it shall be > disabled or not)? > > For me the issue with the bell would be solved if it sounds "better" > and is less loud. I assume we could even make it configurable to some > extend (override a hardcoded frequency and volume with a sysctl). > > Bye, > Alexander. > > -- > http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF > http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF > --0000000000004b163105cf1307bf-- From nobody Sun Oct 24 12:12:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A9B271807645 for ; Sun, 24 Oct 2021 12:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HccRT4LNmz3snT; Sun, 24 Oct 2021 12:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76EF715697; Sun, 24 Oct 2021 12:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OCCrae049330; Sun, 24 Oct 2021 12:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OCCrr1049329; Sun, 24 Oct 2021 12:12:53 GMT (envelope-from git) Date: Sun, 24 Oct 2021 12:12:53 GMT Message-Id: <202110241212.19OCCrr1049329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: "Danilo G. Baio" Subject: git: b86842ad719f - internal/admin - Remove joel from src/access.doc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: b86842ad719f10adb24402867a105b62611a7568 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by dbaio (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b86842ad719f10adb24402867a105b62611a7568 commit b86842ad719f10adb24402867a105b62611a7568 Author: Danilo G. Baio AuthorDate: 2021-10-24 12:10:11 +0000 Commit: Danilo G. Baio CommitDate: 2021-10-24 12:10:11 +0000 Remove joel from src/access.doc joel's doc commit bit was safely kept. Approved by: core (implicit), doceng (implicit) --- access.doc | 1 - 1 file changed, 1 deletion(-) diff --git a/access.doc b/access.doc index 16aaaaa4a174..a554482e659c 100644 --- a/access.doc +++ b/access.doc @@ -18,4 +18,3 @@ # type of commits. # blackend -joel From nobody Sun Oct 24 16:34:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 05A30180BEE4; Sun, 24 Oct 2021 16:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HckF16lXvz4TvF; Sun, 24 Oct 2021 16:34:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C744818A53; Sun, 24 Oct 2021 16:34:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OGYDit093447; Sun, 24 Oct 2021 16:34:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OGYDc0093446; Sun, 24 Oct 2021 16:34:13 GMT (envelope-from git) Date: Sun, 24 Oct 2021 16:34:13 GMT Message-Id: <202110241634.19OGYDc0093446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: c1c3ef8ef84b - stable/13 - timeout.1: Fix typos in examples List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c1c3ef8ef84b49f3a4db0fc2953db30c75235292 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c1c3ef8ef84b49f3a4db0fc2953db30c75235292 commit c1c3ef8ef84b49f3a4db0fc2953db30c75235292 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-10-21 11:06:45 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-10-24 16:33:37 +0000 timeout.1: Fix typos in examples MFC after: 3 days (cherry picked from commit 12615938c6e0bc3ca7604a8b0614ff23d9964370) --- usr.bin/timeout/timeout.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1 index b9613128755e..843c6215cc80 100644 --- a/usr.bin/timeout/timeout.1 +++ b/usr.bin/timeout/timeout.1 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 7, 2020 +.Dd October 21, 2021 .Dt TIMEOUT 1 .Os .Sh NAME @@ -161,7 +161,7 @@ $ echo $? .Pp Same as above but preserving status. Exit status is 128 + signal number (15 for -.Va SIGTERM ) +.Va SIGTERM ) : .Bd -literal -offset indent $ timeout --preserve-status 2 sleep 4 $ echo $? @@ -171,7 +171,7 @@ $ echo $? Same as above but sending .Va SIGALRM (signal number 14) instead of -.Va SIGTERM +.Va SIGTERM : .Bd -literal -offset indent $ timeout --preserve-status -s SIGALRM 2 sleep 4 $ echo $? @@ -189,8 +189,8 @@ signal after 1 minute and send a .Va SIGKILL signal 5 seconds later if the process refuses to stop: .Bd -literal -offset indent -timeout -k 5s 1m fetch \\ -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html +$ timeout -k 5s 1m fetch \\ +> https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html .Ed .Sh SEE ALSO .Xr kill 1 , From nobody Sun Oct 24 16:59:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C581018178B5; Sun, 24 Oct 2021 16:59: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hckp55CpMz4c4J; Sun, 24 Oct 2021 16:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F84018ECD; Sun, 24 Oct 2021 16:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OGxPUL020995; Sun, 24 Oct 2021 16:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OGxPkf020994; Sun, 24 Oct 2021 16:59:25 GMT (envelope-from git) Date: Sun, 24 Oct 2021 16:59:25 GMT Message-Id: <202110241659.19OGxPkf020994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: fd8ad2128dcd - main - unionfs: implement vnode-based cache lookup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd8ad2128dcd4fe7b9e52e181bfe4e2a24b0ab3a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=fd8ad2128dcd4fe7b9e52e181bfe4e2a24b0ab3a commit fd8ad2128dcd4fe7b9e52e181bfe4e2a24b0ab3a Author: Jason A. Harmening AuthorDate: 2021-10-17 02:16:25 +0000 Commit: Jason A. Harmening CommitDate: 2021-10-24 17:05:50 +0000 unionfs: implement vnode-based cache lookup unionfs uses a per-directory hashtable to cache subdirectory nodes. Currently this hashtable is looked up using the directory name, but since unionfs nodes aren't removed from the cache until they're reclaimed, this poses some problems. For example, if a directory is created on a unionfs mount shortly after deleting a previous directory with the same path, the cache may end up reusing the node for the previous directory, including its upper/lower FS vnodes. Operations against those vnodes with then likely fail because the vnodes represent deleted files; for example UFS will reject VOP_MKDIR() against such a vnode because its effective link count is 0. This may then manifest as e.g. mkdir(2) or open(2) returning ENOENT for an attempt to create a file under the re-created directory. While it would be possible to fix this by explicitly managing the name-based cache during delete or rename operations, or by rejecting cache hits if the underlying FS vnodes don't match those passed to unionfs_nodeget(), it seems cleaner to instead hash the unionfs nodes based on their underlying FS vnodes. Since unionfs prefers to operate against the upper vnode if one is present, the lower vnode will only be used for hashing as long as the upper vnode is NULL. This should also make hashing faster by eliminating string traversal and using the already-computed hash index stored in each vnode. While here, fix a couple of other cache-related issues: --Remove 8 bytes of unnecessary baggage from each unionfs node by getting rid of the stored hash mask field. The mask is knowable at compile time. --When a matching node is found in the cache, reference its vnode using vrefl() while still holding the vnode interlock. Previously unionfs_nodeget() would vref() the vnode after the interlock was dropped, but the vnode may be reclaimed during that window. This caused intermittent panics from vn_lock(9) during unionfs stress testing. Reviewed by: kib, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D32533 --- sys/fs/unionfs/union.h | 1 - sys/fs/unionfs/union_subr.c | 148 +++++++++++++++++++++++--------------------- 2 files changed, 79 insertions(+), 70 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index 79469a5957f4..fe611dea1461 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -96,7 +96,6 @@ struct unionfs_node { STAILQ_ENTRY(unionfs_node) un_rele; /* deferred release list */ }; - u_long un_hashmask; /* bit mask */ char *un_path; /* path */ int un_pathlen; /* strlen of path */ int un_flag; /* unionfs node flag */ diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 380a61819f1a..326483bcc400 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -64,6 +64,7 @@ #include #define NUNIONFSNODECACHE 16 +#define UNIONFSHASHMASK (NUNIONFSNODECACHE - 1) static MALLOC_DEFINE(M_UNIONFSHASH, "UNIONFS hash", "UNIONFS hash table"); MALLOC_DEFINE(M_UNIONFSNODE, "UNIONFS node", "UNIONFS vnode private part"); @@ -129,69 +130,83 @@ unionfs_deferred_rele(void *arg __unused, int pending __unused) } static struct unionfs_node_hashhead * -unionfs_get_hashhead(struct vnode *dvp, char *path) +unionfs_get_hashhead(struct vnode *dvp, struct vnode *lookup) { struct unionfs_node *unp; - int count; - char hash; - hash = 0; unp = VTOUNIONFS(dvp); - if (path != NULL) { - for (count = 0; path[count]; count++) - hash += path[count]; - } - return (&(unp->un_hashtbl[hash & (unp->un_hashmask)])); + return (&(unp->un_hashtbl[vfs_hash_index(lookup) & UNIONFSHASHMASK])); } /* - * Get the cached vnode. + * Attempt to lookup a cached unionfs vnode by upper/lower vp + * from dvp, with dvp's interlock held. */ static struct vnode * -unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, - struct vnode *dvp, char *path) +unionfs_get_cached_vnode_locked(struct vnode *lookup, struct vnode *dvp) { - struct unionfs_node_hashhead *hd; struct unionfs_node *unp; + struct unionfs_node_hashhead *hd; struct vnode *vp; - KASSERT((uvp == NULLVP || uvp->v_type == VDIR), - ("unionfs_get_cached_vnode: v_type != VDIR")); - KASSERT((lvp == NULLVP || lvp->v_type == VDIR), - ("unionfs_get_cached_vnode: v_type != VDIR")); + hd = unionfs_get_hashhead(dvp, lookup); - VI_LOCK(dvp); - hd = unionfs_get_hashhead(dvp, path); LIST_FOREACH(unp, hd, un_hash) { - if (!strcmp(unp->un_path, path)) { + if ((unp->un_uppervp == lookup) || + (unp->un_lowervp == lookup)) { vp = UNIONFSTOV(unp); VI_LOCK_FLAGS(vp, MTX_DUPOK); - VI_UNLOCK(dvp); vp->v_iflag &= ~VI_OWEINACT; if (VN_IS_DOOMED(vp) || ((vp->v_iflag & VI_DOINGINACT) != 0)) { VI_UNLOCK(vp); vp = NULLVP; - } else + } else { + vrefl(vp); VI_UNLOCK(vp); + } return (vp); } } - VI_UNLOCK(dvp); return (NULLVP); } + +/* + * Get the cached vnode. + */ +static struct vnode * +unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, + struct vnode *dvp) +{ + struct vnode *vp; + + KASSERT((uvp == NULLVP || uvp->v_type == VDIR), + ("unionfs_get_cached_vnode: v_type != VDIR")); + KASSERT((lvp == NULLVP || lvp->v_type == VDIR), + ("unionfs_get_cached_vnode: v_type != VDIR")); + + vp = NULLVP; + VI_LOCK(dvp); + if (uvp != NULLVP) + vp = unionfs_get_cached_vnode_locked(uvp, dvp); + else if (lvp != NULLVP) + vp = unionfs_get_cached_vnode_locked(lvp, dvp); + VI_UNLOCK(dvp); + + return (vp); +} + /* * Add the new vnode into cache. */ static struct vnode * unionfs_ins_cached_vnode(struct unionfs_node *uncp, - struct vnode *dvp, char *path) + struct vnode *dvp) { struct unionfs_node_hashhead *hd; - struct unionfs_node *unp; struct vnode *vp; KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR), @@ -199,29 +214,20 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR), ("unionfs_ins_cached_vnode: v_type != VDIR")); + vp = NULLVP; VI_LOCK(dvp); - hd = unionfs_get_hashhead(dvp, path); - LIST_FOREACH(unp, hd, un_hash) { - if (!strcmp(unp->un_path, path)) { - vp = UNIONFSTOV(unp); - VI_LOCK_FLAGS(vp, MTX_DUPOK); - vp->v_iflag &= ~VI_OWEINACT; - if (VN_IS_DOOMED(vp) || - ((vp->v_iflag & VI_DOINGINACT) != 0)) { - LIST_INSERT_HEAD(hd, uncp, un_hash); - VI_UNLOCK(vp); - vp = NULLVP; - } else - VI_UNLOCK(vp); - VI_UNLOCK(dvp); - return (vp); - } + if (uncp->un_uppervp != NULL) + vp = unionfs_get_cached_vnode_locked(uncp->un_uppervp, dvp); + else if (uncp->un_lowervp != NULL) + vp = unionfs_get_cached_vnode_locked(uncp->un_lowervp, dvp); + if (vp == NULLVP) { + hd = unionfs_get_hashhead(dvp, (uncp->un_uppervp != NULLVP ? + uncp->un_uppervp : uncp->un_lowervp)); + LIST_INSERT_HEAD(hd, uncp, un_hash); } - - LIST_INSERT_HEAD(hd, uncp, un_hash); VI_UNLOCK(dvp); - return (NULLVP); + return (vp); } /* @@ -233,13 +239,13 @@ unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) KASSERT((unp != NULL), ("unionfs_rem_cached_vnode: null node")); KASSERT((dvp != NULLVP), ("unionfs_rem_cached_vnode: null parent vnode")); - KASSERT((unp->un_hash.le_prev != NULL), - ("unionfs_rem_cached_vnode: null hash")); VI_LOCK(dvp); - LIST_REMOVE(unp, un_hash); - unp->un_hash.le_next = NULL; - unp->un_hash.le_prev = NULL; + if (unp->un_hash.le_prev != NULL) { + LIST_REMOVE(unp, un_hash); + unp->un_hash.le_next = NULL; + unp->un_hash.le_prev = NULL; + } VI_UNLOCK(dvp); } @@ -281,7 +287,7 @@ unionfs_nodeget_cleanup(struct vnode *vp, void *arg) if (unp->un_lowervp != NULLVP) vput(unp->un_lowervp); if (unp->un_hashtbl != NULL) - hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, unp->un_hashmask); + hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, UNIONFSHASHMASK); free(unp->un_path, M_UNIONFSPATH); free(unp, M_UNIONFSNODE); } @@ -302,6 +308,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, struct unionfs_mount *ump; struct unionfs_node *unp; struct vnode *vp; + u_long hashmask; int error; int lkflags; enum vtype vt; @@ -322,10 +329,9 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, path = NULL; /* check the cache */ - if (path != NULL && dvp != NULLVP && vt == VDIR) { - vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp, path); + if (dvp != NULLVP && vt == VDIR) { + vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp); if (vp != NULLVP) { - vref(vp); *vpp = vp; goto unionfs_nodeget_out; } @@ -352,9 +358,12 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, if (lowervp != NULLVP) vref(lowervp); - if (vt == VDIR) + if (vt == VDIR) { unp->un_hashtbl = hashinit(NUNIONFSNODECACHE, M_UNIONFSHASH, - &(unp->un_hashmask)); + &hashmask); + KASSERT(hashmask == UNIONFSHASHMASK, + ("unexpected unionfs hash mask 0x%lx", hashmask)); + } unp->un_vnode = vp; unp->un_uppervp = uppervp; @@ -395,12 +404,12 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, unionfs_nodeget_cleanup(vp, unp); return (ENOENT); } - if (path != NULL && dvp != NULLVP && vt == VDIR) - *vpp = unionfs_ins_cached_vnode(unp, dvp, path); + + if (dvp != NULLVP && vt == VDIR) + *vpp = unionfs_ins_cached_vnode(unp, dvp); if (*vpp != NULLVP) { unionfs_nodeget_cleanup(vp, unp); vp = *vpp; - vref(vp); } else { if (uppervp != NULL) VOP_UNLOCK(uppervp); @@ -457,7 +466,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td) if (uvp != NULLVP) VOP_UNLOCK(uvp); - if (dvp != NULLVP && unp->un_hash.le_prev != NULL) + if (dvp != NULLVP) unionfs_rem_cached_vnode(unp, dvp); if (lockmgr(vp->v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0) @@ -474,7 +483,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td) } if (unp->un_hashtbl != NULL) { - for (count = 0; count <= unp->un_hashmask; count++) { + for (count = 0; count <= UNIONFSHASHMASK; count++) { hd = unp->un_hashtbl + count; LIST_FOREACH_SAFE(unp_t1, hd, un_hash, unp_t2) { LIST_REMOVE(unp_t1, un_hash); @@ -482,7 +491,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td) unp_t1->un_hash.le_prev = NULL; } } - hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, unp->un_hashmask); + hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, UNIONFSHASHMASK); } LIST_FOREACH_SAFE(unsp, &(unp->un_unshead), uns_list, unsp_tmp) { @@ -777,6 +786,7 @@ static void unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, struct thread *td) { + struct unionfs_node_hashhead *hd; struct vnode *vp; struct vnode *lvp; struct vnode *dvp; @@ -799,16 +809,16 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, vn_lock(uvp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY); /* - * cache update + * Re-cache the unionfs vnode against the upper vnode */ - if (unp->un_path != NULL && dvp != NULLVP && vp->v_type == VDIR) { - static struct unionfs_node_hashhead *hd; - + if (dvp != NULLVP && vp->v_type == VDIR) { VI_LOCK(dvp); - hd = unionfs_get_hashhead(dvp, unp->un_path); - LIST_REMOVE(unp, un_hash); - LIST_INSERT_HEAD(hd, unp, un_hash); - VI_UNLOCK(dvp); + if (unp->un_hash.le_prev != NULL) { + LIST_REMOVE(unp, un_hash); + hd = unionfs_get_hashhead(dvp, uvp); + LIST_INSERT_HEAD(hd, unp, un_hash); + } + VI_UNLOCK(unp->un_dvp); } } From nobody Sun Oct 24 17:38:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D565C18276B4; Sun, 24 Oct 2021 17:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hclg55PFzz4nXN; Sun, 24 Oct 2021 17:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99261194FE; Sun, 24 Oct 2021 17:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OHcPAY074409; Sun, 24 Oct 2021 17:38:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OHcPS5074408; Sun, 24 Oct 2021 17:38:25 GMT (envelope-from git) Date: Sun, 24 Oct 2021 17:38:25 GMT Message-Id: <202110241738.19OHcPS5074408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 790b5264886e - main - mixer(3): Fix spelling in comment. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 790b5264886e581e995fc3b8fa45ca4ab4ffd31c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=790b5264886e581e995fc3b8fa45ca4ab4ffd31c commit 790b5264886e581e995fc3b8fa45ca4ab4ffd31c Author: Hans Petter Selasky AuthorDate: 2021-10-18 14:03:17 +0000 Commit: Hans Petter Selasky CommitDate: 2021-10-24 17:37:17 +0000 mixer(3): Fix spelling in comment. s/MIX_STATUS_XXX/MIX_MODE_XXX/g Differential Revision: https://reviews.freebsd.org/D32548 Submitted by: christos@ Sponsored by: NVIDIA Networking --- lib/libmixer/mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c index 4bae6980c1c4..1a448d222bb7 100644 --- a/lib/libmixer/mixer.c +++ b/lib/libmixer/mixer.c @@ -455,7 +455,7 @@ mixer_set_dunit(struct mixer *m, int unit) /* * Get sound device mode (none, play, rec, play+rec). Userland programs can - * use the MIX_STATUS_* flags to determine the mode of the device. + * use the MIX_MODE_* flags to determine the mode of the device. */ int mixer_get_mode(int unit) From nobody Sun Oct 24 17:38:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0054B182753F; Sun, 24 Oct 2021 17:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hclg66Ng2z4nTx; Sun, 24 Oct 2021 17:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB979190F6; Sun, 24 Oct 2021 17:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OHcQD3074433; Sun, 24 Oct 2021 17:38:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OHcQRT074432; Sun, 24 Oct 2021 17:38:26 GMT (envelope-from git) Date: Sun, 24 Oct 2021 17:38:26 GMT Message-Id: <202110241738.19OHcQRT074432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: aad0c65d6b37 - main - usb(4): Fix for use after free in combination with EVDEV_SUPPORT. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aad0c65d6b37364d8ba92ecb8c85e004398a5194 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=aad0c65d6b37364d8ba92ecb8c85e004398a5194 commit aad0c65d6b37364d8ba92ecb8c85e004398a5194 Author: Hans Petter Selasky AuthorDate: 2021-10-24 11:38:04 +0000 Commit: Hans Petter Selasky CommitDate: 2021-10-24 17:37:17 +0000 usb(4): Fix for use after free in combination with EVDEV_SUPPORT. When EVDEV_SUPPORT was introduced, the USB transfers may be running after the main FIFO is closed. In connection to this a race may appear which can lead to use-after-free scenarios. Fix this for all FIFO consumers by initializing and resetting the FIFO queues under the lock used by the client. Then the client driver will see an empty queue in all cases a race may appear. Found by: pho@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/usb_dev.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 88b36e68976b..99b243464f6c 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -1938,18 +1938,30 @@ int usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, uint16_t nbuf) { + struct usb_ifqueue temp_q = {}; + void *queue_data; + usb_fifo_free_buffer(f); - /* allocate an endpoint */ - f->free_q.ifq_maxlen = nbuf; - f->used_q.ifq_maxlen = nbuf; + temp_q.ifq_maxlen = nbuf; - f->queue_data = usb_alloc_mbufs( - M_USBDEV, &f->free_q, bufsize, nbuf); + queue_data = usb_alloc_mbufs( + M_USBDEV, &temp_q, bufsize, nbuf); - if ((f->queue_data == NULL) && bufsize && nbuf) { + if (queue_data == NULL && bufsize != 0 && nbuf != 0) return (ENOMEM); - } + + mtx_lock(f->priv_mtx); + + /* + * Setup queues and sizes under lock to avoid early use by + * concurrent FIFO access: + */ + f->free_q = temp_q; + f->used_q.ifq_maxlen = nbuf; + f->queue_data = queue_data; + mtx_unlock(f->priv_mtx); + return (0); /* success */ } @@ -1962,15 +1974,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, void usb_fifo_free_buffer(struct usb_fifo *f) { - if (f->queue_data) { - /* free old buffer */ - free(f->queue_data, M_USBDEV); - f->queue_data = NULL; - } - /* reset queues */ + void *queue_data; + + mtx_lock(f->priv_mtx); + + /* Get and clear pointer to free, if any. */ + queue_data = f->queue_data; + f->queue_data = NULL; + /* + * Reset queues under lock to avoid use of freed buffers by + * concurrent FIFO activity: + */ memset(&f->free_q, 0, sizeof(f->free_q)); memset(&f->used_q, 0, sizeof(f->used_q)); + mtx_unlock(f->priv_mtx); + + /* Free old buffer, if any. */ + free(queue_data, M_USBDEV); } void From nobody Sun Oct 24 18:54:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 908BA18206A0; Sun, 24 Oct 2021 18:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcnLP3Dzqz3hFx; Sun, 24 Oct 2021 18:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E9DC1AB4C; Sun, 24 Oct 2021 18:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OIs5rg080929; Sun, 24 Oct 2021 18:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OIs5iV080928; Sun, 24 Oct 2021 18:54:05 GMT (envelope-from git) Date: Sun, 24 Oct 2021 18:54:05 GMT Message-Id: <202110241854.19OIs5iV080928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: af818612a5d3 - stable/13 - riscv: Implement pmap_mapdev_attr List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af818612a5d3941763b1b0c620b929df89bc6c4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=af818612a5d3941763b1b0c620b929df89bc6c4d commit af818612a5d3941763b1b0c620b929df89bc6c4d Author: Jessica Clarke AuthorDate: 2021-10-17 14:31:35 +0000 Commit: Jessica Clarke CommitDate: 2021-10-24 18:51:10 +0000 riscv: Implement pmap_mapdev_attr This is needed for LinuxKPI's _ioremap_attr. This reuses the generic implementation introduced for aarch64, and itself requires implementing pmap_kenter, which is trivial to do given riscv currently treats all mapping attributes the same due to the Svpbmt extension not yet being ratified and in hardware. Reviewed by: markj, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32445 (cherry picked from commit 682c00a6ce2f3870e9c698b283ee2b2a56c28c0b) --- sys/kern/subr_devmap.c | 2 +- sys/riscv/include/pmap.h | 2 ++ sys/riscv/riscv/pmap.c | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 23baceb05129..1c9b192cc4c8 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -290,7 +290,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) return ((void *)(va + offset)); } -#if defined(__aarch64__) +#if defined(__aarch64__) || defined(__riscv) void * pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma) { diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 024bc3743f67..0ef221ed2393 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -145,10 +145,12 @@ void pmap_activate_boot(pmap_t); void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t); int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); +void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); +void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index eab61032fbcb..06bb19fb5f24 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -916,7 +916,7 @@ pmap_kextract(vm_offset_t va) ***************************************************/ void -pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode __unused) { pt_entry_t entry; pt_entry_t *l3; @@ -947,6 +947,12 @@ pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) pmap_invalidate_range(kernel_pmap, sva, va); } +void +pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +{ + pmap_kenter(sva, size, pa, VM_MEMATTR_DEVICE); +} + /* * Remove a page from the kernel pagetables. * Note: not SMP coherent. From nobody Sun Oct 24 18:54:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 982D8182064D; Sun, 24 Oct 2021 18:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcnLQ3rm8z3hCn; Sun, 24 Oct 2021 18:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64EF31AB97; Sun, 24 Oct 2021 18:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OIs6ih080953; Sun, 24 Oct 2021 18:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OIs6eB080952; Sun, 24 Oct 2021 18:54:06 GMT (envelope-from git) Date: Sun, 24 Oct 2021 18:54:06 GMT Message-Id: <202110241854.19OIs6eB080952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: feb3031f0ae8 - stable/13 - LinuxKPI: Implement _ioremap_attr for riscv List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: feb3031f0ae878b72b48488fe3ba13884ae58b7f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=feb3031f0ae878b72b48488fe3ba13884ae58b7f commit feb3031f0ae878b72b48488fe3ba13884ae58b7f Author: Jessica Clarke AuthorDate: 2021-10-17 14:32:20 +0000 Commit: Jessica Clarke CommitDate: 2021-10-24 18:51:12 +0000 LinuxKPI: Implement _ioremap_attr for riscv Now that riscv implements pmap_mapdev_attr we can enable the non-stub implementation for riscv, which is needed for drm-kmod to not fail at run time for drivers that need to map I/O regions. Reviewed by: hselasky, bz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32446 (cherry picked from commit 60d962e0410340f107d062e8f4389c0d467613a2) --- sys/compat/linuxkpi/common/include/linux/io.h | 2 +- sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index 074417b892f9..e402ebed0665 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -390,7 +390,7 @@ _outb(u_char data, u_int port) } #endif -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv) void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #else #define _ioremap_attr(...) NULL diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 247c1f54515e..a1462c6a7010 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1822,7 +1822,7 @@ vmmap_remove(void *addr) return (vmmap); } -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv) void * _ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr) { @@ -1845,7 +1845,7 @@ iounmap(void *addr) vmmap = vmmap_remove(addr); if (vmmap == NULL) return; -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv) pmap_unmapdev((vm_offset_t)addr, vmmap->vm_size); #endif kfree(vmmap); From nobody Sun Oct 24 18:54:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3248E182079D; Sun, 24 Oct 2021 18:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcnLR5w7rz3hLp; Sun, 24 Oct 2021 18:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 912C91A832; Sun, 24 Oct 2021 18:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OIs7FV080979; Sun, 24 Oct 2021 18:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OIs7ux080978; Sun, 24 Oct 2021 18:54:07 GMT (envelope-from git) Date: Sun, 24 Oct 2021 18:54:07 GMT Message-Id: <202110241854.19OIs7ux080978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: fa82e6a10305 - stable/13 - LinuxKPI: Support lazy BAR allocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa82e6a103050299629e62c2289e31946734c277 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=fa82e6a103050299629e62c2289e31946734c277 commit fa82e6a103050299629e62c2289e31946734c277 Author: Jessica Clarke AuthorDate: 2021-10-17 14:32:35 +0000 Commit: Jessica Clarke CommitDate: 2021-10-24 18:51:15 +0000 LinuxKPI: Support lazy BAR allocation Linux KPIs like pci_resource_start/len assume that BARs have been allocated, but FreeBSD lazily allocates BARs if it cannot allocate the firmware-allocated BARs. Thus using the Linux KPIs must force allocation of the BARs rather than returning 0 for the start and length, which can crash drm-kmod drivers that assume the BARs are valid. This is needed for the AMDGPU driver to be able to attach on SiFive's HiFive Unmatched. Reviewed by: hselasky, jhb, mav MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32447 (cherry picked from commit 82098c8bb5b303c7c8b48e7537fadfe74b375bd3) --- sys/compat/linuxkpi/common/include/linux/pci.h | 22 +++++++++++++++------- sys/compat/linuxkpi/common/src/linux_pci.c | 25 ++++++++++++++++++++++--- sys/dev/pci/pci.c | 2 +- sys/dev/pci/pci_private.h | 4 ++++ 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 1ec7fe75388d..5b3c7c292921 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -292,19 +292,27 @@ pci_resource_type(struct pci_dev *pdev, int bar) return (SYS_RES_MEMORY); } +struct resource_list_entry *linux_pci_reserve_bar(struct pci_dev *pdev, + struct resource_list *rl, int type, int rid); + static inline struct resource_list_entry * -linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) +linux_pci_get_rle(struct pci_dev *pdev, int type, int rid, bool reserve_bar) { struct pci_devinfo *dinfo; struct resource_list *rl; + struct resource_list_entry *rle; dinfo = device_get_ivars(pdev->dev.bsddev); rl = &dinfo->resources; - return resource_list_find(rl, type, rid); + rle = resource_list_find(rl, type, rid); + /* Reserve resources for this BAR if needed. */ + if (rle == NULL && reserve_bar) + rle = linux_pci_reserve_bar(pdev, rl, type, rid); + return (rle); } static inline struct resource_list_entry * -linux_pci_get_bar(struct pci_dev *pdev, int bar) +linux_pci_get_bar(struct pci_dev *pdev, int bar, bool reserve) { int type; @@ -312,7 +320,7 @@ linux_pci_get_bar(struct pci_dev *pdev, int bar) if (type < 0) return (NULL); bar = PCIR_BAR(bar); - return (linux_pci_get_rle(pdev, type, bar)); + return (linux_pci_get_rle(pdev, type, bar, reserve)); } static inline struct device * @@ -502,7 +510,7 @@ pci_release_region(struct pci_dev *pdev, int bar) struct pci_devres *dr; struct pci_mmio_region *mmio, *p; - if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar, false)) == NULL) return; /* @@ -760,7 +768,7 @@ pci_enable_msix(struct pci_dev *pdev, struct msix_entry *entries, int nreq) pci_release_msi(pdev->dev.bsddev); return avail; } - rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1); + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1, false); pdev->dev.irq_start = rle->start; pdev->dev.irq_end = rle->start + avail; for (i = 0; i < nreq; i++) @@ -813,7 +821,7 @@ pci_enable_msi(struct pci_dev *pdev) if ((error = -pci_alloc_msi(pdev->dev.bsddev, &avail)) != 0) return error; - rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1); + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1, false); pdev->dev.irq_start = rle->start; pdev->dev.irq_end = rle->start + avail; pdev->irq = rle->start; diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index b5bb87b5f2ae..c8f473205ede 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -368,7 +368,7 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, PCI_GET_ID(parent, dev, PCI_ID_RID, &rid); pdev->devfn = rid; pdev->pdrv = pdrv; - rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0); + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0, false); if (rle != NULL) pdev->dev.irq = rle->start; else @@ -624,6 +624,25 @@ linux_pci_register_driver(struct pci_driver *pdrv) return (_linux_pci_register_driver(pdrv, dc)); } +struct resource_list_entry * +linux_pci_reserve_bar(struct pci_dev *pdev, struct resource_list *rl, + int type, int rid) +{ + device_t dev; + struct resource *res; + + KASSERT(type == SYS_RES_IOPORT || type == SYS_RES_MEMORY, + ("trying to reserve non-BAR type %d", type)); + + dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? + device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; + res = pci_reserve_map(device_get_parent(dev), dev, type, &rid, 0, ~0, + 1, 1, 0); + if (res == NULL) + return (NULL); + return (resource_list_find(rl, type, rid)); +} + unsigned long pci_resource_start(struct pci_dev *pdev, int bar) { @@ -631,7 +650,7 @@ pci_resource_start(struct pci_dev *pdev, int bar) rman_res_t newstart; device_t dev; - if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar, true)) == NULL) return (0); dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; @@ -648,7 +667,7 @@ pci_resource_len(struct pci_dev *pdev, int bar) { struct resource_list_entry *rle; - if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar, true)) == NULL) return (0); return (rle->count); } diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index ef138e926b6f..530526adb7b3 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -5364,7 +5364,7 @@ DB_SHOW_COMMAND(pciregs, db_pci_dump) } #endif /* DDB */ -static struct resource * +struct resource * pci_reserve_map(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int num, u_int flags) diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index d891f592bdbd..fec5db2e4ad5 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -163,6 +163,10 @@ void pci_read_bar(device_t dev, int reg, pci_addr_t *mapp, struct pci_map *pci_add_bar(device_t dev, int reg, pci_addr_t value, pci_addr_t size); +struct resource *pci_reserve_map(device_t dev, device_t child, int type, + int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int num, u_int flags); + struct resource *pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_long num, u_int flags); From nobody Sun Oct 24 18:54:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8DED918207A4; Sun, 24 Oct 2021 18:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcnLT0Zhtz3h5P; Sun, 24 Oct 2021 18:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A998A1AA34; Sun, 24 Oct 2021 18:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OIs8Yv081006; Sun, 24 Oct 2021 18:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OIs8Yp081005; Sun, 24 Oct 2021 18:54:08 GMT (envelope-from git) Date: Sun, 24 Oct 2021 18:54:08 GMT Message-Id: <202110241854.19OIs8Yp081005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: f9f5d846b72d - stable/13 - Bump __FreeBSD_version for LinuxKPI changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9f5d846b72d767a4799daa66ae6f0ef3a9ea771 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f9f5d846b72d767a4799daa66ae6f0ef3a9ea771 commit f9f5d846b72d767a4799daa66ae6f0ef3a9ea771 Author: Jessica Clarke AuthorDate: 2021-10-17 14:35:48 +0000 Commit: Jessica Clarke CommitDate: 2021-10-24 18:52:47 +0000 Bump __FreeBSD_version for LinuxKPI changes (cherry picked from commit 0d6516b453469ce1d92ec903c4c4df9ee08be0f9) --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 3d47dda916af..fa3bc1544a4a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300519 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300520 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Sun Oct 24 19:08:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D6AC3182698B; Sun, 24 Oct 2021 19:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcnfZ5kLPz3mNL; Sun, 24 Oct 2021 19:08:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3E6F1AC1A; Sun, 24 Oct 2021 19:08:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OJ86Jq095197; Sun, 24 Oct 2021 19:08:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OJ86K9095196; Sun, 24 Oct 2021 19:08:06 GMT (envelope-from git) Date: Sun, 24 Oct 2021 19:08:06 GMT Message-Id: <202110241908.19OJ86K9095196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: eab5358b9080 - main - Makefile.inc1: Remove mentions of removed target "update" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eab5358b90804669681b639f76ff7e5707e27138 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=eab5358b90804669681b639f76ff7e5707e27138 commit eab5358b90804669681b639f76ff7e5707e27138 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-10-24 19:03:22 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-10-24 19:07:45 +0000 Makefile.inc1: Remove mentions of removed target "update" This is follow-up to commits e290182bcf38 and 1f7d11e636ab. --- Makefile.inc1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 423bc00b3f29..c3b8c5257a18 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -43,7 +43,6 @@ # installworld- install everything built by "buildworld" # checkworld - run test suite on installed world # doxygen - build API documentation of the kernel -# update - convenient way to update your source tree (eg: svn/svnup) # # Standard targets (not defined here) are documented in the makefiles in # /usr/share/mk. These include: From nobody Sun Oct 24 21:29:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 93187181E0C6; Sun, 24 Oct 2021 21:29: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hcrp93kvNz4yZQ; Sun, 24 Oct 2021 21:29:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3761CD07; Sun, 24 Oct 2021 21:29:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OLTrlQ081681; Sun, 24 Oct 2021 21:29:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OLTrmw081680; Sun, 24 Oct 2021 21:29:53 GMT (envelope-from git) Date: Sun, 24 Oct 2021 21:29:53 GMT Message-Id: <202110242129.19OLTrmw081680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 39545ce06ca8 - stable/12 - libctf: Improve check for duplicate SOU definitions in ctf_add_type() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 39545ce06ca8088aecc68b92c028b78bcae888a2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=39545ce06ca8088aecc68b92c028b78bcae888a2 commit 39545ce06ca8088aecc68b92c028b78bcae888a2 Author: Mark Johnston AuthorDate: 2021-10-04 16:28:22 +0000 Commit: Mark Johnston CommitDate: 2021-10-24 21:29:36 +0000 libctf: Improve check for duplicate SOU definitions in ctf_add_type() When copying a struct or union from one CTF container to another, ctf_add_type() checks whether it matches an existing type in the destination container. It does so by looking for a type with the same name and kind as the new type, and if one exists, it iterates over all members of the source type and checks whether a member with matching name and offset exists in the matched destination type. This can produce false positives, for example because member types are not compared, but this is not expected to arise in practice. If the match fails, ctf_add_type() returns an error. The procedure used for member comparison breaks down in the face of anonymous struct and union members. ctf_member_iter() visits each member in the source definition and looks up the corresponding member in the desination definition by name using ctf_member_info(), but this function will descend into anonymous members and thus fail to match. Fix the problem by introducing a custom comparison routine which does not assume member names are unique. This should also be faster for types with many members; in the previous scheme, membcmp() would perform a linear scan of the desination type's members to perform a lookup by name. The new routine steps through the members of both types in a single loop. PR: 258763 Sponsored by: The FreeBSD Foundation (cherry picked from commit 105fd928b0b5b35ab529e5f6914788dc49582901) --- cddl/contrib/opensolaris/common/ctf/ctf_create.c | 100 +++++++++++++++++------ 1 file changed, 73 insertions(+), 27 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_create.c b/cddl/contrib/opensolaris/common/ctf/ctf_create.c index a2ca81960f73..bf9b3b26b200 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_create.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_create.c @@ -1196,17 +1196,6 @@ enumadd(const char *name, int value, void *arg) name, value) == CTF_ERR); } -/*ARGSUSED*/ -static int -membcmp(const char *name, ctf_id_t type, ulong_t offset, void *arg) -{ - ctf_bundle_t *ctb = arg; - ctf_membinfo_t ctm; - - return (ctf_member_info(ctb->ctb_file, ctb->ctb_type, - name, &ctm) == CTF_ERR || ctm.ctm_offset != offset); -} - static int membadd(const char *name, ctf_id_t type, ulong_t offset, void *arg) { @@ -1240,6 +1229,71 @@ membadd(const char *name, ctf_id_t type, ulong_t offset, void *arg) return (0); } +static long +soucmp(ctf_file_t *src_fp, ctf_id_t src_type, ctf_file_t *dst_fp, + ctf_id_t dst_type) +{ + const struct ctf_type *src_tp, *dst_tp; + const char *src_name, *dst_name; + ssize_t src_sz, dst_sz, src_inc, dst_inc; + uint_t kind, n; + + if ((src_type = ctf_type_resolve(src_fp, src_type)) == CTF_ERR) + return (CTF_ERR); + if ((dst_type = ctf_type_resolve(dst_fp, dst_type)) == CTF_ERR) + return (CTF_ERR); + + if ((src_tp = ctf_lookup_by_id(&src_fp, src_type)) == NULL) + return (CTF_ERR); + if ((dst_tp = ctf_lookup_by_id(&dst_fp, dst_type)) == NULL) + return (CTF_ERR); + + if ((kind = LCTF_INFO_KIND(src_fp, src_tp->ctt_info)) != + LCTF_INFO_KIND(dst_fp, dst_tp->ctt_info)) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + if ((n = LCTF_INFO_VLEN(src_fp, src_tp->ctt_info)) != + LCTF_INFO_VLEN(dst_fp, dst_tp->ctt_info)) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + + (void) ctf_get_ctt_size(src_fp, src_tp, &src_sz, &src_inc); + (void) ctf_get_ctt_size(dst_fp, dst_tp, &dst_sz, &dst_inc); + if (src_sz != dst_sz || src_inc != dst_inc) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + + if (src_sz < CTF_LSTRUCT_THRESH) { + const ctf_member_t *src_mp, *dst_mp; + + src_mp = (const ctf_member_t *)((uintptr_t)src_tp + src_inc); + dst_mp = (const ctf_member_t *)((uintptr_t)dst_tp + dst_inc); + for (; n != 0; n--, src_mp++, dst_mp++) { + if (src_mp->ctm_offset != dst_mp->ctm_offset) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + src_name = ctf_strptr(src_fp, src_mp->ctm_name); + dst_name = ctf_strptr(dst_fp, dst_mp->ctm_name); + if (strcmp(src_name, dst_name) != 0) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + } + } else { + const ctf_lmember_t *src_mp, *dst_mp; + + src_mp = (const ctf_lmember_t *)((uintptr_t)src_tp + src_inc); + dst_mp = (const ctf_lmember_t *)((uintptr_t)dst_tp + dst_inc); + for (; n != 0; n--, src_mp++, dst_mp++) { + if (src_mp->ctlm_offsethi != dst_mp->ctlm_offsethi || + src_mp->ctlm_offsetlo != dst_mp->ctlm_offsetlo) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + src_name = ctf_strptr(src_fp, src_mp->ctlm_name); + dst_name = ctf_strptr(dst_fp, dst_mp->ctlm_name); + if (strcmp(src_name, dst_name) != 0) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + } + } + + return (0); +} + /* * The ctf_add_type routine is used to copy a type from a source CTF container * to a dynamic destination container. This routine operates recursively by @@ -1439,23 +1493,15 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type) ctf_dmdef_t *dmd; int errs = 0; - /* - * Technically to match a struct or union we need to check both - * ways (src members vs. dst, dst members vs. src) but we make - * this more optimal by only checking src vs. dst and comparing - * the total size of the structure (which we must do anyway) - * which covers the possibility of dst members not in src. - * This optimization can be defeated for unions, but is so - * pathological as to render it irrelevant for our purposes. - */ if (dst_type != CTF_ERR && dst_kind != CTF_K_FORWARD) { - if (ctf_type_size(src_fp, src_type) != - ctf_type_size(dst_fp, dst_type)) - return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); - - if (ctf_member_iter(src_fp, src_type, membcmp, &dst)) - return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); - + /* + * Compare the sizes and fields of the two types. + * The field comparisons only check the names and + * offsets, so this is not perfect but is good enough + * for scenarios that we care about. + */ + if (soucmp(src_fp, src_type, dst_fp, dst_type) != 0) + return (CTF_ERR); /* errno is set for us */ break; }