From nobody Sun Mar 19 00:03:52 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PfJ4S4Bjnz40Bt0; Sun, 19 Mar 2023 00:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PfJ4S3k7kz4FC6; Sun, 19 Mar 2023 00:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679184232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5S8ajf8T2gm5lDevWbTKjY8Y0NsywrQRW/4M487Qt9s=; b=HF1rGYeaMRySSDcL8NrMEr8CA+Ej1rswhsFyJYXY0MwN/zSDsh7XQdeZLGnblVtoL1NwKD Juvvh8RYYgR3ZZl/cTdnFtx6nQGVFsDAT9p189Q8oT6Zo5MV0DYc9N/hCHG7pbWx5knJCv el99qRl96e8bUWxyFvY8GUBsgoqW+ad8tCmWXE5jQttkMWFqrtTINZ/xq/OhzuXYK0IVpM 35JC/BnKXRdBuyDcL2bComo2YF3mzQjsoO2U1qoPb01VYCWVekEPmOY8JvJY2JsIHdZSH0 x9rXOEmzATZibohThDKC9pbkUfNKcOU4/3AzPG6oMZc2cC7wAHnX9ZPBlMeG7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679184232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5S8ajf8T2gm5lDevWbTKjY8Y0NsywrQRW/4M487Qt9s=; b=MYVCyaD2zs5fIDklppfwcBCYI+vdjgF3VDNWOe8qw9NFx3t91SylgABbmK3WDfTYRvs93G VjxZC1WWWChFvRyT6GNIsuGfIN1iU2o5fgtZGEdnZ3LTSxAQg6DO7lBnyOLOU6Dg1dYC+B N/SmbBspDJzRl5OxidW5F3GMupvTiK2qd3ET9LanZHDD+usW0hFmvBktW8Z+gxQ+FzYxxh JZkcttSY5GaBTXR3zotZq8u4Bp4x9BOGYVD8U9W0X0bJiHsnebvjOLgSI9Nhea8HVTm/gZ Scs/pdEhlMjhe8WVV4UHlmvc/aSkg1Q++cnVwZDQzn6EggXIxH9VGIuaP6u19w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679184232; a=rsa-sha256; cv=none; b=k1oVfa6jvcFt4RSxCdnPUIiQ+FGJpPL2Nr7GcAqwj/epuAXwR8z2UGKscJvYhnJMxq0NCp 7YyqDp9k6XLbFG8euWRtwMj2BmGG0WwwtWRVr/H1RuMfo6SSVmf3B9+WoF7QEvxod4DN1q kSd/ViL5KtpM8mGjcO4StX5vsdh4kQ7cgRFPh0lYMUjZ7tKto+5gVMsmcGb5gy/FIUpQTQ B562PM/R/MqNaw2ktwsXMPRfONm9t2weT6lDhupjSXhpArAHyQXgdGm6MCh8vpes2YthgB 7qakn35TU3wBhkvyad2GQcynJZj7Lht4J3X8uvK/m7z2XksSBLe+wMMr3XFgJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PfJ4S2nwhzRj0; Sun, 19 Mar 2023 00:03: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 32J03qvX080919; Sun, 19 Mar 2023 00:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32J03qKD080918; Sun, 19 Mar 2023 00:03:52 GMT (envelope-from git) Date: Sun, 19 Mar 2023 00:03:52 GMT Message-Id: <202303190003.32J03qKD080918@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: 191115cfb625 - main - Fix syntax error in 0697670. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 191115cfb6257ca7fba63005b0e01039e065bfd3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=191115cfb6257ca7fba63005b0e01039e065bfd3 commit 191115cfb6257ca7fba63005b0e01039e065bfd3 Author: Kirk McKusick AuthorDate: 2023-03-19 00:02:59 +0000 Commit: Kirk McKusick CommitDate: 2023-03-19 00:03:32 +0000 Fix syntax error in 0697670. Reported by: Michael Tuexen --- sys/ufs/ufs/ufs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 54046c285fd7..a027a22cc9ca 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1732,7 +1732,7 @@ relock: SET_I_OFFSET(fip, mastertemplate.dot_reclen); if (ufs_dirrewrite(fip, fdp, newparent, DT_DIR, 0) != 0) ufs_dirbad(fip, mastertemplate.dot_reclen, - "rename: missing ".." entry"); + "rename: missing .. entry"); cache_purge(fdvp); } error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); From nobody Sun Mar 19 08:49:58 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PfWlV2CwNz3yxTL; Sun, 19 Mar 2023 08:49: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 4PfWlV1hl8z3qtF; Sun, 19 Mar 2023 08:49:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679215798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EsJ0ljKwwbnv4kP4gLpBDClC6GxCj0UvDTs5Rwv4UM4=; b=A/SlK4hy+azCJZSr+ugpuywpDrWiznXzIlKPZ0EHJDgBEWcysJrz+fsU8H1NrXsD8ODNmp CAobVDfmayxlM2dxoEyAQQ6ggGW31evqln9dYzdHO4j8G837x9DxtcSlnVPT+bDmZ7clf4 b4EfLp4v9QzGqG1hXR03I3Hlrc3asyGPL6jxjTNsh6p5RyE2Msev4vUr68ZvuzNwhbox0r gmb2gQ80afoCnLUKoS9lQbH9wTZptS17JMSv0VmzbvICSvSFnZV41LM5Lv78eMRiWeTxQh hozcJ2FDPgXfg0qh1v1EpHremMXYbdDiqALFUhQd8rDKqnwv82EqCwEbSP05fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679215798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EsJ0ljKwwbnv4kP4gLpBDClC6GxCj0UvDTs5Rwv4UM4=; b=qcOyg3j3pzz6YH0wvSXZxidtxwH1IH2d3SRuh7KzIhA4mUc5zGj2Glc2zeF6iPs9/uv6tB 2poJ8MbaULS+Ckr73w2EPmWD7w2Ude1g/WMLfXIhR27fXDfJAc8Agq2jKIpsq7bH/islFO ReG/m2AdOCyCXk64H141wiqQ7QrUMQBkcpUakuR3dC5nu3al8LStnDxlrB/2kC4FEDDSNi nRGlDvKpPp5t4eoPCgj/YVTHIJw08XnW7/UV9qiItZvv7xhV4Zb+9pWqEpmUKRNzFpyxTF QHJALonx4aXygzvn0FoW1ITvTrjwUJTepIQ2jJbWU7rW3d8FzpGWt9v6vGXv6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679215798; a=rsa-sha256; cv=none; b=bMsH0LG74l1LqwJKMupLYJ5cbTizF/v8n00jI/ubdRaSMF8w8J+p50b+97WxeutFArQa5s xBpOJUJPdVGLqSxr8CgJ92nzpvQZ5R563zoKGnTrrduKTR/uQ6hjqv9OLH4nFDNgSvVzKh kVocigTChSIWhflmDDI+CWJazZyTU3r3nBPYLxl42Mu90FJtEVijC4ZmEQl9i6Eks0Grtj 75nPhDwhdPzpW4pqVX+wWKkuUwYSJeMqLPMP9n80m6rRxx8MAJ/M1gxWsNNMuHv6Xxegb1 9tH+fS93fmwopZgEoTqFYS0fKmONlCQb1Bylqq2RU7w/Q5z2MR7GLK+lmJrwxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PfWlV0lflzhdf; Sun, 19 Mar 2023 08:49: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 32J8nwTG033555; Sun, 19 Mar 2023 08:49:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32J8nwKu033554; Sun, 19 Mar 2023 08:49:58 GMT (envelope-from git) Date: Sun, 19 Mar 2023 08:49:58 GMT Message-Id: <202303190849.32J8nwKu033554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: d37cca6570e9 - main - tcp_rack.4: Correct a link in the SEE ALSO section List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: d37cca6570e9b42fae46ed9ae3a5af5d065f4440 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=d37cca6570e9b42fae46ed9ae3a5af5d065f4440 commit d37cca6570e9b42fae46ed9ae3a5af5d065f4440 Author: Gordon Bergling AuthorDate: 2023-03-19 08:49:33 +0000 Commit: Gordon Bergling CommitDate: 2023-03-19 08:49:33 +0000 tcp_rack.4: Correct a link in the SEE ALSO section The PDF at arxiv.org is only accessible when retrieving it via the website. MFC after: 3 days --- share/man/man4/tcp_rack.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/tcp_rack.4 b/share/man/man4/tcp_rack.4 index ce424ae73045..cfdedb9901b8 100644 --- a/share/man/man4/tcp_rack.4 +++ b/share/man/man4/tcp_rack.4 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 7, 2022 +.Dd March 19, 2023 .Dt TCP_RACK 4 .Os .Sh NAME @@ -140,7 +140,7 @@ What method should we use for rate sampling 0=high, 1=low .%A "Ahmed M. Abdelmoniem" .%A "Brahim Bensaou" .%T "T-RACKs: A Faster Recovery Mechanism for TCP in Data Center Networks" -.%O "https://arxiv.org/pdf/2102.07477.pdf" +.%O "https://arxiv.org/abs/2102.07477" .%D "February 2021" .Re .Sh HISTORY From nobody Sun Mar 19 08:55:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PfWsq3F55z3yy5d; Sun, 19 Mar 2023 08:55: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 4PfWsq31Xjz3r6y; Sun, 19 Mar 2023 08:55:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679216127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i8roC9rzVo0BCfJxN/wGYvT7WHuthpW528Kk4wNwjAk=; b=pAZGasTH9SWvdXvnOQvU530+V1LqqBCDlzgmS+KvQZgfsApcun13ymKM3mhQIpmJn+oFGB f65ZT9FjSLJ+/BP2gHpqyIUSPTzjWOU3E5RPjWk4Vj+OKUgS9SL6Ghl0UCMacA64q6BoqF bhy35JhbsQ4QT7nnoWc7MQV3/5AQElnSY5IjOzYGiTGI17gszxxLgy/xKBtQR9hR6faZjv 19/Ahus1g3atwbRbCP033LnRmtho/vxOGt+3vL1jJl9JEBDnWjPctl8MPmVxcZVBRFcaQn qolWhHeVVY3fFjbpjAf75twLcquyUZklSTIrHdzWjKC1YEkdg2B3UYUphvrZKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679216127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i8roC9rzVo0BCfJxN/wGYvT7WHuthpW528Kk4wNwjAk=; b=mgoOOooxzhvsUOinN7zQ84Glx2KEnsfDr58QibVxh3xDQKW68HibjIqcv1SuE7+SW1myYA R+Xa/3FPZMd2Z/zE01aIzSEFEGU+mvmCSRYCf0Xyyh/A9nRhIUaKHkCfz+59R2R9dGkC0x WLvaHzgvaBBNFNKUK9bB5PMEkEKOU3yk1At9KVAUsrhOO8gOt8QGUyoL/o1Bi+15He8ACs hBcA7c6kk0f9eaaptQKtEX56uq2rTzJNbvBUNzYxu17LFCeu9eSSTQAyCUFqNp7FOHuXSD D75n1844wXMw5nbdC1eKahwzNUI/JKxpTS5ArG5Kq6quJeTdTHmhXOL2uPAdUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679216127; a=rsa-sha256; cv=none; b=rjbUqQ4lbUn3WghIOaiEVSAkkKQk+UR121k9P/lQ4ZFAffBGfPCqOTzCPPQWJn4hYhfYyw IGUanQ7zH7I8C5eGwJTPcohhVhsXfLxpmThDBfscWkU32W5CsrjLO1OzfdeVaJEPuH0hz7 Mkk0Fv8SQdXOKtbDfXPi+oPrN/graviGlaU2RJ/2K2ons99ghESQ2Jcp02oJD5+tka6a6a dCsLgSJumS0DeLmsPMpwy09GCUbwTmxz6sjp7L11OUiyLxZzJgQqBm3NZF70yqtbGwdbjV xiUFc63mG4In+5scdytSt2rcVrqKrzTswiMzsRwY9j4Gptw3elsswm+SUCTbpg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PfWsq24qBzhsY; Sun, 19 Mar 2023 08:55: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 32J8tRIr049524; Sun, 19 Mar 2023 08:55:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32J8tRi7049523; Sun, 19 Mar 2023 08:55:27 GMT (envelope-from git) Date: Sun, 19 Mar 2023 08:55:27 GMT Message-Id: <202303190855.32J8tRi7049523@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: ce7b20e5129c - main - stress2: Added more FFS tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: ce7b20e5129cf0f269951b313d336a9c7d54d790 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=ce7b20e5129cf0f269951b313d336a9c7d54d790 commit ce7b20e5129cf0f269951b313d336a9c7d54d790 Author: Peter Holm AuthorDate: 2023-03-19 08:55:00 +0000 Commit: Peter Holm CommitDate: 2023-03-19 08:55:00 +0000 stress2: Added more FFS tests --- tools/test/stress2/misc/all.exclude | 11 ++- tools/test/stress2/misc/force14.sh | 119 ++++++++++++++++++++++++ tools/test/stress2/misc/force15.sh | 113 +++++++++++++++++++++++ tools/test/stress2/misc/fsck10.sh | 171 ++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/fsck11.sh | 170 ++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/fsck12.sh | 177 ++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/gnop13.sh | 138 ++++++++++++++++++++++++++++ 7 files changed, 897 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 2f4e04473eff..022075e63cb4 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -5,9 +5,14 @@ backingstore.sh g_vfs_done():md6a[WRITE(offset=...)]error = 28 20111220 backingstore2.sh panic: 43 vncache entries remaining 20111220 backingstore3.sh g_vfs_done():md6a[WRITE(offset=...)]error = 28 20111230 dd.sh CAM stuck in vmwait 20200116 +force13.sh https://people.freebsd.org/~pho/stress/log/log0376.txt 20221113 +force14.sh Waiting for fix 20230319 +force15.sh Waiting for fix 20230319 force4.sh https://people.freebsd.org/~pho/stress/log/log0082.txt 20210328 force7.sh https://people.freebsd.org/~pho/stress/log/log0266.txt 20220207 -force13.sh https://people.freebsd.org/~pho/stress/log/log0376.txt 20221113 +fsck10.sh Waiting for fix 20230319 +fsck11.sh Waiting for fix 20230319 +fsck12.sh Waiting for fix 20230319 fsync.sh panic: Journal overflow 20190208 fuse.sh Memory corruption seen in log file kostik734.txt 20141114 fuse2.sh Deadlock seen 20121129 @@ -18,10 +23,11 @@ gjournal.sh panic: Journal overflow 20190626 gjournal2.sh panic: Journal overflow 20180125 gjournal3.sh panic: Bio not on queue 20171225 gjournal4.sh CAM stuck in vmwait 20180517 +gnop10.sh Waiting for fix 20230319 +gnop13.sh https://people.freebsd.org/~pho/stress/log/log0386.txt 20221113 gnop7.sh Waiting for patch commit 20190820 gnop8.sh Waiting for patch commit 20201214 gnop9.sh Waiting for patch commit 20201214 -gnop13.sh https://people.freebsd.org/~pho/stress/log/log0386.txt 20221113 graid1_8.sh Known issue 20170909 graid1_9.sh panic: Bad effnlink 20180212 ifconfig.sh Bug 253824 20210322 @@ -49,6 +55,7 @@ sctp3.sh panic: Queues are not empty when handling SHUTDOWN-COMPLETE 20210211 sendfile25.sh WiP 20200611 signal.sh Timing issues. Needs fixing 20171116 snap8.sh https://people.freebsd.org/~pho/stress/log/log0123.txt 20211008 +suj12.sh Waiting for fix 20230319 suj19.sh https://people.freebsd.org/~pho/stress/log/log0378.txt 20221113 suj27.sh https://people.freebsd.org/~pho/stress/log/log0387.txt 20221113 suj36.sh https://people.freebsd.org/~pho/stress/log/log0392.txt 20221114 diff --git a/tools/test/stress2/misc/force14.sh b/tools/test/stress2/misc/force14.sh new file mode 100755 index 000000000000..eec850c50891 --- /dev/null +++ b/tools/test/stress2/misc/force14.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# SU+J Snapshot test with a 50G file system + +# "panic: handle_jwork: Unknown type jnewblk" seen: +# https://people.freebsd.org/~pho/stress/log/log0422.txt + +# "panic: flush_pagedep_deps: failed to flush inodedep..." seen: +# https://people.freebsd.org/~pho/stress/log/log0423.txt + +# "panic: softdep_deallocate_dependencies: dangling deps" seen: +# https://people.freebsd.org/~pho/stress/log/log0424.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +set -u +log=/tmp/force14.sh.log +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +truncate -s 50g $diskimage +mdconfig -a -t vnode -f $diskimage -u $mdstart +flags="-j" + +newfs $flags md$mdstart > /dev/null 2>&1 + +# Exclude rename for now due to log0374.txt +export TESTPROGS=`cd ..; find testcases/ -perm -1 -type f | \ + egrep -Ev "/run/|/badcode/|/pty/|/shm/|/socket/|sysctl|tcp|thr|udp|rename"` +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX +export CTRLDIR=$mntpoint/stressX.control +start=`date +%s` +while [ $((`date +%s` - start)) -lt $((15 * 60)) ]; do + mount /dev/md$mdstart $mntpoint + rm -fr $mntpoint/lost+found + chmod 777 $mntpoint + + su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ + /dev/null 2>&1 & + + t=`jot -r 1 60 180` + st=`date +%s` + mkdir -p $mntpoint/.snap + for i in `jot 10`; do + rm -f $mntpoint/.snap/$i + mksnap_ffs $mntpoint $mntpoint/.snap/$i || + { ../tools/killall.sh; break; } + sleep `jot -r 1 1 5` + [ $((`date +%s` - st)) -ge $t ] && break + done & + sleep `jot -r 1 60 180` + 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 -q "on $mntpoint "; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } + done + mdconfig -a -t vnode -f $diskimage -u $mdstart + c=0 + # Process the journal + fsck_ffs -fy /dev/md$mdstart > $log 2>&1; s=$? + grep 'INTERNAL ERROR: GOT TO reply' $log + for i in `jot 4`; do + [ $i -ne 1 ] && + echo "fsck_ffs -fy /dev/md$mdstart" + fsck_ffs -fy /dev/md$mdstart > $log 2>&1; s=$? + grep 'INTERNAL ERROR: GOT TO reply' $log + grep -q CLEAN $log && c=$((c+=1)) + grep -Eq "WAS MODIFIED" $log || break + done + [ $c -gt 1 ] && + { echo "Note: FS marked clean+modified $c times out of $i fsck runs"; s=101; } + [ $s -ne 0 ] && break + grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=102; 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 +fi +exit $s diff --git a/tools/test/stress2/misc/force15.sh b/tools/test/stress2/misc/force15.sh new file mode 100755 index 000000000000..955025cd98c6 --- /dev/null +++ b/tools/test/stress2/misc/force15.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# FFS+SU with snapshots and forced unmounts + +# "panic: flush_pagedep_deps: failed to flush inodedep ..." seen +# https://people.freebsd.org/~pho/stress/log/log0427.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +prog=$(basename "$0" .sh) +diskimage=/tmp/diskimage +log=/tmp/$prog.log +mdstart=10 +mntpoint=/mnt +newfs_flags="-U" + +set -u +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +dd if=/dev/zero of=$diskimage bs=1m count=1k status=none +mdconfig -a -t vnode -f $diskimage -u $mdstart +flags="-U" + +newfs $flags md$mdstart > /dev/null 2>&1 + +start=`date +%s` +while [ $((`date +%s` - start)) -lt $((5 * 60)) ]; do + mount /dev/md$mdstart $mntpoint + rm -fr $mntpoint/lost+found + + jot 10 | xargs -I% mkdir -p $mntpoint/% + n=5000 + for j in `jot 10`; do + ( + jot $n | xargs -P0 -I% touch $mntpoint/$j/% + jot $n | xargs -P0 -I% rm $mntpoint/$j/% + ) > /dev/null 2>&1 & + done + + sleep `jot -r 1 5 20` + t=`jot -r 1 60 180` + st=`date +%s` + mkdir -p $mntpoint/.snap + for i in `jot 10`; do + rm -f $mntpoint/.snap/$i + mksnap_ffs $mntpoint $mntpoint/.snap/$i > /dev/null 2>&1 || break + sleep `jot -r 1 1 5` + [ $((`date +%s` - st)) -ge $t ] && break + done & + sleep `jot -r 1 2 5` + while mdconfig -l | grep -q md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 + done + sleep 1 + wait + n=0 + while mount | grep -q "on $mntpoint "; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } + done + mdconfig -a -t vnode -f $diskimage -u $mdstart + c=0 + for i in `jot 5`; do + [ $i -ne 1 ] && + echo "$i: fsck_ffs -fy /dev/md$mdstart" + fsck_ffs -fy /dev/md$mdstart > $log 2>&1; s=$? + grep 'INTERNAL ERROR: GOT TO reply' $log + grep -q CLEAN $log && grep -q MODIFIED && c=$((c+=1)) + grep -Eq "WAS MODIFIED" $log || break + done + [ $c -gt 1 ] && + { echo "Note: FS marked clean+modified $c times out of $i fsck runs"; s=101; } + [ $s -ne 0 ] && break + grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=102; 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 +fi +exit $s diff --git a/tools/test/stress2/misc/fsck10.sh b/tools/test/stress2/misc/fsck10.sh new file mode 100755 index 000000000000..30479e0dfebb --- /dev/null +++ b/tools/test/stress2/misc/fsck10.sh @@ -0,0 +1,171 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# Variation of fsck9.sh with smaller disk size and newfs options '', 'U' and 'O1' +# fsck_ffs core dump seen + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 + +set -e +prog=$(basename "$0" .sh) +u1=$mdstart +u2=$((mdstart + 1)) +mp1=${mntpoint}$u1 +mp2=${mntpoint}$u2 +mkdir -p $mp1 $mp2 +log=$mp1/$prog.sh.log +diskimage=$mp1/$prog.sh.diskimage +backup=/tmp/$prog.sh.diskimage.`date +%Y%m%dT%H%M%S`.gz +cleans=0 +reruns=0 + +# Pick a random newfs flag +newfs_flags=$(echo "" "-U" "-O1" | awk -v N=`jot -r 1 1 3` '{print $N}') +[ $# -eq 1 ] && newfs_flags="$1" # or use script argument +max=$((512 * 1024)) + +mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 +[ -c /dev/md$u1 ] && mdconfig -d -u $u1 +mdconfig -a -t swap -s 1g -u $u1 +newfs $newfs_flags -n /dev/md$u1 > /dev/null +mount /dev/md$u1 $mp1 + +[ -c /dev/md$u2 ] && mdconfig -d -u $u2 +dd if=/dev/zero of=$diskimage bs=$max count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $u2 +backups=`newfs -N $newfs_flags md$u2 | grep -A1 "super-block backups" | \ + tail -1 | sed 's/,//g'` +echo "newfs $newfs_flags -n md$u2" +newfs $newfs_flags -n md$u2 > /dev/null +set +e + +chk() { + local i + + clean=0 + rerun=0 + fsck_ffs -fy $1 > $log 2>&1 + r=$? + if grep -qiE "super-?block.*failed" $log; then + for b in $backups; do + echo "fsck_ffs -b $b -fy $1" + fsck_ffs -b $b -fy $1 > $log 2>&1 + r=$? + grep -qiE "super-?block.*failed" $log || + break + echo "Checking next SB" + done + usedasb=1 + else + usedasb=0 + fi + LANG=C egrep -q "[A-Z][A-Z]" $log && clean=0 + grep -Eq "IS CLEAN|MARKED CLEAN" $log && clean=1 + grep -q RERUN $log && rerun=1 + [ $r -ne 0 -a $clean -eq 1 ] && echo "Exit code $r w/ clean == 1" +} + +cd $mp1 +clean=0 +errors=0 +s=0 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + mount /dev/md$u2 $mp2 || break + if ! ls -lR $mp2 > /dev/null; then + s=102 + echo "ls failed"; grep "core dumped" /var/log/messages | tail -1 + break + fi + rm -f $mp2/???????? + touch $mp2/`jot -rc 8 a z | tr -d '\n'` + mkdir -p $mp2/dir/dir/dir/dir + echo "abc" > $mp2/dir/dir/dir/dir/f + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + mdconfig -d -u $u2 + + # Introduce 5 random single bit errors to the file system image + /tmp/flip -n 5 $diskimage + + sync; sleep .1 + if [ `stat -f%z $diskimage` -gt $max ]; then + ls -lh $diskimage + truncate -s $max $diskimage + else + gzip < $diskimage > $backup + fi + fsync $backup + sync; sleep .1 + + for i in `jot 5`; do + [ $i -gt 2 ] && echo "fsck run #$i" + chk $diskimage + [ $rerun -eq 1 ] && { reruns=$((reruns + 1)); continue; } + [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } + if [ -f fsck_ffs.core ]; then + tstamp=`date +%Y%m%dT%H%M%S` + gzip < $backup > /tmp/fsck_ffs.core.diskimage.$tstamp + gzip < fsck_ffs.core > /tmp/fsck_ffs.core.$tstamp + break 2 + fi + done + if [ $clean -eq 1 ]; then + fsck_ffs -fy $diskimage > $log 2>&1 + if grep -q MODIFIED $log; then + echo "*** fsck of \"clean\" FS found more issues:" + cat $log + errors=$((errors + 1)) + s=1 + break + fi + fi + [ $clean -ne 1 ] && break + mdconfig -a -t vnode -f $diskimage -u $u2 +done +for i in `jot 5`; do + mount | grep -q "on $mp2 " || break + umount $mp2 && break + sleep 2 +done +mdconfig -l | grep -q $u2 && mdconfig -d -u $u2 + +[ $s -eq 0 ] && rm -f $backup || echo "Preserved $backup due to status code $s" +cd /tmp +for i in `jot 5`; do + umount $mp1 && break + sleep 2 +done +mdconfig -d -u $u1 +rm -f /tmp/flip +exit $s diff --git a/tools/test/stress2/misc/fsck11.sh b/tools/test/stress2/misc/fsck11.sh new file mode 100755 index 000000000000..cb5d1d256be6 --- /dev/null +++ b/tools/test/stress2/misc/fsck11.sh @@ -0,0 +1,170 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# Demonstrate how the "CLEAN" message and the exit code can be misleading + +# "panic: softdep_update_inodeblock inconsistent ip ..." seen: +# https://people.freebsd.org/~pho/stress/log/log0421.txt +# https://people.freebsd.org/~pho/fsck11.sh.diskimage.20230228T064402.gz + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 + +set -e +prog=$(basename "$0" .sh) +u1=$mdstart +u2=$((mdstart + 1)) +mp1=${mntpoint}$u1 +mp2=${mntpoint}$u2 +mkdir -p $mp1 $mp2 +log=$mp1/$prog.sh.log +diskimage=$mp1/$prog.sh.diskimage +backup=/tmp/$prog.sh.diskimage.`date +%Y%m%dT%H%M%S`.gz +cleans=0 +reruns=0 + +# Pick a random newfs flag +newfs_flags=$(echo "" "-U" "-O1" | awk -v N=`jot -r 1 1 3` '{print $N}') +[ $# -eq 1 ] && newfs_flags="$1" # or use script argument +max=$((2 * 1024 * 1024)) +[ "$newfs_flags" == "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file + +mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 +[ -c /dev/md$u1 ] && mdconfig -d -u $u1 +mdconfig -a -t swap -s 1g -u $u1 +newfs $newfs_flags -n /dev/md$u1 > /dev/null +mount /dev/md$u1 $mp1 + +[ -c /dev/md$u2 ] && mdconfig -d -u $u2 +dd if=/dev/zero of=$diskimage bs=$max count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $u2 +backups=`newfs -N $newfs_flags md$u2 | grep -A1 "super-block backups" | \ + tail -1 | sed 's/,//g'` +echo "newfs $newfs_flags -n md$u2" +newfs $newfs_flags -n md$u2 > /dev/null +set +e + +chk() { + local i + + clean=0 + rerun=0 + fsck_ffs -fy $1 > $log 2>&1 + r=$? + if grep -qiE "super-?block.*failed" $log; then + for b in $backups; do + echo "fsck_ffs -b $b -fy $1" + fsck_ffs -b $b -fy $1 > $log 2>&1 + r=$? + grep -qiE "super-?block.*failed" $log || + break + echo "Checking next SB" + done + usedasb=1 + else + usedasb=0 + fi + LANG=C egrep -q "[A-Z][A-Z]" $log && clean=0 + grep -Eq "IS CLEAN|MARKED CLEAN" $log && clean=1 + grep -q RERUN $log && rerun=1 + [ $r -ne 0 -a $clean -eq 1 ] && echo "Exit code $r w/ clean == 1" +} + +cd $mp1 +clean=0 +errors=0 +s=0 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + mount /dev/md$u2 $mp2 || break + if ! ls -lR $mp2 > /dev/null; then + s=102 + echo "ls failed"; grep "core dumped" /var/log/messages | tail -1 + break + fi + + find $mp2 -type f | xargs cat > /dev/null + for j in `jot 9`; do + rm -rf $mp2/$j + mkdir $mp2/$j + jot 10 | xargs -P0 -I% cp /etc/group $mp2/$j/% + done 2>/dev/null + + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + mdconfig -d -u $u2 + + # Introduce 5 random single bit errors to the file system image + /tmp/flip -n 5 $diskimage + + if [ `stat -f%z $diskimage` -gt $max ]; then + ls -lh $diskimage + truncate -s $max $diskimage + else + gzip < $diskimage > $backup + fi + fsync $backup + sync; sleep 1 + + [ $newfs_flags == "-j" ] && + fsck -fy $diskimage > $log 2>&1 # process the journal file + for i in `jot 5`; do + [ $i -gt 2 ] && echo "fsck run #$i" + chk $diskimage + [ $rerun -eq 1 ] && { reruns=$((reruns + 1)); continue; } + [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } + if [ -f fsck_ffs.core ]; then + tstamp=`date +%Y%m%dT%H%M%S` + gzip < $backup > /tmp/fsck_ffs.core.diskimage.$tstamp + gzip < fsck_ffs.core > /tmp/fsck_ffs.core.$tstamp + break 2 + fi + done + [ $clean -ne 1 ] && { s=99; break; } # broken image? + mdconfig -a -t vnode -f $diskimage -u $u2 +done +for i in `jot 5`; do + mount | grep -q "on $mp2 " || break + umount $mp2 && break + sleep 2 +done +mdconfig -l | grep -q $u2 && mdconfig -d -u $u2 + +[ $s -eq 0 ] && rm -f $backup || echo "Preserved $backup due to status code $s" +cd /tmp +for i in `jot 5`; do + umount $mp1 && break + sleep 2 +done +mdconfig -d -u $u1 +rm -f /tmp/flip +exit $s diff --git a/tools/test/stress2/misc/fsck12.sh b/tools/test/stress2/misc/fsck12.sh new file mode 100755 index 000000000000..d2787e962927 --- /dev/null +++ b/tools/test/stress2/misc/fsck12.sh @@ -0,0 +1,177 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# "panic: ffs_copyonwrite: bad copy block" seen: +# Hunt for fsck_ffs's INTERNAL ERROR message + +# https://people.freebsd.org/~pho/stress/log/log0426.txt + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 + +set -e +prog=$(basename "$0" .sh) +u1=$mdstart +u2=$((mdstart + 1)) +mp1=${mntpoint}$u1 +mp2=${mntpoint}$u2 +mkdir -p $mp1 $mp2 +log=$mp1/$prog.sh.log +diskimage=$mp1/$prog.sh.diskimage +backup=/tmp/$prog.sh.diskimage.`date +%Y%m%dT%H%M%S`.gz +cleans=0 +reruns=0 + +mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 +[ -c /dev/md$u1 ] && mdconfig -d -u $u1 +mdconfig -a -t swap -s 1g -u $u1 +newfs $newfs_flags -n /dev/md$u1 > /dev/null +mount /dev/md$u1 $mp1 + +newfs_flags='-j' +[ $# -eq 1 ] && newfs_flags="$1" # or use script argument +max=$((2 * 1024 * 1024)) +[ "$newfs_flags" == "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file + +[ -c /dev/md$u2 ] && mdconfig -d -u $u2 +dd if=/dev/zero of=$diskimage bs=$max count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $u2 +backups=`newfs -N $newfs_flags md$u2 | grep -A1 "super-block backups" | \ + tail -1 | sed 's/,//g'` +echo "newfs $newfs_flags md$u2" +newfs $newfs_flags md$u2 > /dev/null +set +e + +chk() { + local i + + clean=0 + rerun=0 + fsck_ffs -fy $1 > $log 2>&1 + r=$? + grep "GOT TO reply" $log && exit 1 + if grep -qiE "super-?block.*failed" $log; then + for b in $backups; do + echo "fsck_ffs -b $b -fy $1" + fsck_ffs -b $b -fy $1 > $log 2>&1 + r=$? + grep "GOT TO reply" $log && exit 1 + grep -qiE "super-?block.*failed" $log || + break + echo "Checking next SB" + done + usedasb=1 + else + usedasb=0 + fi + LANG=C egrep -q "[A-Z][A-Z]" $log && clean=0 + grep -Eq "IS CLEAN|MARKED CLEAN" $log && clean=1 + grep -q RERUN $log && rerun=1 + [ $r -ne 0 -a $clean -eq 1 ] && echo "Exit code $r w/ clean == 1" +} + +cd $mp1 +clean=0 +errors=0 +s=0 +sno=0 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + mount /dev/md$u2 $mp2 || break + if ! ls -lR $mp2 > /dev/null; then + s=102 + echo "ls failed"; grep "core dumped" /var/log/messages | tail -1 + break + fi + mkdir -p $mp2/d/d/d/d/d + cp /etc/group $mp2/d/d/d/d/d/f + for i in `jot 20`; do + cp -r $mp2/d $i + done + + rm -f $mp2/.snap/$sno + mksnap_ffs $mp2 $mp2/.snap/$sno & + sno=$(((sno + 1) % 10)) + + sleep 1 + rm -rf $mp/? + wait + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + mdconfig -d -u $u2 + + # Introduce 5 random single bit errors to the file system image + /tmp/flip -n 5 $diskimage + + if [ `stat -f%z $diskimage` -gt $max ]; then + ls -lh $diskimage + truncate -s $max $diskimage + else + gzip < $diskimage > $backup + fi + fsync $backup + sync; sleep 1 + + [ $newfs_flags == "-j" ] && + fsck -fy $diskimage > $log 2>&1 # process the journal file + for i in `jot 5`; do + [ $i -gt 2 ] && echo "fsck run #$i" + chk $diskimage + [ $rerun -eq 1 ] && { reruns=$((reruns + 1)); continue; } + grep -q "MODIFIED" $log && continue # For now, do not trust CLEAN + [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } + if [ -f fsck_ffs.core ]; then + tstamp=`date +%Y%m%dT%H%M%S` + gzip < $backup > /tmp/fsck_ffs.core.diskimage.$tstamp.gz + gzip < fsck_ffs.core > /tmp/fsck_ffs.core.$tstamp.gz + break 2 + fi + done + [ $clean -ne 1 ] && { s=99; break; } # broken image? + mdconfig -a -t vnode -f $diskimage -u $u2 +done +for i in `jot 5`; do + mount | grep -q "on $mp2 " || break + umount $mp2 && break + sleep 2 +done +mdconfig -l | grep -q $u2 && mdconfig -d -u $u2 + +[ $s -eq 0 ] && rm -f $backup || echo "Preserved $backup due to status code $s" +cd /tmp +for i in `jot 5`; do + umount $mp1 && break + sleep 2 +done +mdconfig -d -u $u1 +rm -f /tmp/flip +exit $s diff --git a/tools/test/stress2/misc/gnop13.sh b/tools/test/stress2/misc/gnop13.sh new file mode 100755 index 000000000000..45668b9d8e82 --- /dev/null +++ b/tools/test/stress2/misc/gnop13.sh @@ -0,0 +1,138 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 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. +# + +# Snapshot test +# Variation of force13.sh, but uses "gnop -f destroy" + +# Seen: +# UFS: forcibly unmounting /dev/md10.nop from /mnt +# panic: flush_pagedep_deps: failed to flush inodedep + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +set -u +log=/tmp/gnop13.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 +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" + +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null 2>&1 + +# Exclude rename for now due to log0374.txt +export TESTPROGS=`cd ..; find testcases/ -perm -1 -type f | \ + egrep -Ev "/run/|/badcode/|/pty/|/shm/|/socket/|sysctl|tcp|thr|udp|rename"` +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX +export CTRLDIR=$mntpoint/stressX.control +start=`date +%s` +while [ $((`date +%s` - start)) -lt $((15 * 60)) ]; do + gnop create /dev/md$mdstart || exit 1 + mount /dev/md$mdstart.nop $mntpoint || exit 1 + rm -fr $mntpoint/lost+found + chmod 777 $mntpoint + + su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ + /dev/null 2>&1 & + + t=`jot -r 1 60 120` + st=`date +%s` + for i in `jot 10`; do + [ -d $mntpoint/.snap ] || break + rm -f $mntpoint/.snap/$i + echo "mksnap_ffs $mntpoint $mntpoint/.snap/$i" + mksnap_ffs $mntpoint $mntpoint/.snap/$i + sleep `jot -r 1 1 5` + [ $((`date +%s` - st)) -ge $t ] && break + done & + sleep `jot -r 1 60 120` + while [ -c /dev/md$mdstart.nop ]; do + echo "gnop destroy -f /dev/md$mdstart.nop" + gnop destroy -f /dev/md$mdstart.nop || sleep 1 + done + n=0 + st=`date +%s` + while mount | grep -q "on $mntpoint "; do + [ $n -eq 0 ] && /bin/echo -n "Waiting for $mntpoint to force umount ..." + n=$((n + 1)) + sleep 2 + if [ $((`date +%s` - st)) -ge 180 ]; then + echo "Giving up on waiting for umount of $mntpoint" + umount $mntpoint || umount -f $mntpoint + break + fi + done + [ $n -ne 0 ] && echo + + ../tools/killall.sh + wait + mount | grep -q "on $mntpoint " && umount -f $mntpoint + c=0 + # Run fsck minimum two times + for i in `jot 5`; do + fsck_ffs -fy /dev/md$mdstart > $log 2>&1; s=$? + grep -q CLEAN $log && grep -q "MODIFIED" $log && c=$((c+=1)) + grep -Eq "FILE SYSTEM WAS MODIFIED" $log || break + done + [ $c -gt 1 ] && + { echo "Note: FS marked clean+modified $c times out of $i fsck runs"; s=101; } + [ $s -ne 0 ] && break + grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=102; break; } +done +[ $s -eq 101 ] && s=0 # Ignore CLEANish problem for now +if [ $s -eq 0 ]; then + mount /dev/md$mdstart.nop $mntpoint + cp -R /usr/include $mntpoint + dd if=/dev/zero of=$mntpoint/big bs=1m count=10 status=none + find $mntpoint/* -delete + + # Check the RO snapshots + for f in $mntpoint/.snap/*; do + c=0 + for i in `jot 5`; do + echo "fsck_ffs -fy $f" + fsck_ffs -fy $f > $log 2>&1; s=$? + grep -q CLEAN $log && grep -q "MODIFIED" $log && c=$((c+=1)) + grep -Eq "FILE SYSTEM WAS MODIFIED" $log || break + done + [ $c -gt 1 ] && + { echo "Note: snapshot $i marked clean+modified $c times out of $i fsck runs"; s=201; } + [ $s -ne 0 ] && break + grep -Eq "IS CLEAN|MARKED CLEAN" $log || + { s=202; tail -10 $log; break; } + done + umount $mntpoint + mdconfig -d -u $mdstart + rm -f $diskimage $log +fi +exit $s From nobody Sun Mar 19 16:33:25 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pfk2G1hg5z40PJp; Sun, 19 Mar 2023 16:33: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 4Pfk2G19qYz4TDk; Sun, 19 Mar 2023 16:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnkD1/Y8lbZ15wGR+ek+lmt//O8IApLA3DOYefzLuiQ=; b=LMCe/yo7RiSZWtfUKQqPg25F/a3HwAMjw751fmsHaTf+29kkKTNLdwVT+Fj1MrtWV7mRIg R4I4Hbzsr26K+JC98o6qbfNfu4blRGYnrsN39coZsABvlK1I35U6bjetWVTmehZfdyGnBn xfqpEL9vRp+k2lobmpOROjjXPQRkJJ9cwV0tnH3WnYdYv8lgCUTsposvJNyTzFImh6BBRk cppmbT6lPPUoyLvszmmUUJ7S6DQ2rRu20ycfJeTITJJkDLZejRrcLsLKAs4HUDaoVXLkVF zhG96ByKKmk2iZIJ2Y3ZBE4dIicSZIifr8kRbRv76EElnIBHnvTPiemqJP6sOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnkD1/Y8lbZ15wGR+ek+lmt//O8IApLA3DOYefzLuiQ=; b=ff9w8NTtC73aq3OuYDf/07BmkuK4GBNS3x6cvP/tqy06ECxlw8LeKDQEEhNSyfhNwdlo7G PsA+q3bUC4U8Y9hH+uimSOH+dXRQnCk4SazdhKFzVJ99RmFz8KihZ1Z7/OOfiwlEA8QUw8 5zQ38tu1dDHwJ2xCSBcr2i7ggD7lFNlXVQjlIYh63mdT3nvsvgS8BpmKg8z949jT4zLMuJ Cci1FoPYQ4Unq/fXr096ayCTL1JYaj104jdsylCaJo4qaHW1Jti9duaxS0XlaCj6ACi4C+ R5fZZi8oCIyhCc6DNQK6IQNCxOn0oQfHfgNKUWIwxi4cH1wrSdZENO7//xVN3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679243606; a=rsa-sha256; cv=none; b=PQdKXEX8gAxcDk0SM1ZJsGFsq44aIxD8BgAfYff3HBupaYSqDrwlkZxzF2CT9sNQhTnVK+ cBR7rAs/JuqCkt6SNSLznhbWOdaUH5+ZXAxVy67B4IsHHBEYMCm0QFcAopn6jf5NFsNRgW 4LqPRzRgFmkQJcYTC+f2iVxbiIix198Ym3tI6dS26IMgA1tFw3D0R19cKt+T9EJpaZ/D0a CLh3fSX1syYh9aUzIIZ6qNiMHpOchfM2rbItY39ja0qEmi1C7ZpB/Jwt5WZLEUUWCkc6vI VKyWwvHYrwSUTpxE8iI2oHhHaH1ON26Vp4zK2WCFUYNaVV3KrCLb7bPBmq3fIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pfk2G0CnXzwPn; Sun, 19 Mar 2023 16:33: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 32JGXPhR003164; Sun, 19 Mar 2023 16:33:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32JGXPov003163; Sun, 19 Mar 2023 16:33:25 GMT (envelope-from git) Date: Sun, 19 Mar 2023 16:33:25 GMT Message-Id: <202303191633.32JGXPov003163@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: 20b41303140e - main - ping: Print the IP options of the original packet List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20b41303140eee4dfb896558fb83600c5f013d39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=20b41303140eee4dfb896558fb83600c5f013d39 commit 20b41303140eee4dfb896558fb83600c5f013d39 Author: Jose Luis Duran AuthorDate: 2023-02-09 15:47:53 +0000 Commit: Mark Johnston CommitDate: 2023-03-19 16:23:06 +0000 ping: Print the IP options of the original packet When an ICMP packet contains an IP packet in its payload, and that original IP packet contains options, these options were not displayed accordingly in pr_iph(). pr_iph() is a function that prints the original "quoted packet" IP header, with only an IP struct as an argument. The IP struct does not contain IP options, and it is not guaranteed that the options will be contiguous in memory to the IP struct after d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52. Pass the raw ICMP data along with the IP struct, in order to print the options, if any. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38469 --- sbin/ping/ping.c | 19 ++++++++++--------- sbin/ping/tests/ping_test.sh | 2 +- sbin/ping/tests/test_ping.py | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index fe319bfb70a5..b1721ad72a5c 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -225,7 +225,7 @@ static void pinger(void); static char *pr_addr(struct in_addr); static char *pr_ntime(n_time); static void pr_icmph(struct icmp *, struct ip *, const u_char *const); -static void pr_iph(struct ip *); +static void pr_iph(struct ip *, const u_char *); static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *); static void pr_retip(struct ip *, const u_char *); static void status(int); @@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) struct ip oip; u_char oip_header_len; struct icmp oicmp; - const u_char *oicmp_raw; /* * Get size of IP header of the received packet. @@ -1355,8 +1354,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) } memcpy(&oip, icmp_data_raw, sizeof(struct ip)); - oicmp_raw = icmp_data_raw + oip_header_len; - memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && @@ -1366,7 +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) (oicmp.icmp_id == ident))) { (void)printf("%zd bytes from %s: ", cc, pr_addr(from->sin_addr)); - pr_icmph(&icp, &oip, oicmp_raw); + pr_icmph(&icp, &oip, icmp_data_raw); } else return; } @@ -1663,14 +1660,13 @@ pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) * Print an IP header with options. */ static void -pr_iph(struct ip *ip) +pr_iph(struct ip *ip, const u_char *cp) { struct in_addr ina; - u_char *cp; int hlen; hlen = ip->ip_hl << 2; - cp = (u_char *)ip + sizeof(struct ip); /* point to options */ + cp = cp + sizeof(struct ip); /* point to options */ (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst\n"); (void)printf(" %1x %1x %02x %04x %04x", @@ -1723,7 +1719,12 @@ pr_addr(struct in_addr ina) static void pr_retip(struct ip *ip, const u_char *cp) { - pr_iph(ip); + int8_t hlen; + + pr_iph(ip, cp); + + hlen = ip->ip_hl << 2; + cp = cp + hlen; if (ip->ip_p == 6) (void)printf("TCP: from port %u, to port %u (decimal)\n", diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh index 9f821ed96360..53383f2fb7bc 100644 --- a/sbin/ping/tests/ping_test.sh +++ b/sbin/ping/tests/ping_test.sh @@ -178,7 +178,7 @@ inject_pip_head() } inject_pip_body() { - atf_check -s exit:2 -o match:"Destination Host Unreachable" -o not-match:"01010101" python3 $(atf_get_srcdir)/injection.py pip + atf_check -s exit:2 -o match:"Destination Host Unreachable" -o match:"(01){40}" python3 $(atf_get_srcdir)/injection.py pip } inject_pip_cleanup() { diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py index a9b760ff7aca..79fd332f1c18 100644 --- a/sbin/ping/tests/test_ping.py +++ b/sbin/ping/tests/test_ping.py @@ -893,7 +893,6 @@ Vr HL TOS Len ID Flg off TTL Pro cks Src Dst "stderr": "", "redacted": False, }, - marks=pytest.mark.skip("XXX currently failing"), id="_3_1_opts_NOP_40", ), pytest.param( From nobody Sun Mar 19 16:33:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pfk2H36mvz40PJr; Sun, 19 Mar 2023 16:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pfk2H2Dl4z4SrX; Sun, 19 Mar 2023 16:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6as3w0/BRMD08e9uocFg7TE2q/2uWkJquQ8YQ0zAugc=; b=NHTSfgU8iSB96XCV/d9uvyz7lNuoxeDDGZWGv3rFDTmiaYhz95Si7QrVRwWEpGG/XC0yGM wGawRbTbAjhZf4Df3LGt1otj1TQLFDytHmXtOreN27mCjSpy5SNGfpdC/9bbFIlz/MCkv9 Us3XbLD+b5bewmtNMpLgnoeGx7VV5WhSv7+WRZ82lzdHJ6GBTHbh0n/LQuqKb8/Z0QpP/Q 0Tmg/DkxL7qSnbzmZTRYRU8yROVykjoQ3h9g+3LCeyrU134Rj0KnsR18I8VQ8m0ZK6j0AY lr7m1k1iVBKGG9lWuzZc72DJ+BhEcEQHZN3KGzXn15z/BtcFmp3BejuZ864K/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6as3w0/BRMD08e9uocFg7TE2q/2uWkJquQ8YQ0zAugc=; b=x+bxX09tiy/74y/jwWnThiUmqvOwnRqaEjHLsbH4hMfevbf6Uj3Od9ew5tJXR7Uw/z+um1 OqCoZ0qTh/5TQt6nI/ZpXY/e+Sjb/0iUHwWeC2STUpB1ZujC0WPqq/FhUyDrGpE8hK7xmu JRhzQ6OqbDhogn2VsIF9y+a1n25YFs8OKm1/chSmc2/uC8sx8Jy4suEE6NA7jBskSEz1zS E20nN4GLHgLgLCl6n+c5nCl4Y4YSWcYNErhykAbmSLzGbg8YpQ2MS2r6EgToEFiEN/T/Yq 12hZLOP2MMmNSB0h7FYi1BcoiOqWS9JyEL5tF/5KHBB2QNxXgVyWcDZxGgdSwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679243607; a=rsa-sha256; cv=none; b=XRDSzJDR/hL4GKDzkEmpbnA2jjW2/7u6KTB/Tzq4RZiOpmIjMcVjnpgnz7RrhMfqfToH/n uZxk0IZpUrH8Kb/xejoJOLlIDLGyWSxjchV85HaQZzVxM/erxqeZNcaqxK1CVfgZzXLI4W gJ5jAGLKhqM8DbfcX/yoi46vzwgLnoElim0i5bGEJhEDrGul1YJJiY57P32ssq329Ze5hm hrku2GUKqVfQRb8uRQUfsJZbC+T8TUVanhy8AV3rFaMYQJk2yBoo/CG5aSHeSP8IldCLvm 64kqS+D2WgqghVrFZieuxE4+UiObeFnVCAoJFdX94qUQmt+NCeIJkzE1o+dwBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pfk2H17C1zvx0; Sun, 19 Mar 2023 16:33: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 32JGXRIS003189; Sun, 19 Mar 2023 16:33:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32JGXR3j003188; Sun, 19 Mar 2023 16:33:27 GMT (envelope-from git) Date: Sun, 19 Mar 2023 16:33:27 GMT Message-Id: <202303191633.32JGXR3j003188@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: 1dc1f6bd3138 - main - ping: Remove pr_retip() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1dc1f6bd3138760a9e96e13017cc3c05e5e1b1e9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1dc1f6bd3138760a9e96e13017cc3c05e5e1b1e9 commit 1dc1f6bd3138760a9e96e13017cc3c05e5e1b1e9 Author: Jose Luis Duran AuthorDate: 2023-02-09 21:05:58 +0000 Commit: Mark Johnston CommitDate: 2023-03-19 16:23:22 +0000 ping: Remove pr_retip() Ping used to provide some sort of packet sniffing capabilities, this was in an era where hubs were used and tcpdump wasn't invented. pr_iph() is a function that prints the IP header of the packet. pr_retip() is essentially a wrapper function to pr_iph(), that also displays the source and destination ports of a TCP or UDP packet. After ef9e6dc7eebe9830511602904d3ef5218d964080 some of this functionality was almost removed, to only display packets sent by us (26+ years ago). At this point, reaching this code path was only possible by doctoring the original packet. After 46d7b45a267b3d78c5054b210ff7b6c55bfca42b this code path can never be reached. Remove the code. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38475 --- sbin/ping/ping.c | 33 +++++------------------------- sbin/ping/tests/test_ping.py | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index b1721ad72a5c..299b582e29c1 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -227,7 +227,6 @@ static char *pr_ntime(n_time); static void pr_icmph(struct icmp *, struct ip *, const u_char *const); static void pr_iph(struct ip *, const u_char *); static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *); -static void pr_retip(struct ip *, const u_char *); static void status(int); static void stopit(int); @@ -1571,11 +1570,11 @@ pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) break; } /* Print returned IP header information */ - pr_retip(oip, oicmp_raw); + pr_iph(oip, oicmp_raw); break; case ICMP_SOURCEQUENCH: (void)printf("Source Quench\n"); - pr_retip(oip, oicmp_raw); + pr_iph(oip, oicmp_raw); break; case ICMP_REDIRECT: switch(icp->icmp_code) { @@ -1596,7 +1595,7 @@ pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) break; } (void)printf("(New addr: %s)\n", inet_ntoa(icp->icmp_gwaddr)); - pr_retip(oip, oicmp_raw); + pr_iph(oip, oicmp_raw); break; case ICMP_ECHO: (void)printf("Echo Request\n"); @@ -1615,12 +1614,12 @@ pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) icp->icmp_code); break; } - pr_retip(oip, oicmp_raw); + pr_iph(oip, oicmp_raw); break; case ICMP_PARAMPROB: (void)printf("Parameter problem: pointer = 0x%02x\n", icp->icmp_hun.ih_pptr); - pr_retip(oip, oicmp_raw); + pr_iph(oip, oicmp_raw); break; case ICMP_TSTAMP: (void)printf("Timestamp\n"); @@ -1712,28 +1711,6 @@ pr_addr(struct in_addr ina) return(buf); } -/* - * pr_retip -- - * Dump some info on a returned (via ICMP) IP packet. - */ -static void -pr_retip(struct ip *ip, const u_char *cp) -{ - int8_t hlen; - - pr_iph(ip, cp); - - hlen = ip->ip_hl << 2; - cp = cp + hlen; - - if (ip->ip_p == 6) - (void)printf("TCP: from port %u, to port %u (decimal)\n", - (*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3))); - else if (ip->ip_p == 17) - (void)printf("UDP: from port %u, to port %u (decimal)\n", - (*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3))); -} - static char * pr_ntime(n_time timestamp) { diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py index 79fd332f1c18..639973d093d4 100644 --- a/sbin/ping/tests/test_ping.py +++ b/sbin/ping/tests/test_ping.py @@ -920,6 +920,54 @@ Vr HL TOS Len ID Flg off TTL Pro cks Src Dst }, id="_3_1_flags_DF", ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "special": "tcp", + }, + { + "returncode": 2, + "stdout": """\ +PATTERN: 0x01 +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": """\ +ping: quoted data too short (40 bytes) from 192.0.2.2 +""", + "redacted": False, + }, + id="_3_1_special_tcp", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "special": "udp", + }, + { + "returncode": 2, + "stdout": """\ +PATTERN: 0x01 +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": """\ +ping: quoted data too short (28 bytes) from 192.0.2.2 +""", + "redacted": False, + }, + id="_3_1_special_udp", + ), ] @pytest.mark.parametrize("pinger_kargs, expected", pinger_testdata) From nobody Sun Mar 19 16:33:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pfk2J3BxKz40P2t; Sun, 19 Mar 2023 16:33:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pfk2J2mSZz4T6J; Sun, 19 Mar 2023 16:33:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EG5tUPBfrwbJxlH6wDAR9MU0Clqmxax2q0Fb/3PtAS8=; b=AgOkHDQtl24Nxj6/8mN9zWRbMAqqIKVKzyIyc0AgoSq85HFWw1yBuGG4shYOT8GXiqspF3 DEQfUiOewuHYKRS5CUxBopGYLyIf4HeFr0aBd1BmeYGoIp0dp65Cx23pCyuDz0SsPWzyZf zACdTSaiyYPweq+STRUEHSk+nlveLXHCP8nUJ+YHkI2wLXbCdSWt5FXlOBVwDzv9bvnBlI 4EQv67ytv4TsDMQcvPt7mY88UZurthZdDPRpHtXwhSmeBRS37SFBQxhUIhMTxxQgQqSfUQ bzVAzzvUduYSbqBIw3FkjXhEAoweMSrF3KJXmmYO4I89HYs7wzgpr7wQf5yyiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EG5tUPBfrwbJxlH6wDAR9MU0Clqmxax2q0Fb/3PtAS8=; b=wmevy02Dms4meE1iMyqlTSoEP35343HJIt9pJXVnEHFHjrCBulltfySELRhf7frsSjj02X 6TVP4kine+rmQD7QQfNR3YQNz2hR4h8ooJ/9Jt7mQaRbzf9POkg8jqnR2EvEbeH5RD2VVe qzNgiiui8LLZhqQkkkFomu5JrcV/A+iBCm+TgHqLEj3fPYmpPwBnWRdNo4EGRNg/U9UV4G wZ1UZyiXP0x6WPsPSvDK8zCzmXuGy6cxAXczuOM43v2NexRJUWH8hqQlE3nU72bDYc+phV X9H9IwLqyTgt2bNfsu8ORzuO5mRLSUkBzCG9N3CvNbxrMorI/JvuTY9rK+667A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679243608; a=rsa-sha256; cv=none; b=fM81KTbTGiberWBPxg+iekaAja5/r+oQgJzAFgyeK9dDJXU28OZswZUfF3e2J30886zgi3 LUZlhHFlnINlKXvmjl4SawQd1YX5ObPBQD5hytWOuWN2bnuR98KDvniqwJ0zeUqpe3EhNu fCTH2pusM8OX+SBDO+mhEzxiJ3rCrpujWZ+v8ucye96ZnXAPATpRU9LNLBGyRUziYgcgUn UtC8LxS2BNEfaGAkyS9Ims07uXCkcvbsMt9JZDvghxN+NheBUm45wy+larALAqge8ZpiJQ 0gRg6mJBbDFdEQhOoHAnyKPST94zGn6oe5QYTHxBp43UQs+8XRO0IWQQH/C0bw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pfk2J1gDlzw8F; Sun, 19 Mar 2023 16:33: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 32JGXSTw003208; Sun, 19 Mar 2023 16:33:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32JGXSEU003207; Sun, 19 Mar 2023 16:33:28 GMT (envelope-from git) Date: Sun, 19 Mar 2023 16:33:28 GMT Message-Id: <202303191633.32JGXSEU003207@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: 076b718d9e25 - main - ping tests: Add tests for IP header options List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 076b718d9e259a214abeb4b4f7289680b1a62ddf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=076b718d9e259a214abeb4b4f7289680b1a62ddf commit 076b718d9e259a214abeb4b4f7289680b1a62ddf Author: Jose Luis Duran AuthorDate: 2023-02-09 16:41:02 +0000 Commit: Mark Johnston CommitDate: 2023-03-19 16:23:44 +0000 ping tests: Add tests for IP header options The function pr_pack() prints out a packet, if the IP packet contains options, these are printed as well. Test the functionality fixed in 70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38470 --- sbin/ping/tests/test_ping.py | 243 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 242 insertions(+), 1 deletion(-) diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py index 639973d093d4..7040faa71a5d 100644 --- a/sbin/ping/tests/test_ping.py +++ b/sbin/ping/tests/test_ping.py @@ -780,6 +780,248 @@ round-trip min/avg/max/stddev = /// ms }, id="_0_0", ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "EOL", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +wrong total length 88 instead of 84 + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_EOL", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "LSRR", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +LSRR: 192.0.2.10 + 192.0.2.20 + 192.0.2.30 + 192.0.2.40 + 192.0.2.50 + 192.0.2.60 + 192.0.2.70 + 192.0.2.80 + 192.0.2.90 + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_LSRR", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "LSRR-trunc", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +LSRR: (truncated route) + + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_LSRR_trunc", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "SSRR", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +SSRR: 192.0.2.10 + 192.0.2.20 + 192.0.2.30 + 192.0.2.40 + 192.0.2.50 + 192.0.2.60 + 192.0.2.70 + 192.0.2.80 + 192.0.2.90 + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_SSRR", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "SSRR-trunc", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +SSRR: (truncated route) + + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_SSRR_trunc", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "RR", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +RR: 192.0.2.10 + 192.0.2.20 + 192.0.2.30 + 192.0.2.40 + 192.0.2.50 + 192.0.2.60 + 192.0.2.70 + 192.0.2.80 + 192.0.2.90 + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_RR", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "RR-same", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms (same route) + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_RR_same", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "RR-trunc", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +RR: (truncated route) + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_RR_trunc", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "opts": "NOP", + }, + { + "returncode": 0, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms +wrong total length 88 instead of 84 +NOP + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": "", + "redacted": True, + }, + id="_0_0_opts_NOP", + ), pytest.param( { "src": "192.0.2.1", @@ -867,7 +1109,6 @@ round-trip min/avg/max/stddev = /// ms "stderr": "", "redacted": True, }, - marks=pytest.mark.skip("XXX currently failing"), id="_0_0_opts_unk", ), pytest.param( From nobody Sun Mar 19 16:33:29 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pfk2K4Gy6z40P8j; Sun, 19 Mar 2023 16:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pfk2K3P8Lz4Tbp; Sun, 19 Mar 2023 16:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HNuPepCpaGnBRxs3JPevR2aq0TqVOMZQLVz8Um1vB64=; b=V3iB2X7ZKV12wkzWPuHehfF6XJYFQHnmQFlvvKQggV73dojVLH/a0ehWwiFsmyl4luGcMZ XN7qpu0GimUdr9s+47xZBQDt3Gn936R6R3az+CB8kGdS9QIPMzN6NI85GFBOQfnuO5q8T+ 81XrSYMIRk7qltXymRgEJGcPWE+xp8HMMBEAlLLS86aLmwmzTEqWSU2D1r7/pG5YRzCLqy 7H2fWmrxa8iwYuMGYyH6wwUGROT5uBdWHu2vHv7N8mhcQTEX6lEEiqj3KHRnIWZ2BWoGJI lFM0aF3fb4AqSGF6ulqfucjrM7VWxL6+YghVF4pucC8V9jqfhlKOr1EEL3RQpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679243609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HNuPepCpaGnBRxs3JPevR2aq0TqVOMZQLVz8Um1vB64=; b=ZdEI7uXk95QzbWURpuBLyTmnQM0EDdgz+2QvgMt7MnT5kDt2ssaIWvlgYp81LHytAoi3GE OUNuwAybtXsGEAxTYBpKWMRMkRa5NYq4S2TAGeyz5aaxfBOfDLLRWk0V7THwz00xYPsH1x 5/AWXLlFCZmwmG6M9k9e7krSPo+BmyWbrWKg68DefXLHeZ8mFQS6RkrwShoAT8OZP/a8wz RTUyQwurI9o4qi0DjS5lZVd/0HRayUFTtLUY+Xu0aE88Yn2JsKfALAdTr5qSV4dKUXBk/i YR75xyv3y1sdEjx2V4XAqjuy8RGy8zPCJiqR+CCEbRcGSEjTStuzc8dczz4CzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679243609; a=rsa-sha256; cv=none; b=hy/JiNJsuj7SF1cwiYLQv8LBqYkvGaPyFVSM11/tUzFmHPtpgF++WYSN3F1Fd2TyMXs1RV /KD6Q14IeCkRA68+2pKutmx6PkMPq/JqT7A3bxgMo3UOt0bq215M1djpW1s0HuRPQgvQCJ Yu3PS4wTqBaqayWFoO+Wm7c9Beh7p5Ev4dWDSFiJQVk9mzI1HnQWAuZaNpaDTh7lTDjC9k iFZDCHxpRw955Kw1vH22+49DaZ0Ti16+4zS7rtrgPQ8hVs849kXuNOhhroK2cS6N1iMyFC 4eGfuX6GJ9Yj+MOyfyvc2TSOE1LIZ8c73jGMUWd0QixhArcrtzj7krJwaQiHEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pfk2K2SsqzwPp; Sun, 19 Mar 2023 16:33: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 32JGXT3v003232; Sun, 19 Mar 2023 16:33:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32JGXT2e003231; Sun, 19 Mar 2023 16:33:29 GMT (envelope-from git) Date: Sun, 19 Mar 2023 16:33:29 GMT Message-Id: <202303191633.32JGXT2e003231@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: ea6d16926666 - main - ping: Avoid reporting negative time statistics List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea6d16926666a717e2c0a898b954d1477ac34804 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ea6d16926666a717e2c0a898b954d1477ac34804 commit ea6d16926666a717e2c0a898b954d1477ac34804 Author: Jose Luis Duran AuthorDate: 2023-02-09 23:38:54 +0000 Commit: Mark Johnston CommitDate: 2023-03-19 16:24:06 +0000 ping: Avoid reporting negative time statistics Display a warning when the time goes back. PR: 192417 Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38480 --- sbin/ping/ping.c | 8 +++++++- sbin/ping/tests/test_ping.py | 30 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 299b582e29c1..6b82fe3da9de 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1212,8 +1212,14 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) tv1.tv_sec = ntohl(tv32.tv32_sec); tv1.tv_nsec = ntohl(tv32.tv32_nsec); timespecsub(tv, &tv1, tv); - triptime = ((double)tv->tv_sec) * 1000.0 + + triptime = ((double)tv->tv_sec) * 1000.0 + ((double)tv->tv_nsec) / 1000000.0; + if (triptime < 0) { + warnx("time of day goes back (%.3f ms)," + " clamping time to 0", + triptime); + triptime = 0; + } tsum += triptime; tsumsq += triptime * triptime; if (triptime < tmin) diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py index 7040faa71a5d..f1c961c5b551 100644 --- a/sbin/ping/tests/test_ping.py +++ b/sbin/ping/tests/test_ping.py @@ -268,6 +268,7 @@ def redact(output): ("hlim=[0-9]*", "hlim="), ("ttl=[0-9]*", "ttl="), ("time=[0-9.-]*", "time="), + ("\(-[0-9\.]+[0-9]+ ms\)", "(- ms)"), ("[0-9\.]+/[0-9.]+", "/"), ] for pattern, repl in pattern_replacements: @@ -1209,6 +1210,32 @@ ping: quoted data too short (28 bytes) from 192.0.2.2 }, id="_3_1_special_udp", ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 0, + "icmp_code": 0, + "special": "warp", + }, + { + "returncode": 0, + "stdout": """\ +PATTERN: 0x01 +PING 192.0.2.2 (192.0.2.2): 56 data bytes +64 bytes from: icmp_seq=0 ttl= time= ms + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms +""", + "stderr": """\ +ping: time of day goes back (- ms), clamping time to 0 +""", + "redacted": True, + }, + id="_0_0_special_warp", + ), ] @pytest.mark.parametrize("pinger_kargs, expected", pinger_testdata) @@ -1221,6 +1248,7 @@ ping: quoted data too short (28 bytes) from 192.0.2.2 assert ping.returncode == expected["returncode"] if expected["redacted"]: assert redact(ping.stdout) == expected["stdout"] + assert redact(ping.stderr) == expected["stderr"] else: assert ping.stdout == expected["stdout"] - assert ping.stderr == expected["stderr"] + assert ping.stderr == expected["stderr"] From nobody Mon Mar 20 02:31:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PfzJ866FCz402qV; Mon, 20 Mar 2023 02:31: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 4PfzJ85wptz3Dhd; Mon, 20 Mar 2023 02:31:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679279480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Eiy8pMB94TpyiNrr2hTVMbSVMZpI8sou5kw0fS838Mc=; b=kdPxZJel5aSavsLfppNZPE1YC8c+7J0kSZPxr8Izq8wjQTsh3YyxjA4pgVeYQ7OUxChlc4 vZ7ow/n78N4M6iInB6jZQjFw0PiA4NlmFbl8DtEKNm1UmNylkOEdj2/kEHfcIOtvT1KQKc skQS07IgwI9T9PJH8TxD9lsmB7hijvZ2GT0Kt2GbTZX6nmnEBdmFRr92TTvlPq6o2dcEKl d4XzI2nL+C4wUECVOrK2+GNNsHPkjyTmrW82O45Op6otT+8OpsMi3o6jIGY6WKZfbMuBrL 3Tvvkk72gdcZALEhSC1WN5WZdHE1Qd+/nj7RvLc3MVvpbEuwvJ8P4RIuEkik1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679279480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Eiy8pMB94TpyiNrr2hTVMbSVMZpI8sou5kw0fS838Mc=; b=ghs/oeR0J/LOpnX5QdtkOzkqgeOzKgWQK51uhPKW2QMOPVvRV0zhrb/jKt1pCdR6YlVMrr 8bEV5sBNhxCb4BrSzu+gKGYcVbENhfNG1WsMq43zEz1BVw5ZfJlAjr8V9apK7YZo3hSNVU fy2kdb6umTkqlffRBSYdZ6z7i4lrYSuZBze4eE5NjztfUbC/gXerrZ0NRr49UBdln4BbdU rBs2RIBBr6yePWdqZ6wYG2W/njle9s+gMghwSmWhUhzuQI5Hxxwe8KPNZDra8+lCAMlDKT WBG2cI9TNm9+xda7d3qDauLShAcpl+SyoAVTROwl+fYJSDU2v4J7mVctXJszyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679279480; a=rsa-sha256; cv=none; b=BIMiGpF/WiGqCiOpdjbY6sCojz4s6/R7FcO/jM3bUMQmp6+LCCzOl2xHfTCvUuZIckB9fm prLbA3EoYSzAwWOjT0D19frkBbYu+oEcwPg0C25eKiBl4ZNN3L8bPkSBsJlkpFSkJyB4sg GVWTy2wLoARvPx3sTkotvKN/nxNAFjZPQ44SDiPm5FhlhXoOAwm3EY1BgAWGKYRmV2Zq7h lOwBRwbm/KP/mIGlWR0Zl53OBwFF3E3d0qLNKxU6uAGthZJL4qGQDNu4nUebpXKecHwfCu iokhEOBGy8GVwW+j3DV0I+7YRrk0TGd+0XHbaa1vrEnArfgy5uzILuryCJ93ww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PfzJ84zmHz1CJY; Mon, 20 Mar 2023 02:31: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 32K2VKxW085958; Mon, 20 Mar 2023 02:31:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32K2VIT8085951; Mon, 20 Mar 2023 02:31:18 GMT (envelope-from git) Date: Mon, 20 Mar 2023 02:31:18 GMT Message-Id: <202303200231.32K2VIT8085951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: c917796c0416 - main - MFV: xz 5.4.2. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c917796c041664a04153af24c2e68cc963fe52bc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=c917796c041664a04153af24c2e68cc963fe52bc commit c917796c041664a04153af24c2e68cc963fe52bc Merge: ea6d16926666 88417d17c297 Author: Xin LI AuthorDate: 2023-03-20 02:30:08 +0000 Commit: Xin LI CommitDate: 2023-03-20 02:30:08 +0000 MFV: xz 5.4.2. MFC after: 2 weeks contrib/xz/COPYING | 11 + contrib/xz/ChangeLog | 1265 ++++++++++ contrib/xz/README | 8 +- contrib/xz/THANKS | 2 + contrib/xz/doxygen/Doxyfile | 2684 +++++++++++++++++++++ contrib/xz/doxygen/update-doxygen | 111 + contrib/xz/src/common/mythread.h | 4 +- contrib/xz/src/common/tuklib_mbstr_fw.c | 2 +- contrib/xz/src/common/tuklib_physmem.c | 18 + contrib/xz/src/liblzma/api/lzma.h | 9 +- contrib/xz/src/liblzma/api/lzma/base.h | 52 +- contrib/xz/src/liblzma/api/lzma/bcj.h | 48 +- contrib/xz/src/liblzma/api/lzma/block.h | 177 +- contrib/xz/src/liblzma/api/lzma/check.h | 44 +- contrib/xz/src/liblzma/api/lzma/container.h | 217 +- contrib/xz/src/liblzma/api/lzma/delta.h | 23 +- contrib/xz/src/liblzma/api/lzma/filter.h | 256 +- contrib/xz/src/liblzma/api/lzma/hardware.h | 3 +- contrib/xz/src/liblzma/api/lzma/index.h | 220 +- contrib/xz/src/liblzma/api/lzma/index_hash.h | 39 +- contrib/xz/src/liblzma/api/lzma/lzma12.h | 64 +- contrib/xz/src/liblzma/api/lzma/stream_flags.h | 109 +- contrib/xz/src/liblzma/api/lzma/version.h | 34 +- contrib/xz/src/liblzma/api/lzma/vli.h | 18 +- contrib/xz/src/liblzma/check/check.h | 4 - contrib/xz/src/liblzma/check/crc64_fast.c | 2 +- contrib/xz/src/liblzma/common/block_decoder.c | 5 +- contrib/xz/src/liblzma/common/block_encoder.c | 7 +- contrib/xz/src/liblzma/common/common.c | 20 +- contrib/xz/src/liblzma/common/index_decoder.c | 13 +- contrib/xz/src/liblzma/common/index_encoder.c | 11 +- contrib/xz/src/liblzma/common/index_hash.c | 13 +- contrib/xz/src/liblzma/common/lzip_decoder.c | 6 +- contrib/xz/src/liblzma/common/stream_decoder_mt.c | 8 +- contrib/xz/src/liblzma/common/stream_encoder_mt.c | 2 +- contrib/xz/src/liblzma/common/string_conversion.c | 11 +- contrib/xz/src/liblzma/delta/delta_decoder.c | 7 +- contrib/xz/src/liblzma/delta/delta_encoder.c | 12 +- contrib/xz/src/liblzma/lz/lz_encoder_mf.c | 11 +- contrib/xz/src/liblzma/simple/simple_coder.c | 6 +- contrib/xz/src/xz/args.c | 11 +- contrib/xz/src/xz/coder.h | 3 +- contrib/xz/src/xz/file_io.c | 34 +- contrib/xz/src/xz/list.c | 4 +- contrib/xz/src/xz/options.c | 4 +- contrib/xz/src/xz/suffix.c | 26 +- contrib/xz/src/xz/suffix.h | 8 + contrib/xz/src/xz/xz.1 | 2 +- lib/liblzma/config.h | 6 +- 49 files changed, 5178 insertions(+), 476 deletions(-) diff --cc contrib/xz/doxygen/Doxyfile index 000000000000,20afb528e4f4..20afb528e4f4 mode 000000,100644..100644 --- a/contrib/xz/doxygen/Doxyfile +++ b/contrib/xz/doxygen/Doxyfile diff --cc contrib/xz/doxygen/update-doxygen index 000000000000,a5103199a8d1..a5103199a8d1 mode 000000,100755..100755 --- a/contrib/xz/doxygen/update-doxygen +++ b/contrib/xz/doxygen/update-doxygen diff --cc lib/liblzma/config.h index ed6515f56f6e,000000000000..cd5576aed027 mode 100644,000000..100644 --- a/lib/liblzma/config.h +++ b/lib/liblzma/config.h @@@ -1,618 -1,0 +1,618 @@@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* How many MiB of RAM to assume if the real amount cannot be determined. */ +#define ASSUME_RAM 128 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* FreeBSD - disabled intentionally */ +/* #undef ENABLE_NLS */ + +/* Define to 1 if bswap_16 is available. */ +/* #undef HAVE_BSWAP_16 */ + +/* Define to 1 if bswap_32 is available. */ +/* #undef HAVE_BSWAP_32 */ + +/* Define to 1 if bswap_64 is available. */ +/* #undef HAVE_BSWAP_64 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +#ifndef WITHOUT_CAPSICUM +/* Define to 1 if Capsicum is available. */ +#define HAVE_CAPSICUM 1 +#endif + +/* Define to 1 if the system has the type `CC_SHA256_CTX'. */ +/* #undef HAVE_CC_SHA256_CTX */ + +/* Define to 1 if you have the `CC_SHA256_Init' function. */ +/* #undef HAVE_CC_SHA256_INIT */ + +/* 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 */ + +/* Define to 1 if crc32 integrity check is enabled. */ +#define HAVE_CHECK_CRC32 1 + +/* Define to 1 if crc64 integrity check is enabled. */ +#define HAVE_CHECK_CRC64 1 + +/* Define to 1 if sha256 integrity check is enabled. */ +#define HAVE_CHECK_SHA256 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if `CLOCK_MONOTONIC' is declared in . */ +#define HAVE_CLOCK_MONOTONIC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CPUID_H 1 + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* FreeBSD - disabled intentionally */ +/* #undef HAVE_DCGETTEXT */ + +/* Define to 1 if any of HAVE_DECODER_foo have been defined. */ +#define HAVE_DECODERS 1 + +/* Define to 1 if arm decoder is enabled. */ +#define HAVE_DECODER_ARM 1 + +/* Define to 1 if arm64 decoder is enabled. */ +#define HAVE_DECODER_ARM64 1 + +/* Define to 1 if armthumb decoder is enabled. */ +#define HAVE_DECODER_ARMTHUMB 1 + +/* Define to 1 if delta decoder is enabled. */ +#define HAVE_DECODER_DELTA 1 + +/* Define to 1 if ia64 decoder is enabled. */ +#define HAVE_DECODER_IA64 1 + +/* Define to 1 if lzma1 decoder is enabled. */ +#define HAVE_DECODER_LZMA1 1 + +/* Define to 1 if lzma2 decoder is enabled. */ +#define HAVE_DECODER_LZMA2 1 + +/* Define to 1 if powerpc decoder is enabled. */ +#define HAVE_DECODER_POWERPC 1 + +/* Define to 1 if sparc decoder is enabled. */ +#define HAVE_DECODER_SPARC 1 + +/* Define to 1 if x86 decoder is enabled. */ +#define HAVE_DECODER_X86 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if any of HAVE_ENCODER_foo have been defined. */ +#define HAVE_ENCODERS 1 + +/* Define to 1 if arm encoder is enabled. */ +#define HAVE_ENCODER_ARM 1 + +/* Define to 1 if arm64 encoder is enabled. */ +#define HAVE_ENCODER_ARM64 1 + +/* Define to 1 if armthumb encoder is enabled. */ +#define HAVE_ENCODER_ARMTHUMB 1 + +/* Define to 1 if delta encoder is enabled. */ +#define HAVE_ENCODER_DELTA 1 + +/* Define to 1 if ia64 encoder is enabled. */ +#define HAVE_ENCODER_IA64 1 + +/* Define to 1 if lzma1 encoder is enabled. */ +#define HAVE_ENCODER_LZMA1 1 + +/* Define to 1 if lzma2 encoder is enabled. */ +#define HAVE_ENCODER_LZMA2 1 + +/* Define to 1 if powerpc encoder is enabled. */ +#define HAVE_ENCODER_POWERPC 1 + +/* Define to 1 if sparc encoder is enabled. */ +#define HAVE_ENCODER_SPARC 1 + +/* Define to 1 if x86 encoder is enabled. */ +#define HAVE_ENCODER_X86 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if __attribute__((__constructor__)) is supported for functions. + */ +#define HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1 + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +/* #undef HAVE_FUTIMES */ + +/* Define to 1 if you have the `futimesat' function. */ +/* #undef HAVE_FUTIMESAT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* FreeBSD - disabled intentionally */ +/* #undef HAVE_GETTEXT */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +/* FreeBSD - only with clang because the base gcc does not support it */ +#if defined(__clang__) && defined(__FreeBSD__) && defined(__amd64__) +#define HAVE_IMMINTRIN_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if .lz (lzip) decompression support is enabled. */ +#define HAVE_LZIP_DECODER 1 + +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 to enable bt2 match finder. */ +#define HAVE_MF_BT2 1 + +/* Define to 1 to enable bt3 match finder. */ +#define HAVE_MF_BT3 1 + +/* Define to 1 to enable bt4 match finder. */ +#define HAVE_MF_BT4 1 + +/* Define to 1 to enable hc3 match finder. */ +#define HAVE_MF_HC3 1 + +/* Define to 1 to enable hc4 match finder. */ +#define HAVE_MF_HC4 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MINIX_CONFIG_H */ + +/* Define to 1 if getopt.h declares extern int optreset. */ +#define HAVE_OPTRESET 1 + +/* Define to 1 if you have the `pledge' function. */ +/* #undef HAVE_PLEDGE */ + +/* Define to 1 if you have the `posix_fadvise' function. */ +#define HAVE_POSIX_FADVISE 1 + +/* Define to 1 if `program_invocation_name' is declared in . */ +/* #undef HAVE_PROGRAM_INVOCATION_NAME */ + +/* Define to 1 if you have the `pthread_condattr_setclock' function. */ +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 + +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + +/* Define to 1 if you have the `SHA256Init' function. */ +/* #undef HAVE_SHA256INIT */ + +/* Define to 1 if the system has the type `SHA256_CTX'. */ +#define HAVE_SHA256_CTX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SHA256_H 1 + +/* Define to 1 if you have the `SHA256_Init' function. */ +#define HAVE_SHA256_INIT 1 + +/* Define to 1 if the system has the type `SHA2_CTX'. */ +/* #undef HAVE_SHA2_CTX */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA2_H */ + +/* Define to 1 if optimizing for size. */ +/* #undef HAVE_SMALL */ + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* 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_STDIO_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 `st_atimensec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1 + +/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1 + +/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */ + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 + +/* Define to 1 if `st_uatime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_UATIME */ + +/* Define to 1 to if GNU/Linux-specific details are unconditionally wanted for + symbol versioning. Define to 2 to if these are wanted only if also PIC is + defined (allows building both shared and static liblzma at the same time + with Libtool if neither --with-pic nor --without-pic is used). This define + must be used together with liblzma_linux.map. */ +/* #undef HAVE_SYMBOL_VERSIONS_LINUX */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + +#ifndef WITHOUT_CAPSICUM +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_CAPSICUM_H 1 +#endif + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if _mm_set_epi64x and _mm_clmulepi64_si128 are usable. See + configure.ac for details. */ +#if defined(__FreeBSD__) && defined(__amd64__) +#define HAVE_USABLE_CLMUL 1 +#endif + +/* Define to 1 if you have the `utime' function. */ +/* #undef HAVE_UTIME */ + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcwidth' function. */ +#define HAVE_WCWIDTH 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to 1 if you have the `_futime' function. */ +/* #undef HAVE__FUTIME */ + +/* Define to 1 if _mm_movemask_epi8 is available. */ +#if defined(__FreeBSD__) && defined(__amd64__) +#define HAVE__MM_MOVEMASK_EPI8 1 +#endif + +/* Define to 1 if the GNU C extension __builtin_assume_aligned is supported. + */ +#define HAVE___BUILTIN_ASSUME_ALIGNED 1 + +/* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported. + */ +#define HAVE___BUILTIN_BSWAPXX 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 when using POSIX threads (pthreads). */ +#define MYTHREAD_POSIX 1 + +/* Define to 1 when using Windows Vista compatible threads. This uses features + that are not available on Windows XP. */ +/* #undef MYTHREAD_VISTA */ + +/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This + avoids use of features that were added in Windows Vista. */ +/* #undef MYTHREAD_WIN95 */ + +/* Define to 1 to disable debugging code. */ +#define NDEBUG 1 + +/* Name of package */ +#define PACKAGE "xz" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "xz@tukaani.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "XZ Utils" + +/* Define to the full name and version of this package. */ - #define PACKAGE_STRING "XZ Utils 5.4.1" ++#define PACKAGE_STRING "XZ Utils 5.4.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xz" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://tukaani.org/xz/" + +/* Define to the version of this package. */ - #define PACKAGE_VERSION "5.4.1" ++#define PACKAGE_VERSION "5.4.2" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Define to 1 if the number of available CPU cores can be detected with + cpuset(2). */ +#define TUKLIB_CPUCORES_CPUSET 1 + +/* Define to 1 if the number of available CPU cores can be detected with + pstat_getdynamic(). */ +/* #undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC */ + +/* Define to 1 if the number of available CPU cores can be detected with + sched_getaffinity() */ +/* #undef TUKLIB_CPUCORES_SCHED_GETAFFINITY */ + +/* Define to 1 if the number of available CPU cores can be detected with + sysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */ +/* #undef TUKLIB_CPUCORES_SYSCONF */ + +/* Define to 1 if the number of available CPU cores can be detected with + sysctl(). */ +/* #undef TUKLIB_CPUCORES_SYSCTL */ + +/* Define to 1 if the system supports fast unaligned access to 16-bit, 32-bit, + and 64-bit integers. */ +/* FreeBSD - derive from __NO_STRICT_ALIGNMENT */ +/* #undef TUKLIB_FAST_UNALIGNED_ACCESS */ + +/* Define to 1 if the amount of physical memory can be detected with + _system_configuration.physmem. */ +/* #undef TUKLIB_PHYSMEM_AIX */ + +/* Define to 1 if the amount of physical memory can be detected with + getinvent_r(). */ +/* #undef TUKLIB_PHYSMEM_GETINVENT_R */ + +/* Define to 1 if the amount of physical memory can be detected with + getsysinfo(). */ +/* #undef TUKLIB_PHYSMEM_GETSYSINFO */ + +/* Define to 1 if the amount of physical memory can be detected with + pstat_getstatic(). */ +/* #undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC */ + +/* Define to 1 if the amount of physical memory can be detected with + sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */ +#define TUKLIB_PHYSMEM_SYSCONF 1 + +/* Define to 1 if the amount of physical memory can be detected with sysctl(). + */ +/* #undef TUKLIB_PHYSMEM_SYSCTL */ + +/* Define to 1 if the amount of physical memory can be detected with Linux + sysinfo(). */ +/* #undef TUKLIB_PHYSMEM_SYSINFO */ + +/* Define to 1 to use unsafe type punning, e.g. char *x = ...; *(int *)x = + 123; which violates strict aliasing rules and thus is undefined behavior + and might result in broken code. */ +/* #undef TUKLIB_USE_UNSAFE_TYPE_PUNNING */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# define _HPUX_ALT_XOPEN_SOCKET_API 1 +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +/* # undef _MINIX */ +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# define _NETBSD_SOURCE 1 +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# define _OPENBSD_SOURCE 1 +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +/* # undef _POSIX_SOURCE */ +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +/* # undef _POSIX_1_SOURCE */ +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +/* # undef _XOPEN_SOURCE */ +#endif + + +/* Version number of package */ - #define VERSION "5.4.1" ++#define VERSION "5.4.2" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined(__FreeBSD__) +#include +#if defined(__NO_STRICT_ALIGNMENT) +#define TUKLIB_FAST_UNALIGNED_ACCESS 1 +#endif +#include +#if _BYTE_ORDER == _BIG_ENDIAN +# define WORDS_BIGENDIAN 1 +#endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +/* #undef __GETOPT_PREFIX */ + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +/* #undef uintptr_t */ From nobody Mon Mar 20 04:05:01 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pg1NF3ZGQz408Dx; Mon, 20 Mar 2023 04:05: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 4Pg1NF34Yjz3MCm; Mon, 20 Mar 2023 04:05:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679285101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iPxvAMvLLiSFbCRyhifAeX8daZc9tB6Fk8rTS9qHrqQ=; b=JQCO51WJ3l82c2d6BcKGpPTofMw/guiDfvhnr0e6I907q+kuzTJxK+hOo3NLUkNa4v91QO qx80v1HLqLEnCM3r+YDInQIwDgvL8xxUbYinpLqzJ2nRZH5+67VL+Y2stxjr8FhlKCS103 ERwEYVDYeEcBxb4ZlFaBqipHP7+8ieYJwg1gH4S9Q4/bttVjMpw5xuXPBpb1lAqXkdM4SY 1yw7GMuZa4e5T+Fh3auIEZPop1rjQnkWnXKU7wy27nJ1gkU5f0C3SRK3sN/RiGzxGT2I/5 l6BZojcVj8EtA3I/ZkjneJsC62yDn87OGIk8b1H6E6boQfXBS3hLU0M2t1rxHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679285101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iPxvAMvLLiSFbCRyhifAeX8daZc9tB6Fk8rTS9qHrqQ=; b=AJd0pHuwGCMuuMC+JzM8w7/7uGBB+UZkOdBVBaajDvCU+7l82zDCQ3YdwQTwbzx82nwf44 297CK4kVcfXtauPcoW7Kdv3Aep7KxRi1jeGIHxdkaD85B+LRcrEEucw4Jok6i7PyC6/zon r1P0428zBOuSmQ4alGuuADx+g50jtD8+cpsIVEeZ0fEAoa6o2nQhl+lPIZgwD4P+VfYRla iS6Px7MJDPbR9kujK3VN+Zk7h7Nm3E4gr+M8UJ8t9GcECTAPRbnBws50Yt3GufeebFsmrl EkY06FWpbr2lF+ZWdSDmKzKcOTg/73NgmRnw5u6mXBICIsCV6XKsCGa+Bxj9yQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679285101; a=rsa-sha256; cv=none; b=Yg3kNi9OJilxLu31J5fMFeyzGoVhi2vFrWZq0Fhl0n9/Fp9RysjJ3elaqQGQt1LsGL4tXY 5d0K8zaesc0tvGcwQBK5xx8TnaVyr5tPAviyIzhW61+shsYXy78I3KXnf2qwAlOBQlq4lA aBzMfDzTt55uhU82TdwVlwiD9EeWq5qt2/IY2MGePfLgyOrqrVGQ5ArrXgMQzSV4syL5c8 iINMw3AGj0937t2cApKW42sWvIdTUoeUFmirZn3bYI/lEdmWkPfoOPxjP0Z6ByoHkAr7lI iop5dfevtFDxakgdPmKcMMOPOX4K+VbaL2c3Go3lNoUclDAyJOt7F0bQF/rj2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pg1NF279JzG7X; Mon, 20 Mar 2023 04:05: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 32K451hX038765; Mon, 20 Mar 2023 04:05:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32K451de038764; Mon, 20 Mar 2023 04:05:01 GMT (envelope-from git) Date: Mon, 20 Mar 2023 04:05:01 GMT Message-Id: <202303200405.32K451de038764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 082895ebecb5 - main - xhci(4): Describe Fresco Logic FL1009 USB 3.0 controller List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 082895ebecb55f342dec918c555309c11e3fe17f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=082895ebecb55f342dec918c555309c11e3fe17f commit 082895ebecb55f342dec918c555309c11e3fe17f Author: Zhenlei Huang AuthorDate: 2023-03-20 04:00:59 +0000 Commit: Zhenlei Huang CommitDate: 2023-03-20 04:04:14 +0000 xhci(4): Describe Fresco Logic FL1009 USB 3.0 controller Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38922 --- sys/dev/usb/controller/xhci_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 5da68a156724..2fdc013e01c2 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -126,6 +126,8 @@ xhci_pci_match(device_t self) case 0x10001b73: return ("Fresco Logic FL1000G USB 3.0 controller"); + case 0x10091b73: + return ("Fresco Logic FL1009 USB 3.0 controller"); case 0x11001b73: return ("Fresco Logic FL1100 USB 3.0 controller"); From nobody Mon Mar 20 06:22:08 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pg4QY0PZYz40HBn; Mon, 20 Mar 2023 06:22:13 +0000 (UTC) (envelope-from rpokala@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 4Pg4QX6ycnz3vvp; Mon, 20 Mar 2023 06:22:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679293333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=adN/IFq1sTNLpK5SwNH2Kqf4XjJu0fxeyJUF4N2l/2I=; b=F0jdBtilHCF4CfV3Y+au45VNoouOL9B60zVdv4BGo8KTbtC+N1+yDgjs7eV+uURtwyfMz6 q2djUNED9RE4Vc09Hb39u/4of6sChJd/V/NWdr5b55Ywrwvm2sq+cJyiY/yQCSNWc9G5Lm Ky1R8x7POHdd9VwqLXQ9LAKRrp7/J0QHyD0pju90ALugZSkklw9P4wWyMsxcmBVtGKY6qQ g7nxsR6Kt8nQs7cj7Dt/dQuVfmeWGr04fq2V65JLQwmlN4GnktxNJ9mk9Vd8m5o5aJ1oxW H4XU6eGNJyfYR5gHC+nCm8ottQ0Gxcd/3sEGFZ9MTHQyZcMDM41w6B4dBOuLOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679293333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=adN/IFq1sTNLpK5SwNH2Kqf4XjJu0fxeyJUF4N2l/2I=; b=DRo1rbHN4UYl8PnMzCXN5EodNYbJY1gwMzRLMaEYgRujKK+B8VldLH8BuA4RQzNcA/8qw7 nNFtJozsbaTyjioWYQoLWqwWuiKsbIz48kJ18v992kQk85bYWJ7kTrx6u2bcn/cExFlfGP ez64lrf3yLhD3o2GWPRV4Dq2T31SFt4YRRymd0/MOrW7U28eFJQXSHW3Dh+16SaoOf6jLz NOUdTUq5B2vQAExDCl2AIOd+XOpfY3/A64ILBKo3sU9ZKh89HMOfb0WIK5imhjJUW9B7S1 6CM1856wRXI3iFwFuBzBM/4DwqVfS1VQabewQkKjZMM2uy6BDPpvUEoMJacb/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679293333; a=rsa-sha256; cv=none; b=W9SpyRHah/PaUdKyD/U0XbHWAutDgSN7J+LxtjSWblHS+ePauAw1DfEQfbGFRjv2PzXIpn PM+rH9BfG5sKpTSUvX6+UbZnLVq2Rtz/XUHKauQf91cw8nJQXwC7j8nkHTXQ5BvnNy5V+c q0Gn/dzRFWBHk9DJOpeGGqdDdz5uPLdQoh5LhLoanozL7r6N3x1nI7Qdc2mcTT8P0KiArS dHLaeLEgv7cCdk6L8IJ3tJAxQVpV+9jo62xyCkX3rqt71R8Xg6AbbVSZRfd6U4CkPUTDAq VoQ97vPHZNZe8Lh/K4zQw9Cyyw9D64KJofjzWVnZXu9kLOXxxqdKRCIuvAx/mg== Received: from [192.168.1.10] (unknown [IPv6:2601:641:700:5284:5c12:3669:f9bf:d3a6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Pg4QX2JvTz1Gsn; Mon, 20 Mar 2023 06:22:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.71.23031200 Date: Sun, 19 Mar 2023 23:22:08 -0700 Subject: Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 From: Ravi Pokala To: Andrew Turner , , , Message-ID: <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> Thread-Topic: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 References: <202303161646.32GGkArS022254@gitrepo.freebsd.org> In-Reply-To: <202303161646.32GGkArS022254@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N Hi Andrew, This breaks arm64.LINT-FDT: | >>> stage 3.1: building everything | -------------------------------------------------------------- | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: e= rror: expected identifier | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: er= ror: type specifier missing, defaults to 'int'; ISO C99 and later do not sup= port implicit int [-Werror,-Wimplicit-int] | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | int | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: w= arning: a function declaration without a prototype is deprecated in all vers= ions of C [-Wstrict-prototypes] | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | 1 warning and 2 errors generated. | --- nexus.o --- | *** [nexus.o] Error code 1 |=20 | make[5]: stopped in /build/usr/home/rpokala/freebsd/src/clean-main/arm64.= aarch64/sys/LINT-FDT Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: > on behalf of Andrew Turner > Date: Thursday, March 16, 2023 at 09:46 To: >, >, > Subject: git: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm6= 4 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e0479= 1ba5ceaf13 commit f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 Author: Andrew Turner > AuthorDate: 2023-03-16 15:35:59 +0000 Commit: Andrew Turner > CommitDate: 2023-03-16 16:45:42 +0000 Allow forcing non-posted memory on arm64 To allow for debugging after changing the arm64 VM_MEMATTR_DEVICE memory type add a new set of tunables to tell the kernel to use non-posted memory. This adds the following tunables: - kern.force_nonposted: When set to non-zero the kernel will use non-posted memory for all device allocations. - hint...force_nonposted: As above, however only forces non-posted memory on the named device. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D38944 --- sys/arm64/arm64/nexus.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 3d6519f5fedd..0c06736f4e66 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -83,6 +83,10 @@ struct nexus_device { struct resource_list nx_resources; }; +static int force_np; +SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, + "Force all devices to use non-posted device memory"); + #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) static struct rman mem_rman; @@ -373,7 +377,7 @@ nexus_activate_resource_flags(device_t bus, device_t ch= ild, int type, int rid, { struct resource_map_request args; struct resource_map map; - int err; + int err, use_np; if ((err =3D rman_activate_resource(r)) !=3D 0) return (err); @@ -386,7 +390,13 @@ nexus_activate_resource_flags(device_t bus, device_t c= hild, int type, int rid, case SYS_RES_MEMORY: if ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) { resource_init_map_request(&args); - if ((flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0) + use_np =3D (flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0 || + force_np; + if (!use_np) + resource_int_value(device_get_name(child), + device_get_unit(child), "force_nonposted", + &use_np); + if (use_np) args.memattr =3D VM_MEMATTR_DEVICE_NP; err =3D nexus_map_resource(bus, child, type, r, &args, &map); From nobody Mon Mar 20 08:44:38 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pg7Zv0g6jz40R8F; Mon, 20 Mar 2023 08:44: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 4Pg7Zv0756z4BqS; Mon, 20 Mar 2023 08:44:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679301879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v3mmmc0ku3gAXv+3kg6GgBgCHAaDJr6Y7Io5Cfhib48=; b=u0/ApXYbUbiJ6vi5Lr5+vME2eJD4NRFR0CUbFwxd7pplKjB9cvgEBDeot3Xgfg1OdjPpuZ BuAPnRMLK8CRgtmo8LoqH60BCCPzEw60EITl9ynCJjyTiWyXYk+xOoe5R0VDW+Md3xt3KT 07PlGCUS3dLsMcXM8PPzlh9/egtYyV2OxgliMuzTYDjLy9G4ozcdv08qQukYUpJ+VfwknU IOR2qph6Pa1kaURhyEw1D9E/09qZP+pM9ihimr31dMjSsdbw4Ub1ZoG29hHMIPh2+F9Cdq qmurMDPcZOYaEii8o7hw7tf4xyl6xVe/i3BevtEnQ+4lHz9AseWO7yUCVEZPzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679301879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v3mmmc0ku3gAXv+3kg6GgBgCHAaDJr6Y7Io5Cfhib48=; b=VqCfYCZ34gT4N+uZw55BdEwFri+BZtU2uNFdwOIUenlCPHDaeeM9OF5l+grxDIX9B464st aPbPQAkXQzu+v3cwnyk8V9MW9tL/SSSHZO/GN6rLeq2A/tmCykYUSkwbpXeDpR+TyXfsh0 06YFg4c/hDhodcojNYy6i/UePvCEusnUPBNZQ9cVNLhODEvqPEQJNaAt58k5iViufTrBYY ykWjhQkCIB89WPaOCbVivc7PzNd6fKJvXWp1CpT3hpwwO/4INa+rBnlbZgXJnn+XMmF2wp +gJ6rTzlhtDahkn+J/9qpfwXhxCiF5M9vGk+I/1Evhun8Wge9QMrz2g35F1pmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679301879; a=rsa-sha256; cv=none; b=HZ3oNxa0nFl0EbRArGcdq+f8LYEFpvhWl9jnZECpfuBSfz+ESmMrJIl2mMm46NpKl2YEVM RhgMYOjrLsNASW6KbYFYDmT64grgIPxIzLsEb9ZvqQxBJtNNBBmSrrJ0yFax/AXCGx4H2C neKynIxkAv9y5gVO3fpylGeg2phHfR/uq0pBnBCIkTREIml2A6x16U27pwV+hvBqev6EmC CYIUrqJKEWQaaEqqdjyF0xBhm1wEH/uCwqSgaezRafs5IzLJDkNN2miHpKCg7hxfuFLZHm 3Cc3gLCkbLjDU09UYDojvG1i/TAZjXvNGdV5MUak8UWlc6wxcPcMR5OF5MXNmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pg7Zt6GyBzP1x; Mon, 20 Mar 2023 08:44: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 32K8icuH096929; Mon, 20 Mar 2023 08:44:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32K8icL0096928; Mon, 20 Mar 2023 08:44:38 GMT (envelope-from git) Date: Mon, 20 Mar 2023 08:44:38 GMT Message-Id: <202303200844.32K8icL0096928@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: 62b572694b0a - main - ext2_dirbad(): fix !DTRACE build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62b572694b0ad2fc2442e84b49c8abcc3b71b67f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=62b572694b0ad2fc2442e84b49c8abcc3b71b67f commit 62b572694b0ad2fc2442e84b49c8abcc3b71b67f Author: Konstantin Belousov AuthorDate: 2023-03-20 08:42:51 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-20 08:44:22 +0000 ext2_dirbad(): fix !DTRACE build Fixes: 3c2dc524c333747a8c5deb3f0f88b29a8e36dff4 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks --- sys/fs/ext2fs/ext2_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 4859d51f8429..0de8c103b7f1 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -799,7 +799,7 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, void ext2_dirbad(struct inode *ip, doff_t offset, char *how) { - struct mount *mp; + struct mount *mp __sdt_used; mp = ITOV(ip)->v_mount; From nobody Mon Mar 20 10:18:02 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pg9ff2bqmz40WpG; Mon, 20 Mar 2023 10:18: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 4Pg9ff2Pgvz4L09; Mon, 20 Mar 2023 10:18:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679307482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nKaEm93BRQtdJ1+Uo5kFWe6EWlXiVJHBRkTSDyC7xmU=; b=gkw7SdbtJDvZ6PbcCi2UiTG/d7x/oeErizr2MhC2q/WL2sM8vlSGBNQgHgDgDIqkWbFKFo YaLCx8tQkMJz5YgOEIIQNr/k1tZyQDk6NqixSgjmJQ2KNi7jmKft72x0oORbIkaYpcs+XV lkfHkVzjU9lmIQVKa6U/AAc61nGGyGoaK4DnsEiyISD0JdqXo8XpU/D4hyc34UE9QJhrJL mj/VwhKIjR3v9xo+25bFYE+2nXhYLEVJ1mDYHSacmOJwPAjTdrNyrLVBcccViwN4uek1l/ E1IQxERP2E/UfFjeyzFLvIJnioIxc9UC5RVTbNpGH+TeVumnv8e9Rui121oUxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679307482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nKaEm93BRQtdJ1+Uo5kFWe6EWlXiVJHBRkTSDyC7xmU=; b=lVLgIHFeVADRzQ953h63LFrNrzHMYbJr0oG9qoKa+60zsO9PHV2vmnUy7dCalb7sBnvJGX gZ4oVUSxmYyykxrL8vaNSk9NvB/1eYLAhl7DFHPkTiSCHNMLCzWZbnMhBJDa6sDBps5i01 abKtiQaDCu3lyQuF4BNLGMW0YjcVqK6dc+t3iDYnr6fspytdXJqttnbyW7OGzGkgb2nUbD DCEMo/UpgGExW/PPHdT6BJz2OXfW1A+M+Lz2llzPj6JU05FpYT8pZudF0jGl2VgaDe/BdG roBhPUD/ULjTYpYhpumPI1SylYQpnJd3sp4fMIJKNcjb3UxNzvKxVkBpwK2mIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679307482; a=rsa-sha256; cv=none; b=SmZ3S/eHJeqg5/bnTpUEzCP6VNxf6x3c6zHgi1teU/UO4XUR9YPAvPca+zPb6kQWA5mpAA IQB4bZ8okqcVSBytLC5q00J1F3wK8+gkCUC9HVli3acbWFMiGCqPDd5Hqdw+UIeQfqzKkH W4fXCAfe9Dty2fEb04OVNsTwP3KkfxF6ixo6gCdpjBUMatr1rm/zf8jA58nQThCsodVYV+ Z7doDctsRiYc3DcaxM7SaXK4L7r2DD8nVK62xVhN993xwApyKrdmd1elHwWjaTrm60PhOh ErsROAOMM43AkPzfqIH8DzydBjqwC2mSc9tIIy/Vsod2RT4wCutIcRjCaIS2TQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pg9ff1SjQzQwl; Mon, 20 Mar 2023 10:18: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 32KAI2Zi046617; Mon, 20 Mar 2023 10:18:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KAI2sr046616; Mon, 20 Mar 2023 10:18:02 GMT (envelope-from git) Date: Mon, 20 Mar 2023 10:18:02 GMT Message-Id: <202303201018.32KAI2sr046616@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: 40e043596409 - main - carp: add netlink interface List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40e0435964094dfda21089d9989197999c06c4bc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=40e0435964094dfda21089d9989197999c06c4bc commit 40e0435964094dfda21089d9989197999c06c4bc Author: Kristof Provost AuthorDate: 2023-03-07 18:17:09 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 09:52:27 +0000 carp: add netlink interface Allow carp configuration information to be supplied and retrieved via netlink. Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39048 --- lib/libifconfig/libifconfig.h | 20 +- lib/libifconfig/libifconfig_carp.c | 177 ++++++++++- lib/libifconfig/libifconfig_internal.c | 14 + lib/libifconfig/libifconfig_internal.h | 3 + sbin/ifconfig/carp.c | 18 +- sys/netinet/ip_carp.c | 524 ++++++++++++++++++++++++--------- sys/netinet/ip_carp_nl.h | 34 +++ 7 files changed, 634 insertions(+), 156 deletions(-) diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index c8bbb5edd3bb..64a61af0708c 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -33,6 +33,7 @@ #include #include +#include #include #define ND6_IFF_DEFAULTIF 0x8000 @@ -41,7 +42,8 @@ typedef enum { OK = 0, OTHER, IOCTL, - SOCKET + SOCKET, + NETLINK } ifconfig_errtype; /* @@ -51,7 +53,6 @@ typedef enum { struct ifconfig_handle; typedef struct ifconfig_handle ifconfig_handle_t; -struct carpreq; struct ifaddrs; struct ifbropreq; struct ifbreq; @@ -279,8 +280,21 @@ ifmedia_t *ifconfig_media_lookup_options(ifmedia_t media, const char **opts, int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, struct ifdownreason *ifdr); +struct ifconfig_carp { + size_t carpr_count; + uint32_t carpr_vhid; + uint32_t carpr_state; + int32_t carpr_advbase; + int32_t carpr_advskew; + uint8_t carpr_key[CARP_KEY_LEN]; +}; + +int ifconfig_carp_get_vhid(ifconfig_handle_t *h, const char *name, + struct ifconfig_carp *carpr, uint32_t vhid); int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, - struct carpreq *carpr, int ncarpr); + struct ifconfig_carp *carpr, size_t ncarp); +int ifconfig_carp_set_info(ifconfig_handle_t *h, const char *name, + const struct ifconfig_carp *carpr); /** Retrieve additional information about an inet address * @param h An open ifconfig state object diff --git a/lib/libifconfig/libifconfig_carp.c b/lib/libifconfig/libifconfig_carp.c index cd31a85dfd9a..ffc497590aaa 100644 --- a/lib/libifconfig/libifconfig_carp.c +++ b/lib/libifconfig/libifconfig_carp.c @@ -33,6 +33,12 @@ #include #include +#include + +#include +#include +#include +#include #include #include @@ -40,21 +46,174 @@ #include "libifconfig.h" #include "libifconfig_internal.h" +#include + +#define _OUT(_field) offsetof(struct ifconfig_carp, _field) +static struct snl_attr_parser ap_carp_get[] = { + { .type = CARP_NL_VHID, .off = _OUT(carpr_vhid), .cb = snl_attr_get_uint32 }, + { .type = CARP_NL_STATE, .off = _OUT(carpr_state), .cb = snl_attr_get_uint32 }, + { .type = CARP_NL_ADVBASE, .off = _OUT(carpr_advbase), .cb = snl_attr_get_int32 }, + { .type = CARP_NL_ADVSKEW, .off = _OUT(carpr_advskew), .cb = snl_attr_get_int32 }, + { .type = CARP_NL_KEY, .off = _OUT(carpr_key), .cb = snl_attr_get_string }, +}; +#undef _OUT + +SNL_DECLARE_GENL_PARSER(carp_get_parser, ap_carp_get); + +static int +_ifconfig_carp_get(ifconfig_handle_t *h, const char *name, + struct ifconfig_carp *carp, size_t ncarp, uint32_t vhid) +{ + struct snl_state ss = {}; + struct snl_errmsg_data e = {}; + struct snl_writer nw; + struct nlmsghdr *hdr; + size_t i = 0; + uint32_t seq_id; + unsigned int ifindex; + int family_id; + + ifconfig_error_clear(h); + + ifindex = if_nametoindex(name); + if (ifindex == 0) { + ifconfig_error(h, NETLINK, ENOENT); + return (-1); + } + + if (! snl_init(&ss, NETLINK_GENERIC)) { + ifconfig_error(h, NETLINK, ENOTSUP); + return (-1); + } + + snl_init_writer(&ss, &nw); + + family_id = snl_get_genl_family(&ss, CARP_NL_FAMILY_NAME); + if (family_id == 0) { + ifconfig_error(h, NETLINK, EPROTONOSUPPORT); + goto out; + } + + hdr = snl_create_genl_msg_request(&nw, family_id, CARP_NL_CMD_GET); + hdr->nlmsg_flags |= NLM_F_DUMP; + + snl_add_msg_attr_u32(&nw, CARP_NL_IFINDEX, ifindex); + + if (vhid != 0) + snl_add_msg_attr_u32(&nw, CARP_NL_VHID, vhid); + + hdr = snl_finalize_msg(&nw); + if (hdr == NULL) { + ifconfig_error(h, NETLINK, ENOMEM); + goto out; + } + seq_id = hdr->nlmsg_seq; + if (! snl_send_message(&ss, hdr)) { + ifconfig_error(h, NETLINK, EIO); + goto out; + } + + while ((hdr = snl_read_reply_multi(&ss, seq_id, &e)) != NULL) { + if (e.error != 0) { + ifconfig_error(h, NETLINK, e.error); + break; + } + + if (i >= ncarp) { + ifconfig_error(h, NETLINK, E2BIG); + break; + } + + memset(&carp[i], 0, sizeof(carp[0])); + if (! snl_parse_nlmsg(&ss, hdr, &carp_get_parser, &carp[i])) + continue; + + i++; + carp[0].carpr_count = i; + + if (i > ncarp) { + ifconfig_error(h, NETLINK, E2BIG); + break; + } + } + +out: + snl_free(&ss); + + return (h->error.errcode ? -1 : 0); +} int -ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, - struct carpreq *carpr, int ncarpr) +ifconfig_carp_set_info(ifconfig_handle_t *h, const char *name, + const struct ifconfig_carp *carpr) { - struct ifreq ifr; + struct snl_state ss = {}; + struct snl_writer nw; + struct nlmsghdr *hdr; + unsigned int ifindex; + int family_id; + uint32_t seq_id; + + ifconfig_error_clear(h); + + ifindex = if_nametoindex(name); + if (ifindex == 0) { + ifconfig_error(h, NETLINK, ENOENT); + return (-1); + } + + if (! snl_init(&ss, NETLINK_GENERIC)) { + ifconfig_error(h, NETLINK, ENOTSUP); + return (-1); + } - bzero(carpr, sizeof(struct carpreq) * ncarpr); - carpr[0].carpr_count = ncarpr; - strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_data = (caddr_t)carpr; + snl_init_writer(&ss, &nw); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGVH, &ifr) != 0) { + family_id = snl_get_genl_family(&ss, CARP_NL_FAMILY_NAME); + if (family_id == 0) { + ifconfig_error(h, NETLINK, EPROTONOSUPPORT); return (-1); } + hdr = snl_create_genl_msg_request(&nw, family_id, CARP_NL_CMD_SET); + + snl_add_msg_attr_u32(&nw, CARP_NL_VHID, carpr->carpr_vhid); + snl_add_msg_attr_u32(&nw, CARP_NL_STATE, carpr->carpr_state); + snl_add_msg_attr_s32(&nw, CARP_NL_ADVBASE, carpr->carpr_advbase); + snl_add_msg_attr_s32(&nw, CARP_NL_ADVSKEW, carpr->carpr_advskew); + snl_add_msg_attr_u32(&nw, CARP_NL_IFINDEX, ifindex); + + hdr = snl_finalize_msg(&nw); + if (hdr == NULL) { + ifconfig_error(h, NETLINK, ENOMEM); + goto out; + } - return (0); + seq_id = hdr->nlmsg_seq; + if (! snl_send_message(&ss, hdr)) { + ifconfig_error(h, NETLINK, EIO); + goto out; + } + + struct snl_errmsg_data e = { }; + if (! snl_read_reply_code(&ss, seq_id, &e)) + ifconfig_error(h, NETLINK, e.error); + +out: + snl_free(&ss); + + return (h->error.errcode ? -1 : 0); +} + +int +ifconfig_carp_get_vhid(ifconfig_handle_t *h, const char *name, + struct ifconfig_carp *carp, uint32_t vhid) +{ + return (_ifconfig_carp_get(h, name, carp, 1, vhid)); +} + +int +ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, + struct ifconfig_carp *carp, size_t ncarp) +{ + return (_ifconfig_carp_get(h, name, carp, ncarp, 0)); } diff --git a/lib/libifconfig/libifconfig_internal.c b/lib/libifconfig/libifconfig_internal.c index 6b7f767e23e0..7d40a30e07cb 100644 --- a/lib/libifconfig/libifconfig_internal.c +++ b/lib/libifconfig/libifconfig_internal.c @@ -102,3 +102,17 @@ ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) *s = h->sockets[addressfamily]; return (0); } + +void +ifconfig_error_clear(ifconfig_handle_t *h) +{ + h->error.errtype = OK; + h->error.errcode = 0; +} + +void +ifconfig_error(ifconfig_handle_t *h, ifconfig_errtype type, int error) +{ + h->error.errtype = type; + h->error.errcode = error; +} diff --git a/lib/libifconfig/libifconfig_internal.h b/lib/libifconfig/libifconfig_internal.h index 77add7574fa8..0096f7ca94ea 100644 --- a/lib/libifconfig/libifconfig_internal.h +++ b/lib/libifconfig/libifconfig_internal.h @@ -83,3 +83,6 @@ int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s); /** Function to wrap ioctl() and automatically populate ifconfig_errstate when appropriate.*/ int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, unsigned long request, void *data); + +void ifconfig_error_clear(ifconfig_handle_t *h); +void ifconfig_error(ifconfig_handle_t *h, ifconfig_errtype type, int error); diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index 23a119e3b9d7..3fa6f3ac269d 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -72,7 +72,7 @@ static unsigned char const *carpr_key; static void carp_status(int s) { - struct carpreq carpr[CARP_MAXVHID]; + struct ifconfig_carp carpr[CARP_MAXVHID]; if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) return; @@ -129,16 +129,14 @@ setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp) static void setcarp_callback(int s, void *arg __unused) { - struct carpreq carpr; + struct ifconfig_carp carpr = { }; - bzero(&carpr, sizeof(struct carpreq)); - carpr.carpr_vhid = carpr_vhid; - carpr.carpr_count = 1; - ifr.ifr_data = (caddr_t)&carpr; - - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1 && errno != ENOENT) - err(1, "SIOCGVH"); + if (ifconfig_carp_get_vhid(lifh, name, &carpr, carpr_vhid) == -1) { + if (ifconfig_err_errno(lifh) != ENOENT) + return; + } + carpr.carpr_vhid = carpr_vhid; if (carpr_key != NULL) /* XXX Should hash the password into the key here? */ strlcpy(carpr.carpr_key, carpr_key, CARP_KEY_LEN); @@ -149,7 +147,7 @@ setcarp_callback(int s, void *arg __unused) if (carpr_state > -1) carpr.carpr_state = carpr_state; - if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) + if (ifconfig_carp_set_info(lifh, name, &carpr)) err(1, "SIOCSVH"); } diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 1b8b10b06168..78bc6d312abb 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif @@ -84,6 +85,11 @@ __FBSDID("$FreeBSD$"); #include #endif +#include +#include +#include +#include + #include static MALLOC_DEFINE(M_CARP, "CARP", "CARP addresses"); @@ -332,6 +338,24 @@ static struct sx carp_sx; static struct task carp_sendall_task = TASK_INITIALIZER(0, carp_send_ad_all, NULL); +static int +carp_is_supported_if(if_t ifp) +{ + if (ifp == NULL) + return (ENXIO); + + switch (ifp->if_type) { + case IFT_ETHER: + case IFT_L2VLAN: + case IFT_BRIDGE: + break; + default: + return (EOPNOTSUPP); + } + + return (0); +} + static void carp_hmac_prepare(struct carp_softc *sc) { @@ -1709,9 +1733,10 @@ carp_free_if(struct carp_if *cif) free(cif, M_CARP); } -static void -carp_carprcp(struct carpreq *carpr, struct carp_softc *sc, int priv) +static bool +carp_carprcp(void *arg, struct carp_softc *sc, int priv) { + struct carpreq *carpr = arg; CARP_LOCK(sc); carpr->carpr_state = sc->sc_state; @@ -1723,33 +1748,142 @@ carp_carprcp(struct carpreq *carpr, struct carp_softc *sc, int priv) else bzero(carpr->carpr_key, sizeof(carpr->carpr_key)); CARP_UNLOCK(sc); + + return (true); +} + +static int +carp_ioctl_set(if_t ifp, struct carpreq *carpr) +{ + struct epoch_tracker et; + struct carp_softc *sc = NULL; + int error = 0; + + + if (carpr->carpr_vhid <= 0 || carpr->carpr_vhid > CARP_MAXVHID || + carpr->carpr_advbase < 0 || carpr->carpr_advskew < 0) { + return (EINVAL); + } + + if (ifp->if_carp) { + IFNET_FOREACH_CARP(ifp, sc) + if (sc->sc_vhid == carpr->carpr_vhid) + break; + } + if (sc == NULL) { + sc = carp_alloc(ifp); + CARP_LOCK(sc); + sc->sc_vhid = carpr->carpr_vhid; + LLADDR(&sc->sc_addr)[0] = 0; + LLADDR(&sc->sc_addr)[1] = 0; + LLADDR(&sc->sc_addr)[2] = 0x5e; + LLADDR(&sc->sc_addr)[3] = 0; + LLADDR(&sc->sc_addr)[4] = 1; + LLADDR(&sc->sc_addr)[5] = sc->sc_vhid; + } else + CARP_LOCK(sc); + if (carpr->carpr_advbase > 0) { + if (carpr->carpr_advbase > 255 || + carpr->carpr_advbase < CARP_DFLTINTV) { + error = EINVAL; + goto out; + } + sc->sc_advbase = carpr->carpr_advbase; + } + if (carpr->carpr_advskew >= 255) { + error = EINVAL; + goto out; + } + sc->sc_advskew = carpr->carpr_advskew; + if (carpr->carpr_key[0] != '\0') { + bcopy(carpr->carpr_key, sc->sc_key, sizeof(sc->sc_key)); + carp_hmac_prepare(sc); + } + if (sc->sc_state != INIT && + carpr->carpr_state != sc->sc_state) { + switch (carpr->carpr_state) { + case BACKUP: + callout_stop(&sc->sc_ad_tmo); + carp_set_state(sc, BACKUP, + "user requested via ifconfig"); + carp_setrun(sc, 0); + carp_delroute(sc); + break; + case MASTER: + NET_EPOCH_ENTER(et); + carp_master_down_locked(sc, + "user requested via ifconfig"); + NET_EPOCH_EXIT(et); + break; + default: + break; + } + } + +out: + CARP_UNLOCK(sc); + + return (error); +} + +static int +carp_ioctl_get(if_t ifp, struct ucred *cred, struct carpreq *carpr, + bool (*outfn)(void *, struct carp_softc *, int), void *arg) +{ + int priveleged; + struct carp_softc *sc; + + if (carpr->carpr_vhid < 0 || carpr->carpr_vhid > CARP_MAXVHID) + return (EINVAL); + if (carpr->carpr_count < 1) + return (EMSGSIZE); + if (ifp->if_carp == NULL) + return (ENOENT); + + priveleged = (priv_check_cred(cred, PRIV_NETINET_CARP) == 0); + if (carpr->carpr_vhid != 0) { + IFNET_FOREACH_CARP(ifp, sc) + if (sc->sc_vhid == carpr->carpr_vhid) + break; + if (sc == NULL) + return (ENOENT); + + if (! outfn(arg, sc, priveleged)) + return (ENOMEM); + carpr->carpr_count = 1; + } else { + int count; + + count = 0; + IFNET_FOREACH_CARP(ifp, sc) + count++; + + if (count > carpr->carpr_count) + return (EMSGSIZE); + + IFNET_FOREACH_CARP(ifp, sc) { + if (! outfn(arg, sc, priveleged)) + return (ENOMEM); + carpr->carpr_count = count; + } + } + + return (0); } int carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) { - struct epoch_tracker et; struct carpreq carpr; struct ifnet *ifp; - struct carp_softc *sc = NULL; - int error = 0, locked = 0; + int error = 0; if ((error = copyin(ifr_data_get_ptr(ifr), &carpr, sizeof carpr))) return (error); ifp = ifunit_ref(ifr->ifr_name); - if (ifp == NULL) - return (ENXIO); - - switch (ifp->if_type) { - case IFT_ETHER: - case IFT_L2VLAN: - case IFT_BRIDGE: - break; - default: - error = EOPNOTSUPP; + if ((error = carp_is_supported_if(ifp)) != 0) goto out; - } if ((ifp->if_flags & IFF_MULTICAST) == 0) { error = EADDRNOTAVAIL; @@ -1761,136 +1895,27 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) case SIOCSVH: if ((error = priv_check(td, PRIV_NETINET_CARP))) break; - if (carpr.carpr_vhid <= 0 || carpr.carpr_vhid > CARP_MAXVHID || - carpr.carpr_advbase < 0 || carpr.carpr_advskew < 0) { - error = EINVAL; - break; - } - if (ifp->if_carp) { - IFNET_FOREACH_CARP(ifp, sc) - if (sc->sc_vhid == carpr.carpr_vhid) - break; - } - if (sc == NULL) { - sc = carp_alloc(ifp); - CARP_LOCK(sc); - sc->sc_vhid = carpr.carpr_vhid; - LLADDR(&sc->sc_addr)[0] = 0; - LLADDR(&sc->sc_addr)[1] = 0; - LLADDR(&sc->sc_addr)[2] = 0x5e; - LLADDR(&sc->sc_addr)[3] = 0; - LLADDR(&sc->sc_addr)[4] = 1; - LLADDR(&sc->sc_addr)[5] = sc->sc_vhid; - } else - CARP_LOCK(sc); - locked = 1; - if (carpr.carpr_advbase > 0) { - if (carpr.carpr_advbase > 255 || - carpr.carpr_advbase < CARP_DFLTINTV) { - error = EINVAL; - break; - } - sc->sc_advbase = carpr.carpr_advbase; - } - if (carpr.carpr_advskew >= 255) { - error = EINVAL; - break; - } - sc->sc_advskew = carpr.carpr_advskew; - if (carpr.carpr_key[0] != '\0') { - bcopy(carpr.carpr_key, sc->sc_key, sizeof(sc->sc_key)); - carp_hmac_prepare(sc); - } - if (sc->sc_state != INIT && - carpr.carpr_state != sc->sc_state) { - switch (carpr.carpr_state) { - case BACKUP: - callout_stop(&sc->sc_ad_tmo); - carp_set_state(sc, BACKUP, - "user requested via ifconfig"); - carp_setrun(sc, 0); - carp_delroute(sc); - break; - case MASTER: - NET_EPOCH_ENTER(et); - carp_master_down_locked(sc, - "user requested via ifconfig"); - NET_EPOCH_EXIT(et); - break; - default: - break; - } - } + error = carp_ioctl_set(ifp, &carpr); break; case SIOCGVH: - { - int priveleged; - - if (carpr.carpr_vhid < 0 || carpr.carpr_vhid > CARP_MAXVHID) { - error = EINVAL; - break; - } - if (carpr.carpr_count < 1) { - error = EMSGSIZE; - break; - } - if (ifp->if_carp == NULL) { - error = ENOENT; - break; - } - - priveleged = (priv_check(td, PRIV_NETINET_CARP) == 0); - if (carpr.carpr_vhid != 0) { - IFNET_FOREACH_CARP(ifp, sc) - if (sc->sc_vhid == carpr.carpr_vhid) - break; - if (sc == NULL) { - error = ENOENT; - break; - } - carp_carprcp(&carpr, sc, priveleged); - error = copyout(&carpr, ifr_data_get_ptr(ifr), - sizeof(carpr)); - } else { - int i, count; - - count = 0; - IFNET_FOREACH_CARP(ifp, sc) - count++; - - if (count > carpr.carpr_count) { - CIF_UNLOCK(ifp->if_carp); - error = EMSGSIZE; - break; - } - - i = 0; - IFNET_FOREACH_CARP(ifp, sc) { - carp_carprcp(&carpr, sc, priveleged); - carpr.carpr_count = count; - error = copyout(&carpr, - (char *)ifr_data_get_ptr(ifr) + - (i * sizeof(carpr)), sizeof(carpr)); - if (error) { - CIF_UNLOCK(ifp->if_carp); - break; - } - i++; - } + error = carp_ioctl_get(ifp, td->td_ucred, &carpr, + carp_carprcp, &carpr); + if (error == 0) { + error = copyout(&carpr, + (char *)ifr_data_get_ptr(ifr), + carpr.carpr_count * sizeof(carpr)); } break; - } default: error = EINVAL; } sx_xunlock(&carp_sx); out: - if (locked) - CARP_UNLOCK(sc); - if_rele(ifp); + if (ifp != NULL) + if_rele(ifp); return (error); } @@ -2173,10 +2198,238 @@ carp_demote_adj_sysctl(SYSCTL_HANDLER_ARGS) return (0); } +static int +nlattr_get_carp_key(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target) +{ + if (__predict_false(NLA_DATA_LEN(nla) > CARP_KEY_LEN)) + return (EINVAL); + + memcpy(target, NLA_DATA_CONST(nla), NLA_DATA_LEN(nla)); + return (0); +} + +struct carp_nl_send_args { + struct nlmsghdr *hdr; + struct nl_pstate *npt; +}; + +static bool +carp_nl_send(void *arg, struct carp_softc *sc, int priv) +{ + struct carp_nl_send_args *nlsa = arg; + struct nlmsghdr *hdr = nlsa->hdr; + struct nl_pstate *npt = nlsa->npt; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) { + nlmsg_abort(nw); + return (false); + } + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + if (ghdr_new == NULL) { + nlmsg_abort(nw); + return (false); + } + + ghdr_new->cmd = CARP_NL_CMD_GET; + ghdr_new->version = 0; + ghdr_new->reserved = 0; + + CARP_LOCK(sc); + + nlattr_add_u32(nw, CARP_NL_VHID, sc->sc_vhid); + nlattr_add_u32(nw, CARP_NL_STATE, sc->sc_state); + nlattr_add_s32(nw, CARP_NL_ADVBASE, sc->sc_advbase); + nlattr_add_s32(nw, CARP_NL_ADVSKEW, sc->sc_advskew); + + if (priv) + nlattr_add(nw, CARP_NL_KEY, sizeof(sc->sc_key), sc->sc_key); + + CARP_UNLOCK(sc); + + if (! nlmsg_end(nw)) { + nlmsg_abort(nw); + return (false); + } + + return (true); +} + +struct nl_carp_parsed { + unsigned int ifindex; + uint32_t state; + uint32_t vhid; + int32_t advbase; + int32_t advskew; + char key[CARP_KEY_LEN]; +}; + +#define _IN(_field) offsetof(struct genlmsghdr, _field) +#define _OUT(_field) offsetof(struct nl_carp_parsed, _field) + +static const struct nlattr_parser nla_p_set[] = { + { .type = CARP_NL_VHID, .off = _OUT(vhid), .cb = nlattr_get_uint32 }, + { .type = CARP_NL_STATE, .off = _OUT(state), .cb = nlattr_get_uint32 }, + { .type = CARP_NL_ADVBASE, .off = _OUT(advbase), .cb = nlattr_get_uint32 }, + { .type = CARP_NL_ADVSKEW, .off = _OUT(advskew), .cb = nlattr_get_uint32 }, + { .type = CARP_NL_KEY, .off = _OUT(key), .cb = nlattr_get_carp_key }, + { .type = CARP_NL_IFINDEX, .off = _OUT(ifindex), .cb = nlattr_get_uint32 }, +}; +static const struct nlfield_parser nlf_p_set[] = { +}; +NL_DECLARE_PARSER(carp_parser, struct genlmsghdr, nlf_p_set, nla_p_set); +#undef _IN +#undef _OUT + + +static int +carp_nl_get(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct nl_carp_parsed attrs = { }; + struct carp_nl_send_args args; + struct carpreq carpr = { }; + struct epoch_tracker et; + if_t ifp; + int error; + + error = nl_parse_nlmsg(hdr, &carp_parser, npt, &attrs); + if (error != 0) + return (error); + + NET_EPOCH_ENTER(et); + ifp = ifnet_byindex_ref(attrs.ifindex); + NET_EPOCH_EXIT(et); + + if ((error = carp_is_supported_if(ifp)) != 0) + goto out; + + hdr->nlmsg_flags |= NLM_F_MULTI; + args.hdr = hdr; + args.npt = npt; + + carpr.carpr_vhid = attrs.vhid; + carpr.carpr_count = CARP_MAXVHID; + + sx_xlock(&carp_sx); + error = carp_ioctl_get(ifp, nlp_get_cred(npt->nlp), &carpr, + carp_nl_send, &args); + sx_xunlock(&carp_sx); + + if (! nlmsg_end_dump(npt->nw, error, hdr)) + error = ENOMEM; + +out: + if (ifp != NULL) + if_rele(ifp); + + return (error); +} + +static int +carp_nl_set(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct nl_carp_parsed attrs = { }; + struct carpreq carpr; + struct epoch_tracker et; + if_t ifp; + int error; + + error = nl_parse_nlmsg(hdr, &carp_parser, npt, &attrs); + if (error != 0) + return (error); + + if (attrs.vhid <= 0 || attrs.vhid > CARP_MAXVHID) + return (EINVAL); + if (attrs.state > CARP_MAXSTATE) + return (EINVAL); + if (attrs.advbase < 0 || attrs.advskew < 0) + return (EINVAL); + if (attrs.advbase > 255) + return (EINVAL); + if (attrs.advskew >= 255) + return (EINVAL); + + NET_EPOCH_ENTER(et); + ifp = ifnet_byindex_ref(attrs.ifindex); + NET_EPOCH_EXIT(et); + + if ((error = carp_is_supported_if(ifp)) != 0) + goto out; + + if ((ifp->if_flags & IFF_MULTICAST) == 0) { + error = EADDRNOTAVAIL; + goto out; + } + + carpr.carpr_count = 1; + carpr.carpr_vhid = attrs.vhid; + carpr.carpr_state = attrs.state; + carpr.carpr_advbase = attrs.advbase; + carpr.carpr_advskew = attrs.advskew; + memcpy(&carpr.carpr_key, &attrs.key, sizeof(attrs.key)); + + sx_xlock(&carp_sx); + error = carp_ioctl_set(ifp, &carpr); + sx_xunlock(&carp_sx); + +out: + if (ifp != NULL) + if_rele(ifp); + + return (error); +} + +static const struct nlhdr_parser *all_parsers[] = { + &carp_parser +}; + +static const struct genl_cmd carp_cmds[] = { + { + .cmd_num = CARP_NL_CMD_GET, + .cmd_name = "SIOCGVH", + .cmd_cb = carp_nl_get, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_DUMP | + GENL_CMD_CAP_HASPOL, + }, + { + .cmd_num = CARP_NL_CMD_SET, + .cmd_name = "SIOCSVH", + .cmd_cb = carp_nl_set, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_CARP, + }, +}; + +static void +carp_nl_register(void) +{ + bool ret __diagused; + int family_id __diagused; + + NL_VERIFY_PARSERS(all_parsers); + family_id = genl_register_family(CARP_NL_FAMILY_NAME, 0, 2, + CARP_NL_CMD_MAX); + MPASS(family_id != 0); + + ret = genl_register_cmds(CARP_NL_FAMILY_NAME, carp_cmds, + NL_ARRAY_LEN(carp_cmds)); + MPASS(ret); +} + +static void +carp_nl_unregister(void) +{ + genl_unregister_family(CARP_NL_FAMILY_NAME); +} + static void carp_mod_cleanup(void) { + carp_nl_unregister(); + #ifdef INET (void)ipproto_unregister(IPPROTO_CARP); carp_iamatch_p = NULL; @@ -2246,6 +2499,9 @@ carp_mod_load(void) return (err); } #endif + + carp_nl_register(); + return (0); } diff --git a/sys/netinet/ip_carp_nl.h b/sys/netinet/ip_carp_nl.h new file mode 100644 index 000000000000..ffb7c1ef5aae --- /dev/null +++ b/sys/netinet/ip_carp_nl.h @@ -0,0 +1,34 @@ +#ifndef _IP_CARP_NL_H +#define _IP_CARP_NL_H + +#include + +#include +#include *** 27 LINES SKIPPED *** From nobody Mon Mar 20 10:18:03 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pg9fg5DnWz40Wkp; Mon, 20 Mar 2023 10:18: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 4Pg9fg3M6lz4L5C; Mon, 20 Mar 2023 10:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679307483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4M+pVz1+8fSaUpg9R2zu0HLvRZ/09xrLdHo8zMjBlAs=; b=AKCq/mzQGol9oP89DKdQZQt1jUdE4OKmVdTQfAMhfKyII/+WGqKxClX//9kkrczR4n/ltf Sx+HILn559GOKtzSBzKxogPIjYx2ikZIR2WIOpV+Z16AGMJpwGsslkfUXCdpPF4XRY/9R7 VYG6mwPj3o3NmzGzlVFsUJggX5LlWio1buD4+eb+3aLD8u7PkQ4zSvBKAVvfMe/v065+04 Qo0VPghadfoqXvDqO4Q7uKREerVdRhj0mxecSHBIRHs74JPOZdK7tgLh57InSuJSg126wV eAOIbGGl4p1mbUqYjm6SCY4fdTiC4U7KgdVV9qc9BMzmPLq6wqEZt/70iodJRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679307483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4M+pVz1+8fSaUpg9R2zu0HLvRZ/09xrLdHo8zMjBlAs=; b=gN/ULaY+3vYcI8MXU8Gf3V1oXoOYQWw+fWyTZsQFoxeuHUhsssE0aEKecZwFhxvvR1rhPG U3v28cbV2iNoK3HvmcynmWmGzmOsxLJgK0MyGKUOqJYYBHrafQJw8Jb2IsLaUxmkceyZAT xmcdSqxHTOOybklDkHcpZicIEiuFsIf6iEZu8fRic4P1Qpn8ar2dEwQd51CpX6qQLSwWaL gMzmba8IxjvOnH9c+oU7saPSdOKo7A2yBQcQ5nWWIRtkXVwD+308TxERAmPLbM0Dr4Io7D 910qtz+Ahhs7/XH86Z5y4bauL6HGR30Hyp82OFn4s8HeBG58JTnlyJITrhrD3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679307483; a=rsa-sha256; cv=none; b=Hj9QTzMsGXppSLL5rsr5KYDiA9rBD23yvJGfn/BmhJ66hCLd882WYpDDkaJOK/vMW8Rg24 SqJ2vpLDAswaDYJWE/rn8JObvgJKVTVz4WFQKm07lJFcJY9KBC4TqDbXukmmpjkTZrFG+C DLhax8H+xkOvV4Z+heu7Tv9t0vshEPrOlOQswCi5PZtcKF/MmE1lcH7G97uJWZMFzLXO9v vJwc7X5YkI9xvzS+FhbN+HjCBhHxnQsVUmA8dw27i4/lMpJW2sry4SvacEoHi7zH/pswwr TBIXN4rYY6BbabPnSum7at4sVwiCdsMHuUSk8Guf+Y/EcvouLKEHleN98+t9ZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pg9fg2MFgzRK4; Mon, 20 Mar 2023 10:18: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 32KAI3dU046636; Mon, 20 Mar 2023 10:18:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KAI3e5046635; Mon, 20 Mar 2023 10:18:03 GMT (envelope-from git) Date: Mon, 20 Mar 2023 10:18:03 GMT Message-Id: <202303201018.32KAI3e5046635@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: 9d48283d6028 - main - carp tests: test manually switch between backup and master List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d48283d60284eb62fd32d2d8113cbf0beca28b3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9d48283d60284eb62fd32d2d8113cbf0beca28b3 commit 9d48283d60284eb62fd32d2d8113cbf0beca28b3 Author: Kristof Provost AuthorDate: 2023-03-16 10:16:24 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 09:52:53 +0000 carp tests: test manually switch between backup and master There's been at least one issue where we failed to correctly enter NET_EPOCH that was triggered in this scenario. Add a test case for it to make it easier to detect issues like this in the future. Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39115 --- tests/sys/netinet/carp.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index d31a17ed6beb..9afe9d2ea8c1 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -263,10 +263,35 @@ nd6_ns_source_mac_cleanup() } +atf_test_case "switch" "cleanup" +switch_head() +{ + atf_set descr 'Switch between master and backup' + atf_set require.user root +} + +switch_body() +{ + carp_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + ifconfig ${epair}a vhid 1 advskew 100 192.0.2.1/24 + ifconfig ${epair}a vhid 1 state backup + ifconfig ${epair}a vhid 1 state master +} + +switch_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic_v4" atf_add_test_case "basic_v6" atf_add_test_case "negative_demotion" atf_add_test_case "nd6_ns_source_mac" + atf_add_test_case "switch" } From nobody Mon Mar 20 11:23:40 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgC6N636Qz40ZqQ; Mon, 20 Mar 2023 11:23: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 4PgC6N5Zfwz3CMM; Mon, 20 Mar 2023 11:23:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679311420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tr9RXpCQkioFlmb87opIR6qi/g8b4GcWJz7zQYH1z4U=; b=moCCGARfnHWxCxsCdxAl4jX/R4UqsQ1fnhkHSxWsxL3dDtg/lxYEQcDfvJ3l+nuzQptmGI mRAiYdGqZZ+uYVtpUx1Ge8yyO+szor1khDY8Vz0xrCrZ+H6DnpaT+FwonY6NJNje01p/R5 Ql7wPvfQbdxfYOvW//ClKgMn+C4p/B/O0T1uYrMTUhKDmi54lJwtWJzObs5ImyHP+dR3HY LAGHZZDp7GeMuLGUFwhs1HOeoAMxrcx1y/65CDzSJNaEB8CDtPMjIifHgahqSEAHpt+RcJ jWZhcoxrln7+K6QeN+IGaKLZG6ebx4wj2xGmtCygPsFK6WRiXXyjg0KROmRLwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679311420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tr9RXpCQkioFlmb87opIR6qi/g8b4GcWJz7zQYH1z4U=; b=XavGGo5VJGfWTRCyFYJBpxHgA/2tNm5SjTpKTDgJc6rkNNnC6xGw83wqGimTKC0MxJ4TdN ne0C7d/hbKTFbE7V/ssLzDEjOImqSfoxRTRV+D+4GJX1fTZNIjERiZc0SHmq/sC57W8bK3 cMwpW8ACcUJpqSqgXq5fvvQCGwSiw5U4I/IH2mkdm/JHqEqxLkTrIsVAwrHgmh9Bl3sXeU Y5QOr4182wyU4T2CxzKkhZBWBWzWcRKjU1eV8ZROhN1aN+Ym5ZNU/JXqTHHLJFwTyFpRri xTcL0J0r/GDZqmNiYzHyaDAUNF03e9EpmZt3wlzq95GhcREBmS5gBhPTVosX1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679311420; a=rsa-sha256; cv=none; b=YvV6wurtOGsHpupEnCcwm0pE0I9nkudSkkP5y0lCwjgGwKkcEzBxHnXmmpBoTjNUCq4IXM u9rKjmAxjqeR1BWL21ra1joDmmiKL7TmZ/yXIQRnB01tEiaGP52SGMCrh1eViMyi+WEOr1 69KHVc0Ec/DKJ3UZ582N+flYqbR8UCr7eDCKq1j6vVUDVWBiYzpsX51Ghs4nQtD1V6nlAu lRlX4/yYghXf93UeU9fhiit1a9yU/Cuh9eTRwGdOnsZp3f06V98DKH8XWxMATRD4YfVwH4 cp4QVEAqhEXR9V7+uquX6X8gEp3+maRySRl9jEKb3dafVxFJCtesJAcO3U3a6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgC6N4bn1zSp6; Mon, 20 Mar 2023 11:23: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 32KBNelt060281; Mon, 20 Mar 2023 11:23:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KBNe1Y060280; Mon, 20 Mar 2023 11:23:40 GMT (envelope-from git) Date: Mon, 20 Mar 2023 11:23:40 GMT Message-Id: <202303201123.32KBNe1Y060280@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: ef9f49a21ad8 - main - arm64: Adding a missing include file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: ef9f49a21ad822497653d8c8abf5c26e13be2ded Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ef9f49a21ad822497653d8c8abf5c26e13be2ded commit ef9f49a21ad822497653d8c8abf5c26e13be2ded Author: Dmitry Mikushin AuthorDate: 2023-03-20 11:18:45 +0000 Commit: Andrew Turner CommitDate: 2023-03-20 11:23:01 +0000 arm64: Adding a missing include file Adding a missing include file, which provides the definition of SYSCTL_INT. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D39149 --- sys/arm64/arm64/nexus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 0c06736f4e66..0d4257406ca4 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From nobody Mon Mar 20 12:10:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgD8B0VP9z40dZ4 for ; Mon, 20 Mar 2023 12:10:18 +0000 (UTC) (envelope-from bT.8gkgh6xd30=ceecfebtnu2w=2sl1wfofox@return.smtpservice.net) Received: from e2i580.smtp2go.com (e2i580.smtp2go.com [103.2.142.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgD893LdCz3Fy6 for ; Mon, 20 Mar 2023 12:10:17 +0000 (UTC) (envelope-from bT.8gkgh6xd30=ceecfebtnu2w=2sl1wfofox@return.smtpservice.net) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=mgy720.a1-4.dyn; x=1679315117; h=Feedback-ID: X-Smtpcorp-Track:To:Date:Subject:Message-Id:From:Reply-To:Sender: List-Unsubscribe; bh=m9jN/RjJBbWfIoQdE4lsVXgVLzFPr4LYfNGAjIsdoxk=; b=ntFt+WSP i9X+qfHOJFPazdQUBmos27TpWZb+nhLY9ikhF2qrsJtfXpjQjjR0XQ/Ov9HPUmlXHhMSLMyNbjOo6 FWB0fO+C9UliXQQpSwOXH3lJR0secM6NBPftyWJqCbmHnJeYc3gYJs3EWPNkAPS9Io/bvZ7uWA1ld 2RR5zLcWm43KgTqgx/H5QwM/lZ/3AXiNWW5lcBosWfdhgQyzYvY+OAtsIBHuxL7m9PtXi4IIDhsdx 8d46IjhGL5OuycQLOuR5B+Kld/SGrz+8QB5I/FPxVPog0POd7OGiZlkKWAmUROtIzbl+b0gUDSuwA f0tQz1rISlM1NvHw30dB/+CNBA==; Received: from [10.176.58.103] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1peEL6-qt4KyX-RP; Mon, 20 Mar 2023 12:10:12 +0000 Received: from [10.162.55.164] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96-S2G) (envelope-from ) id 1peEL6-9EU24T-1Z; Mon, 20 Mar 2023 12:10:12 +0000 Received: from smtpclient.apple (cpc91210-cmbg18-2-0-cust37.5-4.cable.virginm.net [81.102.44.38]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id 993E1294F3; Mon, 20 Mar 2023 12:10:11 +0000 (UTC) From: Andrew Turner Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 Date: Mon, 20 Mar 2023 12:10:00 +0000 In-Reply-To: <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> Cc: "" , "" , "" To: Ravi Pokala References: <202303161646.32GGkArS022254@gitrepo.freebsd.org> <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Smtpcorp-Track: 1p-EL69El24T1Z.GJ0XFFw60yoU7 Feedback-ID: 790814m:790814amQcrys:790814s_u8mx-IzT X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Rspamd-Queue-Id: 4PgD893LdCz3Fy6 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:103.2.140.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 That should now be fixed. Andrew > On 20 Mar 2023, at 06:22, Ravi Pokala wrote: >=20 > Hi Andrew, >=20 > This breaks arm64.LINT-FDT: >=20 > | >>> stage 3.1: building everything > | -------------------------------------------------------------- > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: = error: expected identifier > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support implicit int [-Werror,-Wimplicit-int] > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | int > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: = warning: a function declaration without a prototype is deprecated in all = versions of C [-Wstrict-prototypes] > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | 1 warning and 2 errors generated. > | --- nexus.o --- > | *** [nexus.o] Error code 1 > |=20 > | make[5]: stopped in = /build/usr/home/rpokala/freebsd/src/clean-main/arm64.aarch64/sys/LINT-FDT >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 > =EF=BB=BF-----Original Message----- > From: = > on behalf of Andrew Turner = = > > Date: Thursday, March 16, 2023 at 09:46 > To: = >, >, = > > Subject: git: f7acb7ed41f2 - main - Allow forcing non-posted memory on = arm64 >=20 >=20 > The branch main has been updated by andrew: >=20 >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e04791b= a5ceaf13 = > >=20 >=20 > commit f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 > Author: Andrew Turner = > > AuthorDate: 2023-03-16 15:35:59 +0000 > Commit: Andrew Turner = > > CommitDate: 2023-03-16 16:45:42 +0000 >=20 >=20 > Allow forcing non-posted memory on arm64 >=20 >=20 > To allow for debugging after changing the arm64 VM_MEMATTR_DEVICE > memory type add a new set of tunables to tell the kernel to use > non-posted memory. >=20 >=20 > This adds the following tunables: > - kern.force_nonposted: When set to non-zero the kernel will use > non-posted memory for all device allocations. > - hint...force_nonposted: As above, however only forces > non-posted memory on the named device. >=20 >=20 > Sponsored by: Arm Ltd > Differential Revision: https://reviews.freebsd.org/D38944 = > --- > sys/arm64/arm64/nexus.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) >=20 >=20 > diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c > index 3d6519f5fedd..0c06736f4e66 100644 > --- a/sys/arm64/arm64/nexus.c > +++ b/sys/arm64/arm64/nexus.c > @@ -83,6 +83,10 @@ struct nexus_device { > struct resource_list nx_resources; > }; >=20 >=20 > +static int force_np; > +SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > + "Force all devices to use non-posted device memory"); > + > #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) >=20 >=20 > static struct rman mem_rman; > @@ -373,7 +377,7 @@ nexus_activate_resource_flags(device_t bus, = device_t child, int type, int rid, > { > struct resource_map_request args; > struct resource_map map; > - int err; > + int err, use_np; >=20 >=20 > if ((err =3D rman_activate_resource(r)) !=3D 0) > return (err); > @@ -386,7 +390,13 @@ nexus_activate_resource_flags(device_t bus, = device_t child, int type, int rid, > case SYS_RES_MEMORY: > if ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) { > resource_init_map_request(&args); > - if ((flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0) > + use_np =3D (flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0 || > + force_np; > + if (!use_np) > + resource_int_value(device_get_name(child), > + device_get_unit(child), "force_nonposted", > + &use_np); > + if (use_np) > args.memattr =3D VM_MEMATTR_DEVICE_NP; > err =3D nexus_map_resource(bus, child, type, r, &args, > &map); --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 That should = now be fixed.

Andrew

On 20 Mar 2023, at 06:22, Ravi Pokala = <rpokala@freebsd.org> wrote:

Hi Andrew,

This = breaks arm64.LINT-FDT:

| = >>> stage 3.1: building everything
| = --------------------------------------------------------------
| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: = error: expected identifier
| = SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0,
| =             &n= bsp;           &nbs= p;            =             &n= bsp;          ^| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support implicit int [-Werror,-Wimplicit-int]
| SYSCTL_INT(_kern, OID_AUTO, = force_nonposted, CTLFLAG_RDTUN, &force_np, 0,
| ^
| = int
| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: = warning: a function declaration without a prototype is deprecated in all = versions of C [-Wstrict-prototypes]
| = SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0,
| =           ^
| 1 warning and 2 errors = generated.
| --- nexus.o = ---
| *** [nexus.o] Error = code 1
| 
| make[5]: stopped in = /build/usr/home/rpokala/freebsd/src/clean-main/arm64.aarch64/sys/LINT-FDT<= /span>

Thanks,

Ravi (rpokala@)

=EF=BB=BF-----Original = Message-----
From: <owner-src-committers@freebsd.org <mailto:owner-src-committers@freebsd.org>> on behalf of Andrew Turner = <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
Date: = Thursday, March 16, 2023 at 09:46
To: = <src-committers@FreeBSD.org <mailto:src-committers@FreeBSD.org>>, <dev-commits-src-all@FreeBSD.org<mailto:dev-commits-src-all@FreeBSD.org>>, <dev-commits-src-main@FreeBSD.org <mailto:dev-commits-src-main@FreeBSD.org>>
Subject: git: f7acb7ed41f2 - main - Allow forcing = non-posted memory on arm64


The = branch main has been updated by andrew:


URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13<https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13>


commit = f7acb7ed41f229a050b2d5e35e04791ba5ceaf13
Author: = Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
AuthorDate: 2023-03-16 15:35:59 +0000
Commit: Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
CommitDate: 2023-03-16 16:45:42 +0000


Allow forcing non-posted memory on = arm64


To allow for debugging = after changing the arm64 VM_MEMATTR_DEVICE
memory = type add a new set of tunables to tell the kernel to use
non-posted memory.


This adds the following tunables:
- kern.force_nonposted: When set to = non-zero the kernel will use
non-posted memory for all device allocations.
- = hint.<dev>.<unit>.force_nonposted: As above, however only = forces
non-posted memory on the = named device.


Sponsored by: Arm = Ltd
Differential = Revision: https://reviews.freebsd.org/D38944 <https://reviews.freebsd.org/D38944>
---
sys/arm64/arm64/nexus.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 = deletions(-)


diff --git = a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c
index 3d6519f5fedd..0c06736f4e66 = 100644
--- = a/sys/arm64/arm64/nexus.c
+++ = b/sys/arm64/arm64/nexus.c
@@ = -83,6 +83,10 @@ struct nexus_device {
struct = resource_list nx_resources;
};


+static = int force_np;
+SYSCTL_INT(_kern, = OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0,
+ "Force all devices to use non-posted = device memory");
+
#define = DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev))


static struct rman mem_rman;
@@ -373,7 +377,7 @@ = nexus_activate_resource_flags(device_t bus, device_t child, int type, = int rid,
{
struct resource_map_request args;
struct resource_map map;
- int err;
+ int = err, use_np;


if ((err =3D = rman_activate_resource(r)) !=3D 0)
return = (err);
@@ -386,7 +390,13 @@ = nexus_activate_resource_flags(device_t bus, device_t child, int type, = int rid,
case = SYS_RES_MEMORY:
if = ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) {
resource_init_map_request(&args);
- if ((flags & BUS_SPACE_MAP_NONPOSTED) = !=3D 0)
+ use_np =3D (flags = & BUS_SPACE_MAP_NONPOSTED) !=3D 0 ||
+ = force_np;
+ if (!use_np)
+ = resource_int_value(device_get_name(child),
+ = device_get_unit(child), "force_nonposted",
+ = &use_np);
+ if (use_np)
args.memattr =3D = VM_MEMATTR_DEVICE_NP;
err =3D = nexus_map_resource(bus, child, type, r, &args,
&map);

= --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE-- From nobody Mon Mar 20 12:10:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgD8B0W9Zz40dTB for ; Mon, 20 Mar 2023 12:10:18 +0000 (UTC) (envelope-from bT.m8ogh6xd30=95plzx7mf6bz=uxr0ggkrkp@return.smtpservice.net) Received: from e2i580.smtp2go.com (e2i580.smtp2go.com [103.2.142.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgD892cySz3Fs4 for ; Mon, 20 Mar 2023 12:10:17 +0000 (UTC) (envelope-from bT.m8ogh6xd30=95plzx7mf6bz=uxr0ggkrkp@return.smtpservice.net) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=mgy720.a1-4.dyn; x=1679315117; h=Feedback-ID: X-Smtpcorp-Track:To:Date:Subject:Message-Id:From:Reply-To:Sender: List-Unsubscribe; bh=m9jN/RjJBbWfIoQdE4lsVXgVLzFPr4LYfNGAjIsdoxk=; b=vRZMvHXR dl073ul6Oy4DMyyM5ZtquC5bQZletu6YcE+gB3D55nwvnapoCEcW5K/hCOSsZ372GJK/BMvZ/kwbC xMjM15esZXXN2+o/iJt+gWme1SzVTEoyKo9kHSclAPlZ3LUi89uQcP82pwiRw4Xf5z/OrdVrR++UN ffQVYVokOohFy46y45pvBn4RjyoAELFvuy2O+3Tioyz3YzVdt5oxFvlKPqLtUyN6ByoyvsOeNRFi/ m+IXW54tmg2RmE5XUjxMk1joCE4mr+dTFGjeKWSiYrkEqWErkv9Jq+GZwUGbvoPTrw9DRjRcRsDGe iJFVcAMZBBvfDfJVtj7wGFEI4g==; Received: from [10.176.58.103] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1peEL7-qt4L2Z-Cw; Mon, 20 Mar 2023 12:10:13 +0000 Received: from [10.162.55.164] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96-S2G) (envelope-from ) id 1peEL7-9EU25l-0K; Mon, 20 Mar 2023 12:10:13 +0000 Received: from smtpclient.apple (cpc91210-cmbg18-2-0-cust37.5-4.cable.virginm.net [81.102.44.38]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id 668E02950B; Mon, 20 Mar 2023 12:10:12 +0000 (UTC) From: Andrew Turner Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 Date: Mon, 20 Mar 2023 12:10:00 +0000 In-Reply-To: <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> Cc: "" , "" , "" To: Ravi Pokala References: <202303161646.32GGkArS022254@gitrepo.freebsd.org> <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Smtpcorp-Track: 1p-EL79El25_0K.GJ0nFFw7JPjDd Feedback-ID: 790814m:790814amQcrys:790814s_u8mx-IzT X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Rspamd-Queue-Id: 4PgD892cySz3Fs4 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:103.2.140.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 That should now be fixed. Andrew > On 20 Mar 2023, at 06:22, Ravi Pokala wrote: >=20 > Hi Andrew, >=20 > This breaks arm64.LINT-FDT: >=20 > | >>> stage 3.1: building everything > | -------------------------------------------------------------- > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: = error: expected identifier > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support implicit int [-Werror,-Wimplicit-int] > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | int > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: = warning: a function declaration without a prototype is deprecated in all = versions of C [-Wstrict-prototypes] > | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > | ^ > | 1 warning and 2 errors generated. > | --- nexus.o --- > | *** [nexus.o] Error code 1 > |=20 > | make[5]: stopped in = /build/usr/home/rpokala/freebsd/src/clean-main/arm64.aarch64/sys/LINT-FDT >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 > =EF=BB=BF-----Original Message----- > From: = > on behalf of Andrew Turner = = > > Date: Thursday, March 16, 2023 at 09:46 > To: = >, >, = > > Subject: git: f7acb7ed41f2 - main - Allow forcing non-posted memory on = arm64 >=20 >=20 > The branch main has been updated by andrew: >=20 >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e04791b= a5ceaf13 = > >=20 >=20 > commit f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 > Author: Andrew Turner = > > AuthorDate: 2023-03-16 15:35:59 +0000 > Commit: Andrew Turner = > > CommitDate: 2023-03-16 16:45:42 +0000 >=20 >=20 > Allow forcing non-posted memory on arm64 >=20 >=20 > To allow for debugging after changing the arm64 VM_MEMATTR_DEVICE > memory type add a new set of tunables to tell the kernel to use > non-posted memory. >=20 >=20 > This adds the following tunables: > - kern.force_nonposted: When set to non-zero the kernel will use > non-posted memory for all device allocations. > - hint...force_nonposted: As above, however only forces > non-posted memory on the named device. >=20 >=20 > Sponsored by: Arm Ltd > Differential Revision: https://reviews.freebsd.org/D38944 = > --- > sys/arm64/arm64/nexus.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) >=20 >=20 > diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c > index 3d6519f5fedd..0c06736f4e66 100644 > --- a/sys/arm64/arm64/nexus.c > +++ b/sys/arm64/arm64/nexus.c > @@ -83,6 +83,10 @@ struct nexus_device { > struct resource_list nx_resources; > }; >=20 >=20 > +static int force_np; > +SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0, > + "Force all devices to use non-posted device memory"); > + > #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) >=20 >=20 > static struct rman mem_rman; > @@ -373,7 +377,7 @@ nexus_activate_resource_flags(device_t bus, = device_t child, int type, int rid, > { > struct resource_map_request args; > struct resource_map map; > - int err; > + int err, use_np; >=20 >=20 > if ((err =3D rman_activate_resource(r)) !=3D 0) > return (err); > @@ -386,7 +390,13 @@ nexus_activate_resource_flags(device_t bus, = device_t child, int type, int rid, > case SYS_RES_MEMORY: > if ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) { > resource_init_map_request(&args); > - if ((flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0) > + use_np =3D (flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0 || > + force_np; > + if (!use_np) > + resource_int_value(device_get_name(child), > + device_get_unit(child), "force_nonposted", > + &use_np); > + if (use_np) > args.memattr =3D VM_MEMATTR_DEVICE_NP; > err =3D nexus_map_resource(bus, child, type, r, &args, > &map); --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 That should = now be fixed.

Andrew

On 20 Mar 2023, at 06:22, Ravi Pokala = <rpokala@freebsd.org> wrote:

Hi Andrew,

This = breaks arm64.LINT-FDT:

| = >>> stage 3.1: building everything
| = --------------------------------------------------------------
| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: = error: expected identifier
| = SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0,
| =             &n= bsp;           &nbs= p;            =             &n= bsp;          ^| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support implicit int [-Werror,-Wimplicit-int]
| SYSCTL_INT(_kern, OID_AUTO, = force_nonposted, CTLFLAG_RDTUN, &force_np, 0,
| ^
| = int
| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: = warning: a function declaration without a prototype is deprecated in all = versions of C [-Wstrict-prototypes]
| = SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0,
| =           ^
| 1 warning and 2 errors = generated.
| --- nexus.o = ---
| *** [nexus.o] Error = code 1
| 
| make[5]: stopped in = /build/usr/home/rpokala/freebsd/src/clean-main/arm64.aarch64/sys/LINT-FDT<= /span>

Thanks,

Ravi (rpokala@)

=EF=BB=BF-----Original = Message-----
From: <owner-src-committers@freebsd.org <mailto:owner-src-committers@freebsd.org>> on behalf of Andrew Turner = <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
Date: = Thursday, March 16, 2023 at 09:46
To: = <src-committers@FreeBSD.org <mailto:src-committers@FreeBSD.org>>, <dev-commits-src-all@FreeBSD.org<mailto:dev-commits-src-all@FreeBSD.org>>, <dev-commits-src-main@FreeBSD.org <mailto:dev-commits-src-main@FreeBSD.org>>
Subject: git: f7acb7ed41f2 - main - Allow forcing = non-posted memory on arm64


The = branch main has been updated by andrew:


URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13<https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13>


commit = f7acb7ed41f229a050b2d5e35e04791ba5ceaf13
Author: = Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
AuthorDate: 2023-03-16 15:35:59 +0000
Commit: Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
CommitDate: 2023-03-16 16:45:42 +0000


Allow forcing non-posted memory on = arm64


To allow for debugging = after changing the arm64 VM_MEMATTR_DEVICE
memory = type add a new set of tunables to tell the kernel to use
non-posted memory.


This adds the following tunables:
- kern.force_nonposted: When set to = non-zero the kernel will use
non-posted memory for all device allocations.
- = hint.<dev>.<unit>.force_nonposted: As above, however only = forces
non-posted memory on the = named device.


Sponsored by: Arm = Ltd
Differential = Revision: https://reviews.freebsd.org/D38944 <https://reviews.freebsd.org/D38944>
---
sys/arm64/arm64/nexus.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 = deletions(-)


diff --git = a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c
index 3d6519f5fedd..0c06736f4e66 = 100644
--- = a/sys/arm64/arm64/nexus.c
+++ = b/sys/arm64/arm64/nexus.c
@@ = -83,6 +83,10 @@ struct nexus_device {
struct = resource_list nx_resources;
};


+static = int force_np;
+SYSCTL_INT(_kern, = OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0,
+ "Force all devices to use non-posted = device memory");
+
#define = DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev))


static struct rman mem_rman;
@@ -373,7 +377,7 @@ = nexus_activate_resource_flags(device_t bus, device_t child, int type, = int rid,
{
struct resource_map_request args;
struct resource_map map;
- int err;
+ int = err, use_np;


if ((err =3D = rman_activate_resource(r)) !=3D 0)
return = (err);
@@ -386,7 +390,13 @@ = nexus_activate_resource_flags(device_t bus, device_t child, int type, = int rid,
case = SYS_RES_MEMORY:
if = ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) {
resource_init_map_request(&args);
- if ((flags & BUS_SPACE_MAP_NONPOSTED) = !=3D 0)
+ use_np =3D (flags = & BUS_SPACE_MAP_NONPOSTED) !=3D 0 ||
+ = force_np;
+ if (!use_np)
+ = resource_int_value(device_get_name(child),
+ = device_get_unit(child), "force_nonposted",
+ = &use_np);
+ if (use_np)
args.memattr =3D = VM_MEMATTR_DEVICE_NP;
err =3D = nexus_map_resource(bus, child, type, r, &args,
&map);

= --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE-- From nobody Mon Mar 20 13:35:33 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgG2Z074wz40kJW; Mon, 20 Mar 2023 13:35: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 4PgG2Y6cFBz3QVm; Mon, 20 Mar 2023 13:35:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679319333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cu7+ret/BosDkkXz1bLq/F0vtYa1cSl++OUKvR+bYAU=; b=Vu0FyBj2VE4Q/J84iUDe37DR2zW4V6RPHvhXBwH/Z0Fie27n/O6tPH+Wsli7m0as+IZQ8g OgamulefxVHigQBpyE0pw8escLsz08wQdX4iztEPRWNpyLAXF9etgKDL1WmVZivXCcdTYg xbTj9yuq70T0/qcNKPRkrLP601A165mMWKfvONcPipZX4WA0+W7AnGbsANVNjHtwzOzo/5 rlebZ0Rg3yDP0CjSEdB6wW+V2jyiGndYhOlco54jNp+Y8SK2zc85ThG1T8A8g5nlhZZuLP ak4yLTm2gcouMl5pYN4zjsFwz0aLNsk6BL91Ar+UI5GyhAU5Z2I20PqV3jHxGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679319333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cu7+ret/BosDkkXz1bLq/F0vtYa1cSl++OUKvR+bYAU=; b=jER5E6wOMl6BiflloXJuEfY6uw15SZ6+nQmNrAxS6GfnGjoCvarRXOaHvZsitEfFE0WOv6 HbjSuG/27ii5+2MOtuXsUD7jpmQwTkFL8+D+kDpp0XaSS+feAIAeKYUlklmpTIKhpvBxPG 57prGq1FZgNWpQiuPwTVvqbLM9hXeG0ErXJ2Bv74rLUMJ3bU5Du6GHdt3PJ/Pvi4sThPwj 9oPILlqKG8ihnxtVTlKHoTJDBs++IEU5k1/hTIF0aYgaIvy6633Bzc2V+lkKCqRMw4Ntzg KrVV2yz5nCnAZHoGkvaA+zl3bwUNYXRgg+0f1nyGUNIP1xsXuUbnrreIGx5MFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679319333; a=rsa-sha256; cv=none; b=eGYAMLSfsBd48nawkzasQtK2Q+CmkGdJhWlWbom6yKo3es8i4Cl6LHy7GvYe+SLcTiad2p yzxN8rXgwk84wC7WcEYKL+EZedxjSUyS1IzGvwbC1ecF6/qQ8Oi8EEumulWBJ57f3Szq47 gtvuacYXT7RcGbR0T6QxOLk9lfu9uIW11SINc9ObbpjIik7kgbzkPIWxVL2syd7Fa8q0x+ sVUnNS9bg1JY2zqI5aDUa6Wm1Qp+kKm27a+vIncZ1VFq4JBB8sz70lsbwBtEIz/Fpzclbq MoL0sQyTV4mGq7ui+PT/t1w9sVNlMt8wBnoKxTdQbxbGMwW2x7ph7+UtX86vCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgG2Y5gxJzXLG; Mon, 20 Mar 2023 13:35: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 32KDZX4L074101; Mon, 20 Mar 2023 13:35:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KDZXI5074100; Mon, 20 Mar 2023 13:35:33 GMT (envelope-from git) Date: Mon, 20 Mar 2023 13:35:33 GMT Message-Id: <202303201335.32KDZXI5074100@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: 3afba490c126 - main - libdtrace: fix indendation in dt_printd() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3afba490c1266200e9fd899f2494aa47f71c6095 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3afba490c1266200e9fd899f2494aa47f71c6095 commit 3afba490c1266200e9fd899f2494aa47f71c6095 Author: Christos Margiolis AuthorDate: 2023-03-20 13:34:20 +0000 Commit: Mark Johnston CommitDate: 2023-03-20 13:34:20 +0000 libdtrace: fix indendation in dt_printd() No functional change. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39145 --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c index f028f99ccf64..2b85dd2b26b6 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c @@ -4767,8 +4767,8 @@ dt_printd(dt_node_t *dnp, FILE *fp, int depth) dt_printd(dnp->dn_pred, fp, 0); (void) fprintf(fp, "/\n"); } - (void) fprintf(fp, "{\n"); + (void) fprintf(fp, "{\n"); for (arg = dnp->dn_acts; arg != NULL; arg = arg->dn_list) dt_printd(arg, fp, depth + 1); (void) fprintf(fp, "}\n"); From nobody Mon Mar 20 14:14:24 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgGvN68hpz3ymyf; Mon, 20 Mar 2023 14:14: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 4PgGvN5tkwz3k6W; Mon, 20 Mar 2023 14:14:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wM/kAN+tFYUf/yQgqPuHQo/Ml+sw8R89ilxCp3zgheo=; b=D2gX+k0Ii781+YfIv0DJNHJ/MJ7xP1MfZWrqL7qjs5sPzdZfJMSYjzMF9DVsrvHjHqtwPF EBpg1J6rB1nVtx1MX4Aaqs/3WgZz+mp3+2AULgIKIeyGs0ZRO2KzLmiJpLw7+0LWHSPJS5 T91fmm2iLCaQBRc1bf1BNuv0b5kHOqeMbJL2INE98lqPjs4QbAapHU9ai21vUOVczEaBN4 y1wDWRbAM67oEco9w4Jc0B3jsH5mrw8CjyyFe/gieTMNn+tf7TGw99o9aHaXHYFdq3nSSk 9ICQg9PChPAml4cDKSYEGikjHcazTxV5SJpJc3D020VxsTNHR2k+7hjgzRzSMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wM/kAN+tFYUf/yQgqPuHQo/Ml+sw8R89ilxCp3zgheo=; b=VMoLXTpniMmoDJgRaiJtHDNnYaNZHC4WUR1Nvn2ZNOou9dncFnDA4Vxz3lBRe0epLRBhpX 538tG+K0fgPI0KITZX9FsLuQl0JRylKm/9UrYjqxuVqxvRmQtaReKjoQBTt39YOVVoAvnv zOX68+UNlMDl6mPGc3gDydCJo9WKQUaR6vq5FJ+x7bjw9svTxbmcHkGZ4iOWsXZAEPJF2k +WuXKBWqnk3XZroYmmw1WOWvu2YQUpPAhA8ST0pEGuBy3tLT43azfqWt4o5+pcMCvmJMeS y0iBKQOE0CCqBE/F4kII1tuB2KrYfbvx9rR7Qk/qJxR6Id9hdwI4z9yq35/wHA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679321664; a=rsa-sha256; cv=none; b=iIl0q685ihfdIASBKCZFXqv4MFP2/dvJAGJw4SNOyxqDS7Naiggojj74DleTQVd0F+Cp0A 0Grd3wM8mNUy5nfWQLQtTwFrzX8ekE/Wj7rEFqGOYeoKbZAYTnzq8sLDJu69hTKdOWeNKn zJUfHkzBfi1ww/x3eH9R1voQIBlRcokLykwZKuyEtEHtJp66O9DSEykBlTeVhWSHVoodXm gDrD1s0fKJcaxLPg7Qex+PoFv1CfyoH/oz/vI19yOlnbe+/C5DL338EnIXfb/e/b1xXTO4 4dUTB/wrWkMNFNAJNG4+xLbREeMI5lD0RHS4xxdJiDkRWeXDU5gVlbGRwZReew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgGvN4xBbzYMB; Mon, 20 Mar 2023 14:14: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 32KEEOBx039812; Mon, 20 Mar 2023 14:14:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEEOgC039811; Mon, 20 Mar 2023 14:14:24 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:14:24 GMT Message-Id: <202303201414.32KEEOgC039811@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: 137818006de5 - main - carp: support unicast List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 137818006de5bb0be0b6562a0d601977f85c6867 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=137818006de5bb0be0b6562a0d601977f85c6867 commit 137818006de5bb0be0b6562a0d601977f85c6867 Author: Kristof Provost AuthorDate: 2023-03-15 12:31:45 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 13:37:09 +0000 carp: support unicast Allow users to configure the address to send carp messages to. This allows carp to be used in unicast mode, which is useful in certain virtual configurations (e.g. AWS, VMWare ESXi, ...) Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38940 --- lib/libifconfig/libifconfig.h | 2 + lib/libifconfig/libifconfig_carp.c | 7 +++ sbin/ifconfig/carp.c | 63 +++++++++++++++++++ sys/netinet/ip_carp.c | 117 ++++++++++++++++++++++++----------- sys/netinet/ip_carp_nl.h | 2 + sys/netlink/netlink_message_parser.c | 25 ++++++++ sys/netlink/netlink_message_parser.h | 4 ++ sys/netlink/netlink_message_writer.c | 14 +++++ sys/netlink/netlink_message_writer.h | 7 +++ sys/netlink/netlink_snl.h | 1 - sys/netlink/netlink_snl_route.h | 23 +++++++ 11 files changed, 229 insertions(+), 36 deletions(-) diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 64a61af0708c..861d2bc93f80 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -287,6 +287,8 @@ struct ifconfig_carp { int32_t carpr_advbase; int32_t carpr_advskew; uint8_t carpr_key[CARP_KEY_LEN]; + struct in_addr carpr_addr; + struct in6_addr carpr_addr6; }; int ifconfig_carp_get_vhid(ifconfig_handle_t *h, const char *name, diff --git a/lib/libifconfig/libifconfig_carp.c b/lib/libifconfig/libifconfig_carp.c index ffc497590aaa..5729362ffef9 100644 --- a/lib/libifconfig/libifconfig_carp.c +++ b/lib/libifconfig/libifconfig_carp.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,8 @@ static struct snl_attr_parser ap_carp_get[] = { { .type = CARP_NL_ADVBASE, .off = _OUT(carpr_advbase), .cb = snl_attr_get_int32 }, { .type = CARP_NL_ADVSKEW, .off = _OUT(carpr_advskew), .cb = snl_attr_get_int32 }, { .type = CARP_NL_KEY, .off = _OUT(carpr_key), .cb = snl_attr_get_string }, + { .type = CARP_NL_ADDR, .off = _OUT(carpr_addr), .cb = snl_attr_get_in_addr }, + { .type = CARP_NL_ADDR6, .off = _OUT(carpr_addr6), .cb = snl_attr_get_in6_addr }, }; #undef _OUT @@ -181,6 +184,10 @@ ifconfig_carp_set_info(ifconfig_handle_t *h, const char *name, snl_add_msg_attr_s32(&nw, CARP_NL_ADVBASE, carpr->carpr_advbase); snl_add_msg_attr_s32(&nw, CARP_NL_ADVSKEW, carpr->carpr_advskew); snl_add_msg_attr_u32(&nw, CARP_NL_IFINDEX, ifindex); + snl_add_msg_attr(&nw, CARP_NL_ADDR, sizeof(carpr->carpr_addr), + &carpr->carpr_addr); + snl_add_msg_attr(&nw, CARP_NL_ADDR6, sizeof(carpr->carpr_addr6), + &carpr->carpr_addr6); hdr = snl_finalize_msg(&nw); if (hdr == NULL) { diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index 3fa6f3ac269d..0dc3facdaf79 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -42,13 +42,17 @@ #include #include +#include + #include +#include #include #include #include #include #include #include +#include #include @@ -67,12 +71,15 @@ static int carpr_vhid = -1; static int carpr_advskew = -1; static int carpr_advbase = -1; static int carpr_state = -1; +static struct in_addr carp_addr; +static struct in6_addr carp_addr6; static unsigned char const *carpr_key; static void carp_status(int s) { struct ifconfig_carp carpr[CARP_MAXVHID]; + char addr_buf[NI_MAXHOST]; if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) return; @@ -85,6 +92,12 @@ carp_status(int s) printf(" key \"%s\"\n", carpr[i].carpr_key); else printf("\n"); + + inet_ntop(AF_INET6, &carpr[i].carpr_addr6, addr_buf, + sizeof(addr_buf)); + + printf("\t peer %s peer6 %s\n", + inet_ntoa(carpr[i].carpr_addr), addr_buf); } } @@ -146,6 +159,11 @@ setcarp_callback(int s, void *arg __unused) carpr.carpr_advbase = carpr_advbase; if (carpr_state > -1) carpr.carpr_state = carpr_state; + if (carp_addr.s_addr != INADDR_ANY) + carpr.carpr_addr = carp_addr; + if (! IN6_IS_ADDR_UNSPECIFIED(&carp_addr6)) + memcpy(&carpr.carpr_addr6, &carp_addr6, + sizeof(carp_addr6)); if (ifconfig_carp_set_info(lifh, name, &carpr)) err(1, "SIOCSVH"); @@ -198,12 +216,53 @@ setcarp_state(const char *val, int d, int s, const struct afswtch *afp) errx(1, "unknown state"); } +static void +setcarp_peer(const char *val, int d, int s, const struct afswtch *afp) +{ + carp_addr.s_addr = inet_addr(val); +} + +static void +setcarp_mcast(const char *val, int d, int s, const struct afswtch *afp) +{ + carp_addr.s_addr = htonl(INADDR_CARP_GROUP); +} + +static void +setcarp_peer6(const char *val, int d, int s, const struct afswtch *afp) +{ + struct addrinfo hints, *res; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET6; + hints.ai_flags = AI_NUMERICHOST; + + if (getaddrinfo(val, NULL, &hints, &res) == 1) + errx(1, "Invalid IPv6 address %s", val); + + memcpy(&carp_addr6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, + sizeof(carp_addr6)); +} + +static void +setcarp_mcast6(const char *val, int d, int s, const struct afswtch *afp) +{ + bzero(&carp_addr6, sizeof(carp_addr6)); + carp_addr6.s6_addr[0] = 0xff; + carp_addr6.s6_addr[1] = 0x02; + carp_addr6.s6_addr[15] = 0x12; +} + static struct cmd carp_cmds[] = { DEF_CMD_ARG("advbase", setcarp_advbase), DEF_CMD_ARG("advskew", setcarp_advskew), DEF_CMD_ARG("pass", setcarp_passwd), DEF_CMD_ARG("vhid", setcarp_vhid), DEF_CMD_ARG("state", setcarp_state), + DEF_CMD_ARG("peer", setcarp_peer), + DEF_CMD_ARG("mcast", setcarp_mcast), + DEF_CMD_ARG("peer6", setcarp_peer6), + DEF_CMD_ARG("mcast6", setcarp_mcast6), }; static struct afswtch af_carp = { .af_name = "af_carp", @@ -216,6 +275,10 @@ carp_ctor(void) { int i; + /* Default to multicast. */ + setcarp_mcast(NULL, 0, 0, NULL); + setcarp_mcast6(NULL, 0, 0, NULL); + for (i = 0; i < nitems(carp_cmds); i++) cmd_register(&carp_cmds[i]); af_register(&af_carp); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 78bc6d312abb..2219e00140b1 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -110,6 +110,8 @@ struct carp_softc { int sc_vhid; int sc_advskew; int sc_advbase; + struct in_addr sc_carpaddr; + struct in6_addr sc_carpaddr6; int sc_naddrs; int sc_naddrs6; @@ -154,6 +156,20 @@ struct carp_if { #define CIF_PROMISC 0x00000001 }; +/* Kernel equivalent of struct carpreq, but with more fields for new features. + * */ +struct carpkreq { + int carpr_count; + int carpr_vhid; + int carpr_state; + int carpr_advskew; + int carpr_advbase; + unsigned char carpr_key[CARP_KEY_LEN]; + /* Everything above this is identical to carpreq */ + struct in_addr carpr_addr; + struct in6_addr carpr_addr6; +}; + /* * Brief design of carp(4). * @@ -310,7 +326,7 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID_AUTO, stats, struct carpstats, (((sc)->sc_advskew + V_carp_demotion < 0) ? \ 0 : ((sc)->sc_advskew + V_carp_demotion))) -static void carp_input_c(struct mbuf *, struct carp_header *, sa_family_t); +static void carp_input_c(struct mbuf *, struct carp_header *, sa_family_t, int); static struct carp_softc *carp_alloc(struct ifnet *); static void carp_destroy(struct carp_softc *); @@ -488,16 +504,6 @@ carp_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } - /* verify that the IP TTL is 255. */ - if (ip->ip_ttl != CARP_DFLTTL) { - CARPSTATS_INC(carps_badttl); - CARP_DEBUG("%s: received ttl %d != 255 on %s\n", __func__, - ip->ip_ttl, - m->m_pkthdr.rcvif->if_xname); - m_freem(m); - return (IPPROTO_DONE); - } - iplen = ip->ip_hl << 2; if (m->m_pkthdr.len < iplen + sizeof(*ch)) { @@ -551,7 +557,7 @@ carp_input(struct mbuf **mp, int *offp, int proto) } m->m_data -= iplen; - carp_input_c(m, ch, AF_INET); + carp_input_c(m, ch, AF_INET, ip->ip_ttl); return (IPPROTO_DONE); } #endif @@ -581,15 +587,6 @@ carp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } - /* verify that the IP TTL is 255 */ - if (ip6->ip6_hlim != CARP_DFLTTL) { - CARPSTATS_INC(carps_badttl); - CARP_DEBUG("%s: received ttl %d != 255 on %s\n", __func__, - ip6->ip6_hlim, m->m_pkthdr.rcvif->if_xname); - m_freem(m); - return (IPPROTO_DONE); - } - /* verify that we have a complete carp packet */ if (m->m_len < *offp + sizeof(*ch)) { len = m->m_len; @@ -599,6 +596,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto) CARP_DEBUG("%s: packet size %u too small\n", __func__, len); return (IPPROTO_DONE); } + ip6 = mtod(m, struct ip6_hdr *); } ch = (struct carp_header *)(mtod(m, char *) + *offp); @@ -613,7 +611,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto) } m->m_data -= *offp; - carp_input_c(m, ch, AF_INET6); + carp_input_c(m, ch, AF_INET6, ip6->ip6_hlim); return (IPPROTO_DONE); } #endif /* INET6 */ @@ -664,7 +662,7 @@ carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af) } static void -carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) +carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl) { struct ifnet *ifp = m->m_pkthdr.rcvif; struct ifaddr *ifa, *match; @@ -672,6 +670,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) uint64_t tmp_counter; struct timeval sc_tv, ch_tv; int error; + bool multicast = false; NET_EPOCH_ASSERT(); @@ -724,8 +723,21 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) sc = ifa->ifa_carp; CARP_LOCK(sc); + if (ifa->ifa_addr->sa_family == AF_INET) { + multicast = IN_MULTICAST(sc->sc_carpaddr.s_addr); + } else { + multicast = IN6_IS_ADDR_MULTICAST(&sc->sc_carpaddr6); + } ifa_free(ifa); + /* verify that the IP TTL is 255, but only if we're not in unicast mode. */ + if (multicast && ttl != CARP_DFLTTL) { + CARPSTATS_INC(carps_badttl); + CARP_DEBUG("%s: received ttl %d != 255 on %s\n", __func__, + ttl, m->m_pkthdr.rcvif->if_xname); + goto out; + } + if (carp_hmac_verify(sc, ch->carp_counter, ch->carp_md)) { CARPSTATS_INC(carps_badauth); CARP_DEBUG("%s: incorrect hash for VHID %u@%s\n", __func__, @@ -978,7 +990,8 @@ carp_send_ad_locked(struct carp_softc *sc) m->m_pkthdr.rcvif = NULL; m->m_len = len; M_ALIGN(m, m->m_len); - m->m_flags |= M_MCAST; + if (IN_MULTICAST(sc->sc_carpaddr.s_addr)) + m->m_flags |= M_MCAST; ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; @@ -997,7 +1010,7 @@ carp_send_ad_locked(struct carp_softc *sc) ifa_free(ifa); } else ip->ip_src.s_addr = 0; - ip->ip_dst.s_addr = htonl(INADDR_CARP_GROUP); + ip->ip_dst = sc->sc_carpaddr; ch_ptr = (struct carp_header *)(&ip[1]); bcopy(&ch, ch_ptr, sizeof(ch)); @@ -1028,7 +1041,6 @@ carp_send_ad_locked(struct carp_softc *sc) m->m_pkthdr.rcvif = NULL; m->m_len = len; M_ALIGN(m, m->m_len); - m->m_flags |= M_MCAST; ip6 = mtod(m, struct ip6_hdr *); bzero(ip6, sizeof(*ip6)); ip6->ip6_vfc |= IPV6_VERSION; @@ -1050,12 +1062,13 @@ carp_send_ad_locked(struct carp_softc *sc) bzero(&ip6->ip6_src, sizeof(struct in6_addr)); /* Set the multicast destination. */ - ip6->ip6_dst.s6_addr16[0] = htons(0xff02); - ip6->ip6_dst.s6_addr8[15] = 0x12; - if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) { - m_freem(m); - CARP_DEBUG("%s: in6_setscope failed\n", __func__); - goto resched; + memcpy(&ip6->ip6_dst, &sc->sc_carpaddr6, sizeof(ip6->ip6_dst)); + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) { + m_freem(m); + CARP_DEBUG("%s: in6_setscope failed\n", __func__); + goto resched; + } } ch_ptr = (struct carp_header *)(&ip6[1]); @@ -1571,6 +1584,19 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa) bcopy(mtag + 1, &sc, sizeof(sc)); + switch (sa->sa_family) { + case AF_INET: + if (! IN_MULTICAST(sc->sc_carpaddr.s_addr)) + return (0); + break; + case AF_INET6: + if (! IN6_IS_ADDR_MULTICAST(&sc->sc_carpaddr6)) + return (0); + break; + default: + panic("Unknown af"); + } + /* Set the source MAC address to the Virtual Router MAC Address. */ switch (ifp->if_type) { case IFT_ETHER: @@ -1618,6 +1644,10 @@ carp_alloc(struct ifnet *ifp) sc->sc_ifas = malloc(sc->sc_ifasiz, M_CARP, M_WAITOK|M_ZERO); sc->sc_carpdev = ifp; + sc->sc_carpaddr.s_addr = htonl(INADDR_CARP_GROUP); + sc->sc_carpaddr6.s6_addr16[0] = IPV6_ADDR_INT16_MLL; + sc->sc_carpaddr6.s6_addr8[15] = 0x12; + CARP_LOCK_INIT(sc); #ifdef INET callout_init_mtx(&sc->sc_md_tmo, &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); @@ -1753,7 +1783,7 @@ carp_carprcp(void *arg, struct carp_softc *sc, int priv) } static int -carp_ioctl_set(if_t ifp, struct carpreq *carpr) +carp_ioctl_set(if_t ifp, struct carpkreq *carpr) { struct epoch_tracker et; struct carp_softc *sc = NULL; @@ -1795,6 +1825,12 @@ carp_ioctl_set(if_t ifp, struct carpreq *carpr) goto out; } sc->sc_advskew = carpr->carpr_advskew; + if (carpr->carpr_addr.s_addr != INADDR_ANY) + sc->sc_carpaddr = carpr->carpr_addr; + if (! IN6_IS_ADDR_UNSPECIFIED(&carpr->carpr_addr6)) { + memcpy(&sc->sc_carpaddr6, &carpr->carpr_addr6, + sizeof(sc->sc_carpaddr6)); + } if (carpr->carpr_key[0] != '\0') { bcopy(carpr->carpr_key, sc->sc_key, sizeof(sc->sc_key)); carp_hmac_prepare(sc); @@ -1875,6 +1911,7 @@ int carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) { struct carpreq carpr; + struct carpkreq carprk = { }; struct ifnet *ifp; int error = 0; @@ -1896,7 +1933,8 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) if ((error = priv_check(td, PRIV_NETINET_CARP))) break; - error = carp_ioctl_set(ifp, &carpr); + memcpy(&carprk, &carpr, sizeof(carpr)); + error = carp_ioctl_set(ifp, &carprk); break; case SIOCGVH: @@ -2243,6 +2281,8 @@ carp_nl_send(void *arg, struct carp_softc *sc, int priv) nlattr_add_u32(nw, CARP_NL_STATE, sc->sc_state); nlattr_add_s32(nw, CARP_NL_ADVBASE, sc->sc_advbase); nlattr_add_s32(nw, CARP_NL_ADVSKEW, sc->sc_advskew); + nlattr_add_in_addr(nw, CARP_NL_ADDR, &sc->sc_carpaddr); + nlattr_add_in6_addr(nw, CARP_NL_ADDR6, &sc->sc_carpaddr6); if (priv) nlattr_add(nw, CARP_NL_KEY, sizeof(sc->sc_key), sc->sc_key); @@ -2264,6 +2304,8 @@ struct nl_carp_parsed { int32_t advbase; int32_t advskew; char key[CARP_KEY_LEN]; + struct in_addr addr; + struct in6_addr addr6; }; #define _IN(_field) offsetof(struct genlmsghdr, _field) @@ -2276,6 +2318,8 @@ static const struct nlattr_parser nla_p_set[] = { { .type = CARP_NL_ADVSKEW, .off = _OUT(advskew), .cb = nlattr_get_uint32 }, { .type = CARP_NL_KEY, .off = _OUT(key), .cb = nlattr_get_carp_key }, { .type = CARP_NL_IFINDEX, .off = _OUT(ifindex), .cb = nlattr_get_uint32 }, + { .type = CARP_NL_ADDR, .off = _OUT(addr), .cb = nlattr_get_in_addr }, + { .type = CARP_NL_ADDR6, .off = _OUT(addr6), .cb = nlattr_get_in6_addr }, }; static const struct nlfield_parser nlf_p_set[] = { }; @@ -2331,7 +2375,7 @@ static int carp_nl_set(struct nlmsghdr *hdr, struct nl_pstate *npt) { struct nl_carp_parsed attrs = { }; - struct carpreq carpr; + struct carpkreq carpr; struct epoch_tracker et; if_t ifp; int error; @@ -2368,6 +2412,9 @@ carp_nl_set(struct nlmsghdr *hdr, struct nl_pstate *npt) carpr.carpr_state = attrs.state; carpr.carpr_advbase = attrs.advbase; carpr.carpr_advskew = attrs.advskew; + carpr.carpr_addr = attrs.addr; + carpr.carpr_addr6 = attrs.addr6; + memcpy(&carpr.carpr_key, &attrs.key, sizeof(attrs.key)); sx_xlock(&carp_sx); diff --git a/sys/netinet/ip_carp_nl.h b/sys/netinet/ip_carp_nl.h index ffb7c1ef5aae..60e8c569a05d 100644 --- a/sys/netinet/ip_carp_nl.h +++ b/sys/netinet/ip_carp_nl.h @@ -29,6 +29,8 @@ enum carp_nl_type_t { CARP_NL_ADVSKEW = 4, /* s32 */ CARP_NL_KEY = 5, /* byte array */ CARP_NL_IFINDEX = 6, /* u32 */ + CARP_NL_ADDR = 7, /* in_addr_t */ + CARP_NL_ADDR6 = 8, /* in6_addr_t */ }; #endif diff --git a/sys/netlink/netlink_message_parser.c b/sys/netlink/netlink_message_parser.c index e30138266d9d..d0aaf4301872 100644 --- a/sys/netlink/netlink_message_parser.c +++ b/sys/netlink/netlink_message_parser.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -349,6 +350,30 @@ nlattr_get_uint64(struct nlattr *nla, struct nl_pstate *npt, const void *arg, vo return (0); } +int +nlattr_get_in_addr(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target) +{ + if (__predict_false(NLA_DATA_LEN(nla) != sizeof(in_addr_t))) { + NLMSG_REPORT_ERR_MSG(npt, "nla type %d size(%u) is not in_addr_t", + nla->nla_type, NLA_DATA_LEN(nla)); + return (EINVAL); + } + memcpy(target, NLA_DATA_CONST(nla), sizeof(in_addr_t)); + return (0); +} + +int +nlattr_get_in6_addr(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target) +{ + if (__predict_false(NLA_DATA_LEN(nla) != sizeof(struct in6_addr))) { + NLMSG_REPORT_ERR_MSG(npt, "nla type %d size(%u) is not struct in6_addr", + nla->nla_type, NLA_DATA_LEN(nla)); + return (EINVAL); + } + memcpy(target, NLA_DATA_CONST(nla), sizeof(struct in6_addr)); + return (0); +} + static int nlattr_get_ifp_internal(struct nlattr *nla, struct nl_pstate *npt, void *target, bool zero_ok) diff --git a/sys/netlink/netlink_message_parser.h b/sys/netlink/netlink_message_parser.h index 083c93dcbf8d..067d25dae7d8 100644 --- a/sys/netlink/netlink_message_parser.h +++ b/sys/netlink/netlink_message_parser.h @@ -175,6 +175,10 @@ int nlattr_get_uint32(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target); int nlattr_get_uint64(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target); +int nlattr_get_in_addr(struct nlattr *nla, struct nl_pstate *npt, + const void *arg, void *target); +int nlattr_get_in6_addr(struct nlattr *nla, struct nl_pstate *npt, + const void *arg, void *target); int nlattr_get_ifp(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target); int nlattr_get_ifpz(struct nlattr *nla, struct nl_pstate *npt, diff --git a/sys/netlink/netlink_message_writer.c b/sys/netlink/netlink_message_writer.c index 8a9315eedd1b..85cf5695643c 100644 --- a/sys/netlink/netlink_message_writer.c +++ b/sys/netlink/netlink_message_writer.c @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -686,3 +688,15 @@ nlmsg_end_dump(struct nl_writer *nw, int error, struct nlmsghdr *hdr) return (true); } + +bool +nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in) +{ + return (nlattr_add(nw, attrtype, sizeof(*in), in)); +} + +bool +nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6) +{ + return (nlattr_add(nw, attrtype, sizeof(*in6), in6)); +} diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h index 13acf5add559..2f007e9a2b14 100644 --- a/sys/netlink/netlink_message_writer.h +++ b/sys/netlink/netlink_message_writer.h @@ -30,6 +30,7 @@ #define _NETLINK_NETLINK_MESSAGE_WRITER_H_ #ifdef _KERNEL + /* * It is not meant to be included directly */ @@ -248,6 +249,12 @@ nlattr_add_s64(struct nl_writer *nw, int attrtype, int64_t value) return (nlattr_add(nw, attrtype, sizeof(int64_t), &value)); } +struct in_addr; +bool nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in); + +struct in6_addr; +bool nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6); + static inline bool nlattr_add_flag(struct nl_writer *nw, int attrtype) { diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 935012885362..399e1d6781c8 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -44,7 +44,6 @@ #include #include - #define _roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) #define NETLINK_ALIGN_SIZE sizeof(uint32_t) diff --git a/sys/netlink/netlink_snl_route.h b/sys/netlink/netlink_snl_route.h index e67bffde215e..3a80854c947c 100644 --- a/sys/netlink/netlink_snl_route.h +++ b/sys/netlink/netlink_snl_route.h @@ -163,4 +163,27 @@ snl_add_msg_attr_ipvia(struct snl_writer *nw, int attrtype, const struct sockadd return (false); } +static inline bool +snl_attr_get_in_addr(struct snl_state *ss __unused, struct nlattr *nla, + const void *arg __unused, void *target) +{ + if (NLA_DATA_LEN(nla) != sizeof(struct in_addr)) + return (false); + + memcpy(target, NLA_DATA_CONST(nla), sizeof(struct in_addr)); + return (true); +} + +static inline bool +snl_attr_get_in6_addr(struct snl_state *ss __unused, struct nlattr *nla, + const void *arg __unused, void *target) +{ + if (NLA_DATA_LEN(nla) != sizeof(struct in6_addr)) + return (false); + + memcpy(target, NLA_DATA_CONST(nla), sizeof(struct in6_addr)); + return (true); +} + + #endif From nobody Mon Mar 20 14:14:25 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgGvQ0bQQz3yn2W; Mon, 20 Mar 2023 14:14: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 4PgGvP71V5z3k8v; Mon, 20 Mar 2023 14:14:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MQmZhkSlJVI0sPmsTn4j4m/3n6QdCI6V57D+lJxsKeQ=; b=ea2liBj/mhrmJ6WSXTvLG9UR1bV0WPacouT1IfsTyuai8bbKdnTri9PGkofAR0HNQMsl14 JMpDbgTSipJcI5wszs20Pz/ETGAqcfFTZAglt49/AMqLN//snZdl4qwRrNgT6UOL2yg/za vouDBqBYfW0Pn6S72GUqZFNAO/KX6oJx954MF6OzpRwazthKGErzWgGx+cWDNfHni4nOkA N14YhEOX2VIDt5ygCqyEj630ft/0S7a7jxDk72WoiaK5M0qd5YoVnel4KQn5fjjkTt11Df ojo9bw7i35IClWdzH40Wb9cvDFGY3k1INx5tsJIo+b0OBbJvxhSOCOLo2WK3GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MQmZhkSlJVI0sPmsTn4j4m/3n6QdCI6V57D+lJxsKeQ=; b=jAexL5xPsgWf83nCGDIVLPCUOKWZI6PyTUrNyBajEJarsUDuYmLPXGHWDCDiZxdqDlhB5Z IWbcLJ+js9i5k6rzx4501Piw7MFc1ppm0bUOvgQwKfOw3NWprnWc9iXptoNebcs/hQ0X82 hg2svyMUP01f2k777G1JRMfxB7XfTrbZD3GaYkWfJ9jqgVqW81Vzwvf215Lwu+wXyG+K8C q+3IayFFUPM7kw0E+O1w5MjxpcaAd8+dyeoTQDSTYsxs1ZjJM1WLK7iDj9rLu7idEFCqZe ENXpyXKPxsDZiOFknnJi6hWXgtzS1FW8fHji3/B3VsAzYbhM6MsSg5EoA2HgIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679321666; a=rsa-sha256; cv=none; b=OzKgxQ6PnM1CzUNipp+TiMGZjlo2q6AdrGdcgVsue7AIGQXivrTIPOawKf+tPlHL8Oh4NE SZ2T6Ipp2+B30tnpZATWV1GDjI2LY2tY/UUgRPmOWgECApDC/NdXc9wGBUMCiJO5a03eIt 0nnXqOY4IwHVNrT9K7v2YQtz9SxEVo2Gu2r2uoeTODUKher1MAYkoS9fgMl0yPgzzBPqPW ZfocZ46TBWcpyMbno7lSrrQ6KCBiyWHqTzo3xBNxZWi551OueX+pfw7tKOXp3+c8s3VVX1 bwFITJURKJuwARFrXsqpQIUr9P43odXfhdkcITD+A/8qVzs1wq4JbhvstOT3GQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgGvP5JXxzYQJ; Mon, 20 Mar 2023 14:14: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 32KEEPAM039832; Mon, 20 Mar 2023 14:14:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEEP76039831; Mon, 20 Mar 2023 14:14:25 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:14:25 GMT Message-Id: <202303201414.32KEEP76039831@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: 92c5dbbb131b - main - carp tests: unicast tests (IPv4) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae commit 92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae Author: Kristof Provost AuthorDate: 2023-03-02 17:21:06 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 13:37:09 +0000 carp tests: unicast tests (IPv4) Test the new unicast carp mode for IPv4. There's a routing hop between the peers, to ensure that the TTL check is correctly disabled for unicast carp. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38941 --- tests/sys/netinet/carp.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index 9afe9d2ea8c1..22f1aa3ac0e3 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -106,6 +106,64 @@ basic_v4_cleanup() vnet_cleanup } + +atf_test_case "unicast_v4" "cleanup" +unicast_v4_head() +{ + atf_set descr 'Unicast CARP test (IPv4)' + atf_set require.user root +} + +unicast_v4_body() +{ + carp_init + + bridge=$(vnet_mkbridge) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail carp_uni_v4_one ${bridge} ${epair_one}a ${epair_two}a + vnet_mkjail carp_uni_v4_two ${epair_one}b + vnet_mkjail carp_uni_v4_three ${epair_two}b + + jexec carp_uni_v4_one ifconfig ${bridge} 192.0.2.4/29 up + jexec carp_uni_v4_one sysctl net.inet.ip.forwarding=1 + jexec carp_uni_v4_one ifconfig ${bridge} addm ${epair_one}a \ + addm ${epair_two}a + jexec carp_uni_v4_one ifconfig ${epair_one}a up + jexec carp_uni_v4_one ifconfig ${epair_two}a up + jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.1/25 + jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.129/25 + + jexec carp_uni_v4_two ifconfig ${epair_one}b 198.51.100.2/25 up + jexec carp_uni_v4_two route add default 198.51.100.1 + jexec carp_uni_v4_two ifconfig ${epair_one}b add vhid 1 \ + peer 198.51.100.130 192.0.2.1/29 + + jexec carp_uni_v4_three ifconfig ${epair_two}b 198.51.100.130/25 up + jexec carp_uni_v4_three route add default 198.51.100.129 + jexec carp_uni_v4_three ifconfig ${epair_two}b add vhid 1 \ + peer 198.51.100.2 192.0.2.1/29 + + # Sanity check + atf_check -s exit:0 -o ignore jexec carp_uni_v4_two \ + ping -c 1 198.51.100.130 + + wait_for_carp carp_uni_v4_two ${epair_one}b \ + carp_uni_v4_three ${epair_two}b + + atf_check -s exit:0 -o ignore jexec carp_uni_v4_one \ + ping -c 3 192.0.2.1 + + jexec carp_uni_v4_two ifconfig + jexec carp_uni_v4_three ifconfig +} + +unicast_v4_cleanup() +{ + vnet_cleanup +} + atf_test_case "basic_v6" "cleanup" basic_v6_head() { @@ -290,6 +348,7 @@ switch_cleanup() atf_init_test_cases() { atf_add_test_case "basic_v4" + atf_add_test_case "unicast_v4" atf_add_test_case "basic_v6" atf_add_test_case "negative_demotion" atf_add_test_case "nd6_ns_source_mac" From nobody Mon Mar 20 14:14:26 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgGvR1LqLz3ymx6; Mon, 20 Mar 2023 14:14: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 4PgGvQ6xnnz3kJP; Mon, 20 Mar 2023 14:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xrIJo6l0vk2Mpkh/4P57g3FzNrGLckA9anzChK0GWDM=; b=ajY3LKe3DcI5VHUJ1Jx1UijUIYV5sg2LU14JZuLOdP+l6xyoH6NosZIKh7nxxg3RhPaXe1 WJtZZ6qoh7TyeY66S7RBGz4a8qOylD9ldG6yDfszbkkNSmei3iRvoiX3sFjCFi3lm9/Y/D 7bh8sRqpywJVZaQKzT4d9v+m/BRSpa3HAU82VkGvFpC19i702l2qPJYEXoCzUM0C5/FMEz 4VMpGmYDHEAlrLJ+m3hc79PuedXFlsc98gnHPo50cA1DEjQXiXG+l+b0ofxnq/69fjMRWN JtRJzV3AJKMjsoHp06rWaFmez2pmwE2ZilpxgBEzA6WxawO3dxFbXWFy3d8DXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xrIJo6l0vk2Mpkh/4P57g3FzNrGLckA9anzChK0GWDM=; b=F3yh56FVFL2PUmK/cByrpw5Xxo428a1/1CgQgEj0SDwGY/l/Jjkec/P00JhU2U1PkAtVln U9/oigenXSlP/2ML10rZdBn7xwuEb2zxxWKu+R1iSZ7G4NlKfSQcGnLuVjsGzT400bwYD6 CMhOld6wkSVWE1qzb037yHvV/kdZW3RIYz4MUWgz05mtcebYPNcvOPo5y0YqJRPACtrMbN Z7//tLxetncEdXfnydt1/q9B7q4TEv0PYfVqzF/EIuBz5T0XT6644OIAoZCDZGNdjDGEPr W+byrClzh2ZtsdWomz9csFMcHaoUc6HhmVezJcVWqwYqBOZlL7UpcaANoQwmJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679321667; a=rsa-sha256; cv=none; b=v7zyQrhnde3tvfdMf5Wi81YmabE4W+ES7Cf1aSSO7Gf0VeohLR8YOUkauG9NS5HyY1ID4R t2Eh6TyvkAt9s7RPHDXmuNBnVtmPsbsqmCapeCbEJfYxnM3eckd4rPdCzqyaRwgQpxXfvJ JglJdy3t8g275/vz0VgScPnuBnudQamh8QdD0OXqQuqbgT03DgIdFntRvLE9HDvpRBgbNY l1xDXLA9R0L6I+pYB1NAwaWlI5ic3OUbqzNvWBmuDgony/JWlkUDRPTfdJZRVnizr3s5A6 5pSgDxCumKHe3kRrztlCs9HyRIXK21gS20yd1THmZi2P2W7dKOw64o/cxXlA4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgGvQ61NkzYMl; Mon, 20 Mar 2023 14:14: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 32KEEQaT039855; Mon, 20 Mar 2023 14:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEEQi0039854; Mon, 20 Mar 2023 14:14:26 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:14:26 GMT Message-Id: <202303201414.32KEEQi0039854@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: ddbd3a2b7c3c - main - carp tests: unicast tests (IPv6) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddbd3a2b7c3c68e88d3da757a7d1fbbaff88f468 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ddbd3a2b7c3c68e88d3da757a7d1fbbaff88f468 commit ddbd3a2b7c3c68e88d3da757a7d1fbbaff88f468 Author: Kristof Provost AuthorDate: 2023-03-06 07:49:57 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 13:37:09 +0000 carp tests: unicast tests (IPv6) Test the new unicast carp mode for IPv6. There's a routing hop between the peers, to ensure that the TTL check is correctly disabled for unicast carp. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38942 --- tests/sys/netinet/carp.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index 22f1aa3ac0e3..445b32c8a337 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -211,6 +211,67 @@ basic_v6_cleanup() vnet_cleanup } +atf_test_case "unicast_v6" "cleanup" +unicast_v6_head() +{ + atf_set descr 'Unicast CARP test (IPv6)' + atf_set require.user root +} + +unicast_v6_body() +{ + carp_init + + bridge=$(vnet_mkbridge) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail carp_uni_v6_one ${bridge} ${epair_one}a ${epair_two}a + vnet_mkjail carp_uni_v6_two ${epair_one}b + vnet_mkjail carp_uni_v6_three ${epair_two}b + + jexec carp_uni_v6_one sysctl net.inet6.ip6.forwarding=1 + jexec carp_uni_v6_one ifconfig ${bridge} addm ${epair_one}a \ + addm ${epair_two}a + jexec carp_uni_v6_one ifconfig ${epair_one}a up + jexec carp_uni_v6_one ifconfig ${epair_two}a up + jexec carp_uni_v6_one ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ + no_dad + jexec carp_uni_v6_one ifconfig ${bridge} inet6 alias 2001:db8:1::1/64 \ + no_dad up + jexec carp_uni_v6_one ifconfig ${bridge} inet6 alias 2001:db8:2::1/64 \ + no_dad up + + jexec carp_uni_v6_two ifconfig ${epair_one}b inet6 2001:db8:1::2/64 \ + no_dad up + jexec carp_uni_v6_two route -6 add default 2001:db8:1::1 + jexec carp_uni_v6_two ifconfig ${epair_one}b inet6 add vhid 1 \ + peer6 2001:db8:2::2 \ + 2001:db8::0:1/64 + + jexec carp_uni_v6_three ifconfig ${epair_two}b inet6 2001:db8:2::2/64 \ + no_dad up + jexec carp_uni_v6_three route -6 add default 2001:db8:2::1 + jexec carp_uni_v6_three ifconfig ${epair_two}b inet6 add vhid 1 \ + peer6 2001:db8:1::2 \ + 2001:db8::0:1/64 + + # Sanity check + atf_check -s exit:0 -o ignore jexec carp_uni_v6_two \ + ping -6 -c 1 2001:db8:2::2 + + wait_for_carp carp_uni_v6_two ${epair_one}b \ + carp_uni_v6_three ${epair_two}b + + atf_check -s exit:0 -o ignore jexec carp_uni_v6_one \ + ping -6 -c 3 2001:db8::0:1 +} + +unicast_v6_cleanup() +{ + vnet_cleanup +} + atf_test_case "negative_demotion" "cleanup" negative_demotion_head() { @@ -350,6 +411,7 @@ atf_init_test_cases() atf_add_test_case "basic_v4" atf_add_test_case "unicast_v4" atf_add_test_case "basic_v6" + atf_add_test_case "unicast_v6" atf_add_test_case "negative_demotion" atf_add_test_case "nd6_ns_source_mac" atf_add_test_case "switch" From nobody Mon Mar 20 14:14:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgGvS2m5xz3yn2j; Mon, 20 Mar 2023 14:14: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 4PgGvS1BdKz3kWT; Mon, 20 Mar 2023 14:14:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7/FJ8cuNvvjlHErLKhbC/rtSZ2l67C9+jC06s3itEzQ=; b=Cjy3xp77IRxolH3RweZDdaH7Gad7wNKJYRyU9rdosVHoNRI4DRO4nPU/bu44p2OT4lnLrG Vu0UHu+HyoeBcLHt17So2Ods+iVDs2VA4eTQsrxRbcGj55MXSQ6RARTo9VVkW2mMaJFLAn Fh03efW0eJ9nTGJk56zOyO+VubpKLjJb0qnZcHXlyeuIcqNXNNKdy0CQ2aMBANcAIGRxgd pYa4UqwmwGf65uHjE+a1zAy071HoXAUP9gU/EBElBb3bQzkQ4LQtaJV+9wokEW0d3Wtip9 UbffMu3BLkHn8sRPoRTjRd5iclbBiy4ZLyb50f3CjTBdFSDDdAHTDbOrNH8r4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7/FJ8cuNvvjlHErLKhbC/rtSZ2l67C9+jC06s3itEzQ=; b=TL5i+j8TkTlX2YkWkxoR+XCfsKH80QEFq43MQjUSlCST8KjgPtVQsO1KsoiWCkElnC8zKq txDejx6CG2TPYYlbgti4hBuhmYR7xwZ/ZC+7VJ38Kf/APGLbvSrFZdXWmMm2eR+ZpaUxJV jtd7spR0ImJ/d6PAkaXwkEDDllvF8uk9Rdb4CT/Aklosg/xbIskW1Vpsm1rdZYDLZEZ9Dl 6oIAx/s8PO9v0yVE9I38PTrLXWfXPtiqOJsrs6fcayi9i+3Fl3p78I5LuIQEUqxHVPYKa+ WoF1WoaENTAZzoGPmBp/KUA4UFfoh6XXX6Tbm4818/vpy5mqcOobXuenff7r9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679321668; a=rsa-sha256; cv=none; b=trYmRcsOWPwigxwkRAdYAFWmagtB8HPhcn+9XNs3aHvhIJW4VeffAklKcTUaZ7LFhf35Za n9U4db5gYKbCLIXV/AyCXQzuhyMsavrwcokLNTTXHwRjDMJJBxInvc01EJevhVZG8szezU f/m3IKl9RicvNEkuX3OSq5RyHKkVSlAnGJ1wfKDfWhARfeITf5sMnYnzkL8crpshoJlpU0 NsfhqJVdsz+FoGCzGgTL/SpjJN3Zla8AOxPI4oP2C6vR3S34bFhqenYXxZOxnRQOwtOwsD TFe/dwTAmFOC7rD9Y9cE3ly6CHQJgBLJk0/yu4JAjvong4JDaLBc7egAZkRGHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgGvS05h7zYDX; Mon, 20 Mar 2023 14:14: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 32KEERik039874; Mon, 20 Mar 2023 14:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEERiv039873; Mon, 20 Mar 2023 14:14:27 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:14:27 GMT Message-Id: <202303201414.32KEERiv039873@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: b1a4ccdd8394 - main - carp: document peer/peer6 and mcast/mcast6 in the relevant man pages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1a4ccdd839431ff0e5a536a444c6e91f5858527 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b1a4ccdd839431ff0e5a536a444c6e91f5858527 commit b1a4ccdd839431ff0e5a536a444c6e91f5858527 Author: Kristof Provost AuthorDate: 2023-03-06 14:02:21 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 13:37:10 +0000 carp: document peer/peer6 and mcast/mcast6 in the relevant man pages Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38943 --- sbin/ifconfig/ifconfig.8 | 18 +++++++++++++++++- share/man/man4/carp.4 | 19 ++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 98d2899f1b93..4669e96e28e6 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd February 1, 2023 +.Dd March 6, 2023 .Dt IFCONFIG 8 .Os .Sh NAME @@ -3086,6 +3086,22 @@ The following states are recognized: .Cm MASTER and .Cm BACKUP . +.It Cm peer Ar address +Set the address to send (IPv4) +.Xr carp 4 +announcements to. +.It Cm mcast +Restore the default destination address for (IPv4) +.Xr carp 4 +announcements, which is 224.0.0.18. +.It Cm peer6 Ar address +Set the address to send (IPv6) +.Xr carp 4 +announcements to. +.It Cm mcast6 +Restore the default destination address for (IPv4) +.Xr carp 4 +announcements, which is ff02::12. .El .Sh ENVIRONMENT The following environment variables affect the execution of diff --git a/share/man/man4/carp.4 b/share/man/man4/carp.4 index 2785b97e76ac..63fa9168dd39 100644 --- a/share/man/man4/carp.4 +++ b/share/man/man4/carp.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2018 +.Dd March 6, 2023 .Dt CARP 4 .Os .Sh NAME @@ -78,6 +78,23 @@ or through the .Dv SIOCSVH .Xr ioctl 2 . .Pp +CARP defaults to using multicast messages, but can be configured to unicast +announcements to peers using the +.Cm peer +and +.Cm peer6 +parameters. Default addresses can be restored using +.Cm mcast +and +.Cm mcast6 . +Note that TTL verification is disabled if the peer address is not a multicast +address. +These values can be configured using +.Xr ifconfig 8 , +or through the +.Dv SIOCSPEER +.Xr ioctl 2 . +.Pp CARP virtual hosts can be configured on multicast-capable interfaces: Ethernet, layer 2 VLAN, FDDI and Token Ring. An arbitrary number of virtual host IDs can be configured on an interface. From nobody Mon Mar 20 14:14:29 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgGvT2k17z3ymlM; Mon, 20 Mar 2023 14:14: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 4PgGvT2BTsz3kjG; Mon, 20 Mar 2023 14:14:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZdJMZWkKV2D8XVUi5AmDYhze8cDfLJIO01OJHhrVyY=; b=v/FfgZBxoIsDLMtzs0rU8B5dSo55LCB6dcY9cWUEs+PlvpzS4en2J4iWiB0sCBnkJ9XPTa eD3BIFDhuKMBu4jJPOnR/9gUqRK1Icl4ol/FEj5iorpVcXpRSTCRBAXDJ1OPo0imjFtUoH zrdlUec9WRoUYiN6G0ixbej7VbnWEKhExbEXgwGb/rGy5IlD7yqt/odl4Q0zXlucWF54UP DmFy0MPCX93fIuMrXe0KmsP7hdxljiHY+av9lrGvaA6e9j2/KabJZDT1Zit16tvNz9s0Y6 WlQY/6AGAPlN+rsfpztMA6+xj3fx0DCrsB8Z/jzekm/VQOxjhpqBdoHkEiXuXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679321669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZdJMZWkKV2D8XVUi5AmDYhze8cDfLJIO01OJHhrVyY=; b=iQ9buy/Nsw5euYabHhNJiroqLdX3yh4qq0g123Xl3ntnTOfVyy/mVT1ccsIo1HwkWxe3ds Oqdv0KjzqukkerClWeUbA/gT4ZOBIvXAKduBMGQAePJ57x0cK0Opfge80GdCNPOxbO9Lzf atMJrjh88X1dlLWv35MRprg8bnL0SkNWQRW9k6MGH9fckVMRSdNSDm3OwfNHrxsDZR0wqm OukCnv6FNujogPc6ofJJPPB4/W+j6KmoIDKYVRhA9sQrKNLURrgEpBNUSLsFCuuXviAf2S OjKo8tmylTcOoE8Osa4wFhbrKjtW2kOJjQSGfYYHSLYNQojPYOQWRxq+lkWQmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679321669; a=rsa-sha256; cv=none; b=d22aJf5pFKAYyQ6k4XHOnNM7hfnrIFPr09mqJNlzDTGEIvx5ALTn8yvrhCIvwPf3zoC6J/ +6Qi8ZLdhXUtQb5noV0kxwz/5J0femI2AYxSpEFf3HBP+eHfBxdFkj43UHLQ8a7zlGvLdu FGuIjRSvPU9TrMrtlp7TL6RI8hO38PID1NugnjBDH3FoPUmfA7d9Ud4qZG8hqgu/ZSlr+t 8DEoMjoO5hVbuOIgqM/l2nDy7wgFIlxObJzOjSCGmOc6pZ5Emq+acIKHklebd+Uo++ghvQ GK9yVk2xcploANmErL0PpGTPFHzRHKcoafSu3O69IUMf4NuHepi5sQEpJ4CqZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgGvT0nlVzYQK; Mon, 20 Mar 2023 14:14: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 32KEETxZ039893; Mon, 20 Mar 2023 14:14:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEETbc039892; Mon, 20 Mar 2023 14:14:29 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:14:29 GMT Message-Id: <202303201414.32KEETbc039892@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: 511a6d5ed34b - main - carp: use if_name() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 511a6d5ed34bf3dd335ebb0ce32a7e2276e9813d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=511a6d5ed34bf3dd335ebb0ce32a7e2276e9813d commit 511a6d5ed34bf3dd335ebb0ce32a7e2276e9813d Author: Kristof Provost AuthorDate: 2023-03-20 09:22:39 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 13:37:10 +0000 carp: use if_name() Reported by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netinet/ip_carp.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 2219e00140b1..a4ed121aeeb2 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -510,7 +510,7 @@ carp_input(struct mbuf **mp, int *offp, int proto) CARPSTATS_INC(carps_badlen); CARP_DEBUG("%s: received len %zd < sizeof(struct carp_header) " "on %s\n", __func__, m->m_len - sizeof(struct ip), - m->m_pkthdr.rcvif->if_xname); + if_name(m->m_pkthdr.rcvif)); m_freem(m); return (IPPROTO_DONE); } @@ -534,7 +534,7 @@ carp_input(struct mbuf **mp, int *offp, int proto) CARPSTATS_INC(carps_badlen); CARP_DEBUG("%s: packet too short %d on %s\n", __func__, m->m_pkthdr.len, - m->m_pkthdr.rcvif->if_xname); + if_name(m->m_pkthdr.rcvif)); m_freem(m); return (IPPROTO_DONE); } @@ -551,7 +551,7 @@ carp_input(struct mbuf **mp, int *offp, int proto) if (in_cksum(m, len - iplen)) { CARPSTATS_INC(carps_badsum); CARP_DEBUG("%s: checksum failed on %s\n", __func__, - m->m_pkthdr.rcvif->if_xname); + if_name(m->m_pkthdr.rcvif)); m_freem(m); return (IPPROTO_DONE); } @@ -582,7 +582,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto) if (m->m_pkthdr.rcvif->if_carp == NULL) { CARPSTATS_INC(carps_badif); CARP_DEBUG("%s: packet received on non-carp interface: %s\n", - __func__, m->m_pkthdr.rcvif->if_xname); + __func__, if_name(m->m_pkthdr.rcvif)); m_freem(m); return (IPPROTO_DONE); } @@ -605,7 +605,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto) if (in_cksum(m, sizeof(*ch))) { CARPSTATS_INC(carps_badsum); CARP_DEBUG("%s: checksum failed, on %s\n", __func__, - m->m_pkthdr.rcvif->if_xname); + if_name(m->m_pkthdr.rcvif)); m_freem(m); return (IPPROTO_DONE); } @@ -702,7 +702,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl) if (ifa == NULL) { if (error == ELOOP) { CARP_DEBUG("dropping looped packet on interface %s\n", - ifp->if_xname); + if_name(ifp)); CARPSTATS_INC(carps_badif); /* ??? */ } else { CARPSTATS_INC(carps_badvhid); @@ -714,7 +714,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl) /* verify the CARP version. */ if (ch->carp_version != CARP_VERSION) { CARPSTATS_INC(carps_badver); - CARP_DEBUG("%s: invalid version %d\n", ifp->if_xname, + CARP_DEBUG("%s: invalid version %d\n", if_name(ifp), ch->carp_version); ifa_free(ifa); m_freem(m); @@ -734,14 +734,14 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl) if (multicast && ttl != CARP_DFLTTL) { CARPSTATS_INC(carps_badttl); CARP_DEBUG("%s: received ttl %d != 255 on %s\n", __func__, - ttl, m->m_pkthdr.rcvif->if_xname); + ttl, if_name(m->m_pkthdr.rcvif)); goto out; } if (carp_hmac_verify(sc, ch->carp_counter, ch->carp_md)) { CARPSTATS_INC(carps_badauth); CARP_DEBUG("%s: incorrect hash for VHID %u@%s\n", __func__, - sc->sc_vhid, ifp->if_xname); + sc->sc_vhid, if_name(ifp)); goto out; } @@ -900,7 +900,7 @@ carp_send_ad_error(struct carp_softc *sc, int error) static const char fmt[] = "send error %d on %s"; char msg[sizeof(fmt) + IFNAMSIZ]; - sprintf(msg, fmt, error, sc->sc_carpdev->if_xname); + sprintf(msg, fmt, error, if_name(sc->sc_carpdev)); carp_demote_adj(V_carp_senderr_adj, msg); } sc->sc_sendad_success = 0; @@ -910,7 +910,7 @@ carp_send_ad_error(struct carp_softc *sc, int error) static const char fmt[] = "send ok on %s"; char msg[sizeof(fmt) + IFNAMSIZ]; - sprintf(msg, fmt, sc->sc_carpdev->if_xname); + sprintf(msg, fmt, if_name(sc->sc_carpdev)); carp_demote_adj(-V_carp_senderr_adj, msg); } sc->sc_sendad_errors = 0; @@ -1343,7 +1343,7 @@ carp_master_down_locked(struct carp_softc *sc, const char *reason) #ifdef INVARIANTS panic("carp: VHID %u@%s: master_down event in %s state\n", sc->sc_vhid, - sc->sc_carpdev->if_xname, + if_name(sc->sc_carpdev), sc->sc_state ? "MASTER" : "INIT"); #endif break; @@ -1615,7 +1615,7 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa) break; default: printf("%s: carp is not supported for the %d interface type\n", - ifp->if_xname, ifp->if_type); + if_name(ifp), ifp->if_type); return (EOPNOTSUPP); } @@ -1725,7 +1725,7 @@ carp_alloc_if(struct ifnet *ifp) if ((error = ifpromisc(ifp, 1)) != 0) printf("%s: ifpromisc(%s) failed: %d\n", - __func__, ifp->if_xname, error); + __func__, if_name(ifp), error); else cif->cif_flags |= CIF_PROMISC; @@ -2113,7 +2113,7 @@ carp_set_state(struct carp_softc *sc, int state, const char *reason) char subsys[IFNAMSIZ+5]; snprintf(subsys, IFNAMSIZ+5, "%u@%s", sc->sc_vhid, - sc->sc_carpdev->if_xname); + if_name(sc->sc_carpdev)); CARP_LOG("%s: %s -> %s (%s)\n", subsys, carp_states[sc->sc_state], carp_states[state], reason); From nobody Mon Mar 20 14:37:22 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgHPt2NyHz3yp9W; Mon, 20 Mar 2023 14:37: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 4PgHPt1vNQz3n2g; Mon, 20 Mar 2023 14:37:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679323042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+HeSVpInn0Cla67M/AzYue+i7+T0FHBZmUcxfigzsbc=; b=XbVSthcolVr57ALOtC5ejo8J5dBD/fcFdZbDBkHGj0xjAyOimCn+eai1CQLRtRPnmxpP4X R/c+M/ChYZBGnr4eU24WJkzKyvvbBlCzzA4kUyE0hL+JHlK2Wp/fNPR1l3pG1+BC/+RqDw 7Kr6xSeSk6WmXlRTZgbsJkrmBQ9d7jWO3mx19XPoRKfCGgHlRnz8eHLHW383/esg6twOgM gzOKIQAL0302dIpu+H312j7vdinBTRMxVrSxOg98EvV42IHg26nf5eALf25M+gn6D0gmwp rBEP2cA7N7SRD68spZGaXK1Z5W87Tt2Ivyh8oJUjO5qaqOWiVg6Jq4WSbRzr5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679323042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+HeSVpInn0Cla67M/AzYue+i7+T0FHBZmUcxfigzsbc=; b=PLEUf922Tw4/fvv/xzr2uUi9RaxoQ006TH/SxCqaibuCz5H4qBABEAKY/ZJM+c4HqAHnad j34VQsJ+tj5/UPqNHc2po1YauAqbBXmbqzC9sDC3/yAX+YneslOmTCgDoQKTJCLVCr1YNu Ipeh4cqPHoTiBcoi68jIozUXoFGPriFMvGuHqf5ANdPJ/nj6RW7Egzs5Upg71iTXoG6nYN f3xJB6qXVzRFh/kUciikf8eECDU6VUUj0VVQzgcFNjtBqtbb1WMaEVDKvqLwCNBPNIfdZw bTAe9R1SnQQvgTpua4qq1LiT2aWvQq7ak1S8DAaprF4iIwFHBkG5Pi3HB4MGpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679323042; a=rsa-sha256; cv=none; b=m1fUDWqNJUg5b7EdZ2NDOGB5XR+XLDtv95/OTql1hgXwOYIi+vtojqgvHYNo4J/ZVua5tx 5epk+UN7dk8f8vj7pF8GYJeTvo1ByIiNtw25m/4o3ftGMQjswq92eYGo7o+VSDDyW1MXYB 7gjhErFVH4sgXRnR6PFC+UvAkL46U746e2C+bCDOyl6tL5/hkyDgBesD35lFlBVfbRfraZ CL7AE93bljn3r107LZO+wgHBiPYm0vMkokqC0V7ZqmFoROcvmludZ6jRY+h+xM5DCbMSnQ xSB+9LF5EX+ov1aNdaoP1yMCNPThWbWnOhBYF3YFjc6HAEfNtHFUSMeYEJVnoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgHPt0xhKzYYF; Mon, 20 Mar 2023 14:37: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 32KEbMrB073066; Mon, 20 Mar 2023 14:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KEbMO1073065; Mon, 20 Mar 2023 14:37:22 GMT (envelope-from git) Date: Mon, 20 Mar 2023 14:37:22 GMT Message-Id: <202303201437.32KEbMO1073065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: e4e139b828a2 - main - pkg-stage.sh: update port trailing version information List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e4e139b828a2278b44496653c1cd5e6298afb3c6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=e4e139b828a2278b44496653c1cd5e6298afb3c6 commit e4e139b828a2278b44496653c1cd5e6298afb3c6 Author: Glen Barber AuthorDate: 2023-03-20 14:36:51 +0000 Commit: Glen Barber CommitDate: 2023-03-20 14:36:51 +0000 pkg-stage.sh: update port trailing version information Reported by: Ian Smith, Graham Perrin MFC after: 1 week X-MFC-13.2: NO Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/scripts/pkg-stage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/pkg-stage.sh b/release/scripts/pkg-stage.sh index 4e9617184243..e2a51e4ef2f0 100755 --- a/release/scripts/pkg-stage.sh +++ b/release/scripts/pkg-stage.sh @@ -14,7 +14,7 @@ export PORTSDIR="${PORTSDIR:-/usr/ports}" _DVD_PACKAGES="archivers/unzip devel/git -emulators/linux_base-c6 +emulators/linux_base-c7 graphics/drm-legacy-kmod graphics/drm-stable-kmod misc/freebsd-doc-all @@ -30,7 +30,7 @@ sysutils/tmux www/firefox www/links x11-drivers/xf86-video-vmware -x11/gnome3 +x11/gnome x11/kde5 x11/xorg" From nobody Mon Mar 20 16:21:37 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgKkB076Kz3ywP9; Mon, 20 Mar 2023 16:21: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 4PgKk96qLzz43rr; Mon, 20 Mar 2023 16:21:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679329298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7i/gKF6BwPgOplQM9D7mIQpzjEJPxWaUhUA9VJpo1b0=; b=JgUiav5djX3REi6kknzIwwyzl2CdXQDBA2bIStYyQUtLHgAGGYL4+vTmLxpNiXGnCXbgTa u5qy2ziXaW/Vsi5wE0UgjU2hRJ9P4Rpt4k8CodMscnqmnsi8BQEYodq7iin37nBfrmN2Wz RpNLZuOJk3PFBWOZ4ZveYvYDM9jkyzoi22+KoJE3Ns38tpLhfbvmOCmsxMVxrbd/Z4hklz F9qOw/yq7g3tra8N8HNrkT9DDCp65RuuRRurIGeQntWpjVW4idKqzSxvBQh92c7r0V/KwC juEOoHbYEIUaT/vJk2/vqSp5dm0YYKam7xUOZhp92/HYGr+Hye7hDl8YAfjPUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679329298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7i/gKF6BwPgOplQM9D7mIQpzjEJPxWaUhUA9VJpo1b0=; b=xMh0HIty75VQ6Fz28IftMKbbaJq5iLGotWrTZloo+EhBQeYUn240p7niH4uO+qGr9LYOGu LUpmi1QQj2byWVS54GZlnJs9PVJaVBwLU+Oub8DYFGy36j1XhHyhWQ/dp7NKCLnD4HqPdV OvWQ8zw6lWEForORvPBnuKRNOoLvYF94J1hWFIPUhSWHXmQdrSvfjc0FoeXBDKOPD+QEMm n+vsdP84VC5mj+hYPgEegpZuDIgvO+9WUAQpVYmkjBbxiUvVVaY3p4DpRwh6nyEfKg1HNf xwSiik2RWXMcIetE9m038U+ecS1HCPPbvwZbmeH2J12qE4Epl4EO422tvThAHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679329298; a=rsa-sha256; cv=none; b=lAJ6zZKhb+8svZAuaEGXJfDrvqNC6Smx/IertrY+XKPxgfImxdC8hPfpxHYAU+scJ58U+M jbG5gw4ngGint4rtoxkZ1H+yDDZVHbU7kxvByawcRl5WViaTwcQovjLriSyfXGd5uIUWcE tmFRXIqCaD6qAwuY1FDFFZc/SINkQkMrM1kwxlCBGZfwdDUZu6sl3iv7Zw1+al1loWXOJh teC5RZsiIXIMCU3BuZHZtHg5nOe/0UMhKi+vTESXGk+RvigrYNxLPM3WmEigZA7/eIyYUZ IDRHkK5a5YJ6UwUt/K7az43ePU8tpWUp4LFUVVFHwA3w42ELJwhrnRVXc2qZzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgKk95nr9zc9M; Mon, 20 Mar 2023 16:21: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 32KGLbS4050730; Mon, 20 Mar 2023 16:21:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KGLbFv050729; Mon, 20 Mar 2023 16:21:37 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:21:37 GMT Message-Id: <202303201621.32KGLbFv050729@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: cc9158d74d30 - main - netipsec tests: Serialize List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc9158d74d306fdbee2f5f014e5d267eca0aa6d1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cc9158d74d306fdbee2f5f014e5d267eca0aa6d1 commit cc9158d74d306fdbee2f5f014e5d267eca0aa6d1 Author: Mark Johnston AuthorDate: 2023-03-20 16:15:32 +0000 Commit: Mark Johnston CommitDate: 2023-03-20 16:21:17 +0000 netipsec tests: Serialize The tunnel mode tests use VNET jails and reuse jail names. Until this is addressed, serialize them. MFC after: 1 week --- tests/sys/netipsec/tunnel/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/sys/netipsec/tunnel/Makefile b/tests/sys/netipsec/tunnel/Makefile index 4b8c8a21a5ac..5862ef010c2a 100644 --- a/tests/sys/netipsec/tunnel/Makefile +++ b/tests/sys/netipsec/tunnel/Makefile @@ -15,6 +15,9 @@ ATF_TESTS_SH+= empty \ aesni_aes_gcm_256 \ chacha20_poly1305 +# Each test uses the same names for its jails, so they must be run serially. +TEST_METADATA+= is_exclusive=true + ${PACKAGE}FILES+= utils.subr .include From nobody Mon Mar 20 16:39:30 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgL6p4P7Wz3ywwP; Mon, 20 Mar 2023 16:39: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 4PgL6p3tWlz49nW; Mon, 20 Mar 2023 16:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Uf5iib3rptElcc1vAQOfJ1bALRquMjLRGO3GwOjAQ/w=; b=iW+/jc/GRrO0Ym/erDEUSA3NxA1w0OhcVB2wDN5BjgTE4NrMwMB06n4wnDCdhhiZuLv+v4 h76luTuCNV3boh3WFzkP8g8G/szejWohxjxbpRlJbVjWS4HP7xDOpCZj0Nk8CRRHC7d/5Y gevG9LTfDcIuMH0y2ivM014QDSSypKkGSjorP/99cfUGrQ8lbQB1ADFhazc7yhNs8oPSWL YZM3nvyfn6D0h0KNHb2DlimyeyeeWFeqyYUaXnkeOTI5/zH1TtwXUtyfsg/9ih3dFFN6gs VOY9TCmE+KLvHtke1dxPdps+cUbB+hutIdUuiPp0EWkVwQ+AwXI2hDsRbBChpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Uf5iib3rptElcc1vAQOfJ1bALRquMjLRGO3GwOjAQ/w=; b=JREpDVHBTO0LUm8j+Ack2kRat1i6TtRWtvUMq7XbYnvNL6rrII7FibFvxI0U8p615j+U6v MrPYVE7HS54vL75FLp402xp6ha1ZqBDimlKBgxINXbmjXU+BTuZK/pvlfJ3FoaqZSzliHD bX/xpgqBPliUN808W8sXGtSepEej83/0SYvHryNOw91xWyGt6QsFdXVa3E5fu4m8mhKtIo 0WPrIeK7VJrR99VZJbi1qibCV95PWZj8Th9kq4H5zclvcwJavRAHJS9Hin6Li97D58LXwV Lzanh7gpewFYuc2CHXWEimW1Vbe74vYrVNNdrehLt38gRFN1XhjsKhVYRE6Rxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679330370; a=rsa-sha256; cv=none; b=Ds09afuw38CywqiN5LLwxU5GAY7H7yICt/Cy5+kVIBlG7DJCnoogOW3a+lOX2zUkugC0ur TsQmqJN1L7kuegJuDlMrcqoHS8QOOEJeuBpgoE4Ovp7xM0xREAoomzsiro/7BKe3+AEgI1 f/IUD92PIFmnVm5QL/oQewzUNzwMEPXp4t514bvBoSL1o9MreAUUKqatRmx8/0DDgSl7Nm +4b9ao/egL34zQ2lS2jV+KBpovM2vR7aXEDwJrQFLNzDVpv4CoPpUs25uSDQo89bCWDxug L/TAMOh7MpRTPMxD1ZCmqYtVjJYgXCPxUN3Mwc/n6PIXuv8VeM0y62mgI+FR1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgL6p2xZ7zcXD; Mon, 20 Mar 2023 16:39: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 32KGdUch071188; Mon, 20 Mar 2023 16:39:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KGdUXv071187; Mon, 20 Mar 2023 16:39:30 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:39:30 GMT Message-Id: <202303201639.32KGdUXv071187@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: 844ad2828a35 - main - pfsync: add missing unlock in pfsync_defer_tmo() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 844ad2828a35c434b893af4274b1f6c50332dd70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=844ad2828a35c434b893af4274b1f6c50332dd70 commit 844ad2828a35c434b893af4274b1f6c50332dd70 Author: Kristof Provost AuthorDate: 2023-03-20 13:26:33 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 15:39:14 +0000 pfsync: add missing unlock in pfsync_defer_tmo() The callout for pfsync_defer_tmo() is created with CALLOUT_RETURNUNLOCKED, because while the callout framework takes care of taking the lock we want to run a few operations outside of the lock, so we unlock ourselves. However, if `sc->sc_sync_if == NULL` we return without releasing the lock, and leak the lock, causing later deadlocks. Ensure we always release the bucket lock when we exit pfsync_defer_tmo() PR: 268246 MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index f1130ba143f1..4c834c7f0315 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1827,8 +1827,10 @@ pfsync_defer_tmo(void *arg) PFSYNC_BUCKET_LOCK_ASSERT(b); - if (sc->sc_sync_if == NULL) + if (sc->sc_sync_if == NULL) { + PFSYNC_BUCKET_UNLOCK(b); return; + } NET_EPOCH_ENTER(et); CURVNET_SET(sc->sc_sync_if->if_vnet); From nobody Mon Mar 20 16:39:31 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgL6q5PM1z3yxJ3; Mon, 20 Mar 2023 16:39: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 4PgL6q4wX2z4B6y; Mon, 20 Mar 2023 16:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8SiIJ1aqXIIVxzx5xwOlm840LfnEOoX008JAtqDKgtk=; b=dngvtcXjTy0pDLLAtzkAbzU5Fp/RvPrz7wFyGNPFCCACA+UVdsW9/dngVHLxYkgTHzsS+E cab4InPAf+GATlABAzFOlIYoIZcbqpDX0gXYVHApW1SYS0gYAQJXQUq6wS70D0Dgo5I9a4 ZvbMIbTppCD4aKsP3/Y61u7NYArO9G7I/UFNJItRIp12akzzx/ux5kD2HE+5nAaIgSA1ET sEFkN/y997/v4C+xFEHHVpoge/DekhGMT5y4fSm1ylhLv8LXe/SlslNRPz6AfzJ++BVycW Xgj5lPt5QD3TcmGGRoCwROoQ29MM5CiC5cUzbNDniLoF9Igs5cT/ZXNGQhEVew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8SiIJ1aqXIIVxzx5xwOlm840LfnEOoX008JAtqDKgtk=; b=gQDQTrgeETjKsB1KLp/JmkXpmt0pU0Ocy2P1lE3+S/Y73VxhNwlduPhPzvyPPgaUh9yIox Q49J1286Iyu9LmlIVx11R4lRhLc63uRedUc/f2OKcOnGN2cI6iw1IPSpgzuRHFxUHGfctu LfuZrz9AkOSN7ChTS1yp4UrRI8qTCxM2cK9XK9E6Kokc41i3IZkeBEjZO6GjG+O4wfcZ4v 4j/JvK6Cs7cfvzdHeayP0cxkdjTf/WjbVpSTU3LwZZurQzDE01uh2WNcS+MgDQ3D0mc5d1 stTIwWI2zGoaDGpWypr/igDMYlAmy90luIt2RObKJ2YGXMpVWg70o7474g4kuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679330371; a=rsa-sha256; cv=none; b=t6tcBIHvxETDMES/3qRGjx67713beGCFEh/Q0nxDL+LZUlv7ybbR6DzSfshaXHf3k2ESdb H1GM3vCe6WwUYV/8xOFj+ymrEq10PVlJgnJwhle7qF51CIkzy4Y8hIGRIKSaWZnthK3+2j KieGO+YHgKwyJ9tM1Q6wr5ssnueD80KSw76DMP5ZcZsX6HquOCidWPVVS+0bd3PTxMkFUc 3rA2tB1kTnNI+eNly+06yFxTvB21iGtpFl7dIW5IDXgftTgGcQSLo93VnNatIxcSpr0ttp rpZWEgboXOLckDqy5aZJRZP6aijPXKY1EUr7aNw+kNAWOjQbcJZGZSKaWW7lGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgL6q3qByzcXF; Mon, 20 Mar 2023 16:39: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 32KGdVgg071214; Mon, 20 Mar 2023 16:39:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KGdVl5071213; Mon, 20 Mar 2023 16:39:31 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:39:31 GMT Message-Id: <202303201639.32KGdVl5071213@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: 53247cdf1244 - main - pfsync: fix pfsync_undefer_state() locking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53247cdf12449e90f6736ae563e4cce8315c923f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=53247cdf12449e90f6736ae563e4cce8315c923f commit 53247cdf12449e90f6736ae563e4cce8315c923f Author: Kristof Provost AuthorDate: 2023-03-20 13:29:55 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 15:39:14 +0000 pfsync: fix pfsync_undefer_state() locking pfsync_undefer_state() takes the bucket lock, but could get called from places (e.g. from pfsync_update_state() or pfsync_delete_state()) where we already held the lock. As it can also be called from places where we don't yet hold the lock create new locked variant for use when the lock is already held. Keep using pfsync_undefer_state() where the lock must still be taken. PR: 268246 MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/netpfil/pf/if_pfsync.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 4c834c7f0315..ae3a2e46e26b 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -297,6 +297,7 @@ static int pfsyncioctl(struct ifnet *, u_long, caddr_t); static int pfsync_defer(struct pf_kstate *, struct mbuf *); static void pfsync_undefer(struct pfsync_deferral *, int); +static void pfsync_undefer_state_locked(struct pf_kstate *, int); static void pfsync_undefer_state(struct pf_kstate *, int); static void pfsync_defer_tmo(void *); @@ -1851,28 +1852,37 @@ pfsync_defer_tmo(void *arg) } static void -pfsync_undefer_state(struct pf_kstate *st, int drop) +pfsync_undefer_state_locked(struct pf_kstate *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); - PFSYNC_BUCKET_LOCK(b); + PFSYNC_BUCKET_LOCK_ASSERT(b); TAILQ_FOREACH(pd, &b->b_deferrals, pd_entry) { if (pd->pd_st == st) { if (callout_stop(&pd->pd_tmo) > 0) pfsync_undefer(pd, drop); - PFSYNC_BUCKET_UNLOCK(b); return; } } - PFSYNC_BUCKET_UNLOCK(b); panic("%s: unable to find deferred state", __func__); } +static void +pfsync_undefer_state(struct pf_kstate *st, int drop) +{ + struct pfsync_softc *sc = V_pfsyncif; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); + + PFSYNC_BUCKET_LOCK(b); + pfsync_undefer_state_locked(st, drop); + PFSYNC_BUCKET_UNLOCK(b); +} + static struct pfsync_bucket* pfsync_get_bucket(struct pfsync_softc *sc, struct pf_kstate *st) { @@ -1891,7 +1901,7 @@ pfsync_update_state(struct pf_kstate *st) PFSYNC_BUCKET_LOCK(b); if (st->state_flags & PFSTATE_ACK) - pfsync_undefer_state(st, 0); + pfsync_undefer_state_locked(st, 0); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) pfsync_q_del(st, true, b); @@ -2034,7 +2044,7 @@ pfsync_delete_state(struct pf_kstate *st) PFSYNC_BUCKET_LOCK(b); if (st->state_flags & PFSTATE_ACK) - pfsync_undefer_state(st, 1); + pfsync_undefer_state_locked(st, 1); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) pfsync_q_del(st, true, b); From nobody Mon Mar 20 16:39:32 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgL6r6LKsz3yxJ9; Mon, 20 Mar 2023 16: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 4PgL6r5dxzz4Bp9; Mon, 20 Mar 2023 16:39:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DY0iJ68JXXDzJATZ+kHPjM0R0qp8OIiXNKAJfN72/5Y=; b=MLqPwCjkaH/RMaljjhToH50Jo08CK9WivThLt5BN2bGwdF9prkvPZqSPQmHdX63xFmdwey K/At50Lm5P7tqqgYJcuPs/4KDsYixXqQEK4UYh19S9hBXZV0BlaCnWz0We3Oo1YsNBaMbL yrzgSg3CSFjZfec1lNit9b8f//T7RTQRXrCD9QaNWv30exRFUFecegfeSX+q7Dkug6kFjL 06z0z/PGxojafar/o+Q4GXlfLhtpAcEs1syRxzoJBkyD2kuZlXoroMx+DkgFz2S72c+01x bhfgsTMJkB1CyVcwhTxxwpJYUcUYaq3Mq6Yd9ZMTTfauoV7ragPeYGnZv+dtmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679330372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DY0iJ68JXXDzJATZ+kHPjM0R0qp8OIiXNKAJfN72/5Y=; b=hZTeakX+xUVRhjqFAJq/FUwOz6I2b2AEm1E9hk3/4tfe65gSybsFYobD4/BrlqChhlBYoW 3PSPM9uSFb5GntgQiPjrkraDv1fMUjZKpYWXOP8wMAA4JPuko+jdaSQF2vkhI+0NBZM2Xs Z29lt/skhKNG74eayGLas8CRwADWMc/3uLqD3VlRZrrTdXaEy9NHpAcwmru8+Eey5pJCHg /hoj3OcoFh6TYztlz2ZIZsGOlexkvqRlXFOPvCd0vb80QaO8RGuq36O0Yk0JrpV4uRI7w6 i0AKhYXx7JVHoleGZ4C20u77dr4/LFAWnC2q1Cs295zEefgbMwNp3FFuxGt0Jg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679330372; a=rsa-sha256; cv=none; b=rsftlYcA60C9aVwzA9ONJivZeB43F1HmdmVxL48gpF60tWkpje6eE5Z83a2NLSFJnoX2L/ 5pBVW8LHggooxuHs7c/OTb6HpPCo+yk7fHcxuM/1IAGTxeGPkL1y57VJ+UWDeuHqG4mfMI ZVCZ2SMI2FNtfiF3NmExc9n9sy7kKo7TBf79k7tgp9uBRaOFw12ELYalRyiS/35zB9i9V3 XCACUnGhHdZMB9z+1NbVEJZDXny2qtYKW0svpShOInKUzDr/Px+1AwbnuCQClmHMupl+KI BL6xxdYt7pYSUWG2DTiFGh9br++OdMjux6piczPgi+Ge0ErL/hAvzilWkNKjMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgL6r4k6qzcwj; Mon, 20 Mar 2023 16: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 32KGdW2i071233; Mon, 20 Mar 2023 16: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 32KGdWUv071232; Mon, 20 Mar 2023 16:39:32 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:39:32 GMT Message-Id: <202303201639.32KGdWUv071232@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: a6719858a480 - main - pf tests: try to trigger locking issues in pfsync_timeout() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6719858a48019aa54e1ea3be57d17fa88b080c6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a6719858a48019aa54e1ea3be57d17fa88b080c6 commit a6719858a48019aa54e1ea3be57d17fa88b080c6 Author: Kristof Provost AuthorDate: 2023-03-20 13:58:34 +0000 Commit: Kristof Provost CommitDate: 2023-03-20 15:39:14 +0000 pf tests: try to trigger locking issues in pfsync_timeout() PR: 268246 MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- tests/sys/netpfil/pf/pfsync.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index 3871d6be8e14..810b4e203a1f 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -669,6 +669,39 @@ ipsec_cleanup() pft_cleanup } +atf_test_case "timeout" "cleanup" +timeout_head() +{ + atf_set descr 'Trigger pfsync_timeout()' + atf_set require.user root +} + +timeout_body() +{ + pft_init + + vnet_mkjail one + + jexec one ifconfig lo0 127.0.0.1/8 up + jexec one ifconfig lo0 inet6 ::1/128 up + + pft_set_rules one \ + "pass all" + jexec one pfctl -e + jexec one ifconfig pfsync0 defer up + + jexec one ping -c 1 ::1 + jexec one ping -c 1 127.0.0.1 + + # Give pfsync_timeout() time to fire (a callout on a 1 second delay) + sleep 2 +} + +timeout_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" @@ -678,4 +711,5 @@ atf_init_test_cases() atf_add_test_case "pbr" atf_add_test_case "pfsync_pbr" atf_add_test_case "ipsec" + atf_add_test_case "timeout" } From nobody Mon Mar 20 16:57:09 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgLW92TL8z3yyKL; Mon, 20 Mar 2023 16:57: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 4PgLW9221gz4JMW; Mon, 20 Mar 2023 16:57:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679331429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d4VeVkAmGCYMyaaCZI5USENnJXB7a1LU/95dhPL8S3g=; b=dweH0Mmdqh8ZplpYdWir6CC2zhmpdNkGFhP8a6WwJOMHduRA0tkiMOPV/DUE7BdBCnuXP/ ZdggP+eK2eCtbsja5Lmk/nT4RMcNkXJeTVSr9rV8sf0RYY1xpg0KekG2Rg2SYBpHvGeiKg LTmAMr4tTk6fR1zfsh1eweEBIdxEBoghXDA8yYOqfZxc+YxVN8wwGcXNoj2JIFrRzSH6HT IzWnAH1AUibeibT0d6+hLHlJG+VykLuOACfAdWiUPHi1Wk/kxW0Z9cWmrZVWqv58EoiDgk yAHK+6NOYOSnfpPp5deEnzv3dzm1j2GInXobDCPI1KDmApcA1O8rdDD/kJXpKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679331429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d4VeVkAmGCYMyaaCZI5USENnJXB7a1LU/95dhPL8S3g=; b=n4aDloTz65dVJXFGEGytWDP4nikoOI9Qe7Yk1R3gXUMbQEY3Tj/I/kVFV6vLSgjX0zdjQi yRPkdVKpQho/+zWWO1yKYMzCFVllWgyXsJfxraHcJUUc+U8V85KLJbf57rv/4ub7VD3uvA IltLiRO7rr7ct3n7m5xtB15JkXCcdNw1Ohn6uMva8euQkx0TZuBzOVNhdXaARqvP2w/5vE a2iUJO5lQ1qJbNVAXkBeOs1mpxNYE5vquzyNGgWcoCc0C8RYXFbhlJYm7xnghOjpphX0bv 3ULdi2KTbni0NZ+VgJFAfPGaip2v0NejFO8WOriEH79L5k37N9SY+m4nVlAR2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679331429; a=rsa-sha256; cv=none; b=HZr0gGAcU6R22lvMKvrRKOxY3bFAqbG9PhIeEYyhoD0YlAEYOGifXcoZhRwz/XLJcqRHzg EgwYMV5qQqAWqedJqCM97nT6LveXkbXQXEQH10obEZvcVJiAV6PT8uYsbzWWa4FE0wBoLh lrLKxbdojbb596fo5n6waqNqwi/igyzRuwc7mRMhbR3yKCeYn4I3YTR0/KR5bw/9FdhzgE g0uT6Li2wzzjTmh0OR5XQJvDkZ6dZpAM2T4JaZfl1/UXvEpSJoNvZhrrQK+uXMBAXgnNIb o7Yj2U0N0QMFgpyUmAVbTR1Ht2j5WwdaGkRN6+UWd7/xg9S878KdFi24TQdNbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgLW915JLzdWj; Mon, 20 Mar 2023 16:57: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 32KGv9Dr003733; Mon, 20 Mar 2023 16:57:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KGv9Bu003732; Mon, 20 Mar 2023 16:57:09 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:57:09 GMT Message-Id: <202303201657.32KGv9Bu003732@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: 3ce64010f8ce - main - sh(1): fix history file write checking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 commit 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 Author: Daniel Kolesa AuthorDate: 2023-03-20 16:42:59 +0000 Commit: Baptiste Daroussin CommitDate: 2023-03-20 16:56:56 +0000 sh(1): fix history file write checking We cannot just compare histsizeval() against 0, since that returns a string pointer, which is always non-zero (non-null). The logic in sethistsize() initializes the history size to 100 with values that are non-number, and an empty string counts as that. Therefore, the only time we want to not write into history with HISTSIZE val set is when it's explicitly 0. MFC after: 2 weeks --- bin/sh/histedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 0eb8c6c1784f..db3b8bcfc1da 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -90,7 +90,7 @@ get_histfile(void) const char *histfile; /* don't try to save if the history size is 0 */ - if (hist == NULL || histsizeval() == 0) + if (hist == NULL || !strcmp(histsizeval(), "0")) return (NULL); histfile = expandstr("${HISTFILE-${HOME-}/.sh_history}"); From nobody Mon Mar 20 18:16:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgNH72PwVz403Wv; Mon, 20 Mar 2023 18:16: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 4PgNH70jT6z4Tmh; Mon, 20 Mar 2023 18:16:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679336211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wkycpvg8n+VCEwsoZvjRwJ1AedYz6FL3MZ3/2MC5R1s=; b=LXUj6wN88H3RPy/9AAG1QHBeruxIgQrcw8T3MjO5FTvLoUN/y814GQcH8rUbdfY9O6esIV 7qW0+4hNgwB4coh/4/v0d6PMh4wAqs0wdL0b2vmocBROv7W4HgupkeK4UaW+t6yE8zq0wm SYX2OKMBFuOZBC+pOOG6/tGlsCG9hzjvJkh7PD7elCBKgkyQP0ALV1HHn6CljdH12bIUIu AdvF/Db+IFuvSnfF2VQpqynJsE0oKvT0Xeb2T+Uu9gULRjbqAKHL1rMQtSof7dyX8JdYMS p/nIA61RsUyTAATS4nkZ1lL98It7zrGOqzIFS7Ybc9ejlsbh4k5gV/MsHhwVrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679336211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wkycpvg8n+VCEwsoZvjRwJ1AedYz6FL3MZ3/2MC5R1s=; b=l9lqk8lWc2ASk4vjOMhuvyMBQeVVpzY1kXTfDtJVLR8iB5lIk/uFYw65EIVOkOP+tlUX2u Oj/azY9VYtRGXMtNmKOZMguDsofAPtcIk/bBbJOelm4Xq1QNMA6TOGfKZRXGlXmRPdzW9n sMmXGsR7ScueKsXo6C17DL7+J3LcKNIU7pp5+puQeD0I1JU52ZLdIK+ZLJzIG5fSNxf7+g ftPoqj0lxhcV/Mg5yggvhRonfwSgupuYXWT+sJaGPUQ7PmD12a5Ta3OuxR3qRO5t+RigDI J4KEJKowPch/QV05RJMcG1BpN6pglxR80jUPEq9zRa/ExpZbGDgyCtpi6ZxGlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679336211; a=rsa-sha256; cv=none; b=QkJiBLnFgOaQYHDg66Hi/4ilmlgjV69PNHe0g7BhZqKJs9xTGFhhUrbA7+o2X+J2XvNqms zqIpTkoH12xkHHoLE+1Dbdz/DFWfLANRQ0U+QM0P+qsgnXuS7EEKtTfJEjaxfkwPRf0kS8 HeOboE305qHfVU9ArFgO2nCXAPHINwM5DptFTuscyN0qcsDNPzlG1v2rXqR+gFZECALJ78 L/ob7j2+fT1vyG66Fa1SDKvCdbI9NvXMI8GGlBO/U8mUlvGPYe9QLra4eGAbg8fK0uE+Gn SnnBrkEf76naLJxhzK1huR+tkIblEOoFR3qKVJF9XNaW3X3dqYBZyo/CPacV8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgNH65rzXzgc7; Mon, 20 Mar 2023 18:16: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 32KIGoHA035592; Mon, 20 Mar 2023 18:16:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KIGopb035591; Mon, 20 Mar 2023 18:16:50 GMT (envelope-from git) Date: Mon, 20 Mar 2023 18:16:50 GMT Message-Id: <202303201816.32KIGopb035591@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: c3179891f897 - main - kerneldump: Inline dump_savectx() into its callers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3179891f897d840f578a5139839fcacb587c96d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c3179891f897d840f578a5139839fcacb587c96d commit c3179891f897d840f578a5139839fcacb587c96d Author: Mark Johnston AuthorDate: 2023-03-20 18:16:00 +0000 Commit: Mark Johnston CommitDate: 2023-03-20 18:16:28 +0000 kerneldump: Inline dump_savectx() into its callers The callers of dump_savectx() (i.e., doadump() and livedump_start()) subsequently call dumpsys()/minidumpsys(), which dump the calling thread's stack when writing the dump. If dump_savectx() gets its own stack frame, that frame might be clobbered when its caller later calls dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the stack. Fix this by making dump_savectx() a macro, so that savectx() is always called directly by the function which subsequently calls dumpsys()/minidumpsys(). This fixes stack unwinding for the panicking thread from arm64 minidumps. The same happened to work on amd64, but kgdb reports the dump_savectx() calls as coming from dumpsys(), so in that case it appears to work by accident. Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps") Reviewed by: mhorne, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39151 --- sys/kern/kern_shutdown.c | 15 ++------------- sys/kern/kern_vnodedumper.c | 1 + sys/sys/conf.h | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 6f912369268a..70de6b691fd3 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -244,8 +244,8 @@ MTX_SYSINIT(dumper_configs, &dumpconf_list_lk, "dumper config list", MTX_DEF); static TAILQ_HEAD(dumpconflist, dumperinfo) dumper_configs = TAILQ_HEAD_INITIALIZER(dumper_configs); -/* Context information for dump-debuggers. */ -static struct pcb dumppcb; /* Registers. */ +/* Context information for dump-debuggers, saved by the dump_savectx() macro. */ +struct pcb dumppcb; /* Registers. */ lwpid_t dumptid; /* Thread ID. */ static struct cdevsw reroot_cdevsw = { @@ -392,17 +392,6 @@ print_uptime(void) printf("%lds\n", (long)ts.tv_sec); } -/* - * Set up a context that can be extracted from the dump. - */ -void -dump_savectx(void) -{ - - savectx(&dumppcb); - dumptid = curthread->td_tid; -} - int doadump(boolean_t textdump) { diff --git a/sys/kern/kern_vnodedumper.c b/sys/kern/kern_vnodedumper.c index 26154af20372..0104369b9d67 100644 --- a/sys/kern/kern_vnodedumper.c +++ b/sys/kern/kern_vnodedumper.c @@ -44,6 +44,7 @@ #include #include +#include #include static dumper_start_t vnode_dumper_start; diff --git a/sys/sys/conf.h b/sys/sys/conf.h index ad6ffc31dc2a..f1d4df674e6c 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -360,7 +360,21 @@ struct dumperinfo { extern int dumping; /* system is dumping */ -void dump_savectx(void); +/* + * Save registers for later extraction from a kernel dump. + * + * This must be inlined into the caller, which in turn must be the function that + * calls (mini)dumpsys(). Otherwise, the saved frame pointer will reference a + * stack frame that may be clobbered by subsequent function calls. + */ +#define dump_savectx() do { \ + extern struct pcb dumppcb; \ + extern lwpid_t dumptid; \ + \ + savectx(&dumppcb); \ + dumptid = curthread->td_tid; \ +} while (0) + int doadump(boolean_t); struct diocskerneldump_arg; int dumper_create(const struct dumperinfo *di_template, const char *devname, From nobody Mon Mar 20 19:20:15 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgPhH6wzXz407LP; Mon, 20 Mar 2023 19:20: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 4PgPhH6RTHz4ZWh; Mon, 20 Mar 2023 19:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679340015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mWx1P14KEWb+uSf3BvCmV/6ozTPkdj4keIDObublxeU=; b=kd1Mgat8y3ygP35KLtd6f71ex5vCNSj7Bnu2G5Gh6GipdkThnfpLUbOHrhyHmy1NkHAt+e g4jiN1VCcTGj1J4P4eMfjAEM3HE4/zSpjiEFu2bycIJkKJ+Gi4+ACKxvXvfAA21RFctkFR A1OqvDJX2nqK5ap7xURYcYzNTmcBSn9QeG/V7SHOsI7i+wCL6VI/Tfdop+6+aCA7eELg/N wlxGdiPYBDua9gqsflhbBzxVyCjM6lIqap3TUAgsVhYh+tG67rC9CvjjSbGOisdb9G+4WH ViBAHHEScfhVDLoFw9fhijoPvCqNAIlK3izzi4RBaHB0Uw4OjvmQBXNDdL3Ofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679340015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mWx1P14KEWb+uSf3BvCmV/6ozTPkdj4keIDObublxeU=; b=H/xM6cCN5Cg8PuCQE830fJKk02U1lkKDaWVBxczWVZ7Q+lTcOOXVNmDby1sUsVmdi0hfed LkaXEtyXcibhRfEgtI7pu/8yDlqbMugp4IeEw9ZCt2oCsVbY7zVAPyPY69FT4+BhLOFzEl 3h8x19846i5SmSUfHz/FOBg09D17o/X1SOCT+0GAq/WMx6GOCjHWgs684RR+NOPST/ACp9 1mFtQCr22M0pIZkuM0dMMXALvM4q/0lNHpiocod0ot0OVl3I+CycvaATEFNk9EgiYiHuG4 N4BDOOvGbpFpC2G8VhZ3NwcrS+JZUnRqrlhoBbr0AcvV+2fzwhB9Vb5FWaRCWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679340015; a=rsa-sha256; cv=none; b=ZJojS8atUEG6y7f4jia3MDFqZ7eu67TuqikXTLcnSRFSbK8qptpD9fEwTMpZ5RO0ZvW8Um Efnv22MFA/XTQr6zu+tXPyChNu0zFEWbHvBu7oFuB0rCOAaSlIOXdPq/j+XNsk2xDFmS/e ooj2AUd1l0zG0YGuHT3+9d/F04otDRyMXVn+PvyutbkX5vqM+l19ObhN+aYhUXKXwig6CZ IYuNYcjxqzdaxkV6I1SQZKDUlDlcP024CTCAw14PzRjDwyCYiilORmg5ypnaCyvgjvOJvb jr+zEWiEvh5NwWBiUFmD7vUvNiqhtAT0KLPhryQ92JJsC9UiFeutQxsOLJJzrA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgPhH5WwyzhRd; Mon, 20 Mar 2023 19:20: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 32KJKFrq042216; Mon, 20 Mar 2023 19:20:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KJKF4t042213; Mon, 20 Mar 2023 19:20:15 GMT (envelope-from git) Date: Mon, 20 Mar 2023 19:20:15 GMT Message-Id: <202303201920.32KJKF4t042213@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: 3610bffd2888 - main - pkill: use an ARG_MAX size buffer for argument matching List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3610bffd2888b65389a46e8d075ce8e1fc83af4c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3610bffd2888b65389a46e8d075ce8e1fc83af4c commit 3610bffd2888b65389a46e8d075ce8e1fc83af4c Author: Kyle Evans AuthorDate: 2023-03-20 19:19:35 +0000 Commit: Kyle Evans CommitDate: 2023-03-20 19:19:36 +0000 pkill: use an ARG_MAX size buffer for argument matching Right now pkill/pgrep cut off at _POSIX2_LINE_MAX (2048), but argument strings can be much larger (ARG_MAX is 256K/512K). Stop arbitrarily cutting the search off at 2K, rather than documenting the limit. Reviewed by: allanjude (earlier version), des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38663 --- bin/pkill/pkill.c | 38 +++++++++++-- bin/pkill/tests/Makefile | 6 ++ bin/pkill/tests/pgrep-f_test.sh | 58 +++++++++++++++++++ bin/pkill/tests/spin_helper.c | 123 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 220 insertions(+), 5 deletions(-) diff --git a/bin/pkill/pkill.c b/bin/pkill/pkill.c index 0ffa5ababaac..6d8f29147a04 100644 --- a/bin/pkill/pkill.c +++ b/bin/pkill/pkill.c @@ -133,8 +133,9 @@ static int takepid(const char *, int); int main(int argc, char **argv) { - char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile; + char *buf, *mstr, **pargv, *p, *q, *pidfile; const char *execf, *coref; + size_t bufsz; int ancestors, debug_opt, did_action; int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock; size_t jsz; @@ -177,6 +178,7 @@ main(int argc, char **argv) } } + buf = NULL; ancestors = 0; criteria = 0; debug_opt = 0; @@ -311,6 +313,31 @@ main(int argc, char **argv) mypid = getpid(); + /* + * If we're not matching args, we only need a buffer large enough to + * hold some relatively short error strings. Otherwise, we have to + * assume we'll need up to ARG_MAX bytes for arguments. + */ + bufsz = _POSIX2_LINE_MAX; + if (matchargs) { + long arg_max; + + arg_max = sysconf(_SC_ARG_MAX); + if (arg_max == -1) + arg_max = ARG_MAX; + + /* + * The absolute worst case scenario is ARG_MAX single-byte + * arguments which we'll then separate with spaces and NUL + * terminate. + */ + bufsz = (arg_max * 2) + 1; + } + + buf = malloc(bufsz); + if (buf == NULL) + err(STATUS_ERROR, "malloc"); + /* * Retrieve the list of running processes from the kernel. */ @@ -346,7 +373,7 @@ main(int argc, char **argv) */ for (; *argv != NULL; argv++) { if ((rv = regcomp(®, *argv, cflags)) != 0) { - regerror(rv, ®, buf, sizeof(buf)); + regerror(rv, ®, buf, bufsz); errx(STATUS_BADUSAGE, "Cannot compile regular expression `%s' (%s)", *argv, buf); @@ -363,9 +390,9 @@ main(int argc, char **argv) if (matchargs && (pargv = kvm_getargv(kd, kp, 0)) != NULL) { jsz = 0; - while (jsz < sizeof(buf) && *pargv != NULL) { + while (jsz < bufsz && *pargv != NULL) { jsz += snprintf(buf + jsz, - sizeof(buf) - jsz, + bufsz - jsz, pargv[1] != NULL ? "%s " : "%s", pargv[0]); pargv++; @@ -384,7 +411,7 @@ main(int argc, char **argv) } else selected[i] = 1; } else if (rv != REG_NOMATCH) { - regerror(rv, ®, buf, sizeof(buf)); + regerror(rv, ®, buf, bufsz); errx(STATUS_ERROR, "Regular expression evaluation error (%s)", buf); @@ -576,6 +603,7 @@ main(int argc, char **argv) fprintf(stderr, "No matching processes belonging to you were found\n"); + free(buf); exit(rv ? STATUS_MATCH : STATUS_NOMATCH); } diff --git a/bin/pkill/tests/Makefile b/bin/pkill/tests/Makefile index be467074651f..9bf448bb2460 100644 --- a/bin/pkill/tests/Makefile +++ b/bin/pkill/tests/Makefile @@ -2,6 +2,11 @@ .include +PACKAGE= tests + +PROGS+= spin_helper +BINDIR= ${TESTSDIR} + TAP_TESTS_SH= pgrep-F_test TAP_TESTS_SH+= pgrep-LF_test TAP_TESTS_SH+= pgrep-P_test @@ -10,6 +15,7 @@ TAP_TESTS_SH+= pgrep-_g_test TAP_TESTS_SH+= pgrep-_s_test TAP_TESTS_SH+= pgrep-g_test TAP_TESTS_SH+= pgrep-i_test +TAP_TESTS_SH+= pgrep-f_test TAP_TESTS_SH+= pgrep-j_test TEST_METADATA.pgrep-j_test+= required_user="root" TEST_METADATA.pgrep-j_test+= required_programs="jail jls" diff --git a/bin/pkill/tests/pgrep-f_test.sh b/bin/pkill/tests/pgrep-f_test.sh new file mode 100644 index 000000000000..85b1878b97a6 --- /dev/null +++ b/bin/pkill/tests/pgrep-f_test.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# $FreeBSD$ + +: ${ARG_MAX:=524288} +base=$(dirname $(realpath "$0")) + +echo "1..2" + +waitfor() { + flagfile=$1 + + iter=0 + + while [ ! -f ${flagfile} ] && [ ${iter} -lt 50 ]; do + sleep 0.10 + iter=$((iter + 1)) + done + + if [ ! -f ${flagfile} ]; then + return 1 + fi +} + +sentinel="findme=test-$$" +sentinelsz=$(printf "${sentinel}" | wc -c | tr -d '[[:space:]]') +name="pgrep -f" +spin="${base}/spin_helper" +flagfile="pgrep_f_short.flag" + +${spin} --short ${flagfile} ${sentinel} & +chpid=$! +if ! waitfor ${flagfile}; then + echo "not ok - $name" +else + pid=$(pgrep -f ${sentinel}) + if [ "$pid" = "$chpid" ]; then + echo "ok - $name" + else + echo "not ok - $name" + fi +fi +kill $chpid + +name="pgrep -f long args" +flagfile="pgrep_f_long.flag" +${spin} --long ${flagfile} ${sentinel} & +chpid=$! +if ! waitfor ${flagfile}; then + echo "not ok - $name" +else + pid=$(pgrep -f ${sentinel}) + if [ "$pid" = "$chpid" ]; then + echo "ok - $name" + else + echo "not ok - $name" + fi +fi +kill $chpid diff --git a/bin/pkill/tests/spin_helper.c b/bin/pkill/tests/spin_helper.c new file mode 100644 index 000000000000..10541ad12516 --- /dev/null +++ b/bin/pkill/tests/spin_helper.c @@ -0,0 +1,123 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Klara, 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static int +exec_shortargs(char *argv[]) +{ + char *flag_arg = argv[2]; + char *sentinel = argv[3]; + char * nargv[] = { argv[0], __DECONST(char *, "--spin"), flag_arg, + sentinel, NULL }; + char * const nenvp[] = { NULL }; + + execve(argv[0], nargv, nenvp); + err(1, "execve"); +} + +static int +exec_largeargs(char *argv[]) +{ + char *flag_arg = argv[2]; + char *sentinel = argv[3]; + /* + * Account for each argument and their NUL terminator, as well as an + * extra NUL terminator. + */ + size_t bufsz = ARG_MAX - + ((strlen(argv[0]) + 1) + sizeof("--spin") + (strlen(flag_arg) + 1) + + (strlen(sentinel) + 1) + 1); + char *s = NULL; + char * nargv[] = { argv[0], __DECONST(char *, "--spin"), flag_arg, NULL, + sentinel, NULL }; + char * const nenvp[] = { NULL }; + + /* + * Our heuristic may or may not be accurate, we'll keep trying with + * smaller argument sizes as needed until we stop getting E2BIG. + */ + do { + if (s == NULL) + s = malloc(bufsz + 1); + else + s = realloc(s, bufsz + 1); + if (s == NULL) + abort(); + memset(s, 'x', bufsz); + s[bufsz] = '\0'; + nargv[3] = s; + + execve(argv[0], nargv, nenvp); + bufsz--; + } while (errno == E2BIG); + err(1, "execve"); +} + +int +main(int argc, char *argv[]) +{ + + if (argc > 1 && strcmp(argv[1], "--spin") == 0) { + int fd; + + if (argc < 4) { + fprintf(stderr, "usage: %s --spin flagfile ...\n", argv[0]); + return (1); + } + + fd = open(argv[2], O_RDWR | O_CREAT, 0755); + if (fd < 0) + err(1, "%s", argv[2]); + close(fd); + + for (;;) { + sleep(1); + } + + return (1); + } + + if (argc != 4) { + fprintf(stderr, "usage: %s [--short | --long] flagfile sentinel\n", + argv[0]); + return (1); + } + + if (strcmp(argv[1], "--short") == 0) + exec_shortargs(argv); + else + exec_largeargs(argv); +} From nobody Mon Mar 20 19:56:44 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQVP00NFz408tg; Mon, 20 Mar 2023 19:56: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 4PgQVN6X8dz3C87; Mon, 20 Mar 2023 19:56:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679342204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7jmeWLAa5PGOGaYOezNipd+VHeHHzlFxh1r19Qr/7Tk=; b=F3+AkSZuUxp0A/ae6x3okDOkzPoPC6n1at8K1lb/Q64Y07dCrut0GZyOtWmCppbDJvTI85 CyYSpdMbj7qgNBX2QsvN7EqcdUtGuzEGoazgAFtfZbsmwkxPUtHJ2dQWLPOEaRHmre3kQs 1erycnEI2pPE+CVcAo9q8m0yYmKQR4LePNgWExQPcKwNs7EYfZLi6JdmXqu4nFj/3mBNk7 l4s8ifK3wrGHPTMOagfzu5DJZ9PYFX3Gf5zLMeixokxj+Wg5y9/v+MuLdxqYG5mYENSgHP E+FTLv2IeyWKEJZfwIGn/bk+SvhrVBd/OVh7H83Uy14VME73zDyNcJWna6+hSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679342204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7jmeWLAa5PGOGaYOezNipd+VHeHHzlFxh1r19Qr/7Tk=; b=riOVmvFQw7PUtH8mTZJJadxicqRip/p0jxPDpNZYDEwe5GPcolXY09A1nCFRAOywOeXRqf 73lxqRd0VTLOQU79+4Ofs/UlZ9WwA69VS2jZCjwfJ3RPa6NgepkwY53odNnABSC8u7cNET r4fnQYM7rtp4UPhZ7L3P9xy2tBrZXe+qR1JQlYGvPPzJfWAjFpqm99jAbxHSDWzXy73/uh T4OhWPZKL8369Al4pAoo55akjsNvAH93jVZWgU5pPMf/u30I7y1TFmDdQdtarpzfH1VgaB 2/eHIE4WAj79YL04o4ngj2AbdN/zpHTgK14rzQDrJCDg0rfRMtRYSczaevB5+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679342204; a=rsa-sha256; cv=none; b=j842oW+TFzwaIv5BpymKaSdxQZEPcmcdP/vRXkoWgCkWVPb1jnpBA7quRX9CTJcxm7Z8fW 27Sj9043aiAC7YMcB18Yb8vYP9apHm5/RqKNvCIGnUqMOS11VNAuXpf674vI6H2f4+8998 j4mBbt3Yjkt/Lno7QMkVdLxSG87djTG1xotDQfIFcSR9G5g7Uk139iN1nfqCmkkZhsib/h vLVPxe8yNW7G73ZZpDsIUb0OqTuT3+FyXJ11yh/x1ZbNF9PwgKB1cvv44Oi4myAMmJlEPN KOw2HKfHw7L3CoyC25o10zvt5+gaKP/jm0IgaglRmyNiUeJ5jnzkWbYTAxUZDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQVN5ZHmzj2d; Mon, 20 Mar 2023 19:56: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 32KJuiJu099232; Mon, 20 Mar 2023 19:56:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KJuisn099231; Mon, 20 Mar 2023 19:56:44 GMT (envelope-from git) Date: Mon, 20 Mar 2023 19:56:44 GMT Message-Id: <202303201956.32KJuisn099231@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: 822057bfbbbc - main - pkill: tests: do a pass for case-sensitive conflicts List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 822057bfbbbcdb722a7ccd0e40d6b7e82b1d83f7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=822057bfbbbcdb722a7ccd0e40d6b7e82b1d83f7 commit 822057bfbbbcdb722a7ccd0e40d6b7e82b1d83f7 Author: Kyle Evans AuthorDate: 2023-03-20 19:51:41 +0000 Commit: Kyle Evans CommitDate: 2023-03-20 19:54:54 +0000 pkill: tests: do a pass for case-sensitive conflicts As in 76b6a59f9d30a5a39a5ed, encode upper-case flag tests with a leading underbar to avoid collisions (thus, erroneously dirty git repos) on case-sensitive filesystems. Sponsored by: Klara, Inc. --- ObsoleteFiles.inc | 10 ++++++++++ bin/pkill/tests/Makefile | 16 ++++++++-------- bin/pkill/tests/{pgrep-F_test.sh => pgrep-_f_test.sh} | 0 bin/pkill/tests/{pgrep-LF_test.sh => pgrep-_lf_test.sh} | 0 bin/pkill/tests/{pgrep-P_test.sh => pgrep-_p_test.sh} | 0 bin/pkill/tests/{pgrep-U_test.sh => pgrep-_u_test.sh} | 0 bin/pkill/tests/{pkill-F_test.sh => pkill-_f_test.sh} | 0 bin/pkill/tests/{pkill-LF_test.sh => pkill-_lf_test.sh} | 0 bin/pkill/tests/{pkill-P_test.sh => pkill-_p_test.sh} | 0 bin/pkill/tests/{pkill-U_test.sh => pkill-_u_test.sh} | 0 10 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2f71a267e627..2492bf4731ee 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,16 @@ # xargs -n1 | sort | uniq -d; # done +# 20230320: case-sensitive conflicts removed +OLD_FILES+=usr/tests/bin/pkill/pgrep-F_test +OLD_FILES+=usr/tests/bin/pkill/pgrep-LF_test +OLD_FILES+=usr/tests/bin/pkill/pgrep-P_test +OLD_FILES+=usr/tests/bin/pkill/pgrep-U_test +OLD_FILES+=usr/tests/bin/pkill/pkill-F_test +OLD_FILES+=usr/tests/bin/pkill/pkill-LF_test +OLD_FILES+=usr/tests/bin/pkill/pkill-P_test +OLD_FILES+=usr/tests/bin/pkill/pkill-U_test + # 20230309: remove remaining ATM support OLD_FILES+=usr/bin/sscop OLD_FILES+=usr/include/netnatm/addr.h diff --git a/bin/pkill/tests/Makefile b/bin/pkill/tests/Makefile index 9bf448bb2460..66a1d655b764 100644 --- a/bin/pkill/tests/Makefile +++ b/bin/pkill/tests/Makefile @@ -7,10 +7,10 @@ PACKAGE= tests PROGS+= spin_helper BINDIR= ${TESTSDIR} -TAP_TESTS_SH= pgrep-F_test -TAP_TESTS_SH+= pgrep-LF_test -TAP_TESTS_SH+= pgrep-P_test -TAP_TESTS_SH+= pgrep-U_test +TAP_TESTS_SH= pgrep-_f_test +TAP_TESTS_SH+= pgrep-_lf_test +TAP_TESTS_SH+= pgrep-_p_test +TAP_TESTS_SH+= pgrep-_u_test TAP_TESTS_SH+= pgrep-_g_test TAP_TESTS_SH+= pgrep-_s_test TAP_TESTS_SH+= pgrep-g_test @@ -27,10 +27,10 @@ TAP_TESTS_SH+= pgrep-s_test TAP_TESTS_SH+= pgrep-t_test TAP_TESTS_SH+= pgrep-v_test TAP_TESTS_SH+= pgrep-x_test -TAP_TESTS_SH+= pkill-F_test -TAP_TESTS_SH+= pkill-LF_test -TAP_TESTS_SH+= pkill-P_test -TAP_TESTS_SH+= pkill-U_test +TAP_TESTS_SH+= pkill-_f_test +TAP_TESTS_SH+= pkill-_lf_test +TAP_TESTS_SH+= pkill-_p_test +TAP_TESTS_SH+= pkill-_u_test TAP_TESTS_SH+= pkill-_g_test TAP_TESTS_SH+= pkill-g_test TAP_TESTS_SH+= pkill-i_test diff --git a/bin/pkill/tests/pgrep-F_test.sh b/bin/pkill/tests/pgrep-_f_test.sh similarity index 100% rename from bin/pkill/tests/pgrep-F_test.sh rename to bin/pkill/tests/pgrep-_f_test.sh diff --git a/bin/pkill/tests/pgrep-LF_test.sh b/bin/pkill/tests/pgrep-_lf_test.sh similarity index 100% rename from bin/pkill/tests/pgrep-LF_test.sh rename to bin/pkill/tests/pgrep-_lf_test.sh diff --git a/bin/pkill/tests/pgrep-P_test.sh b/bin/pkill/tests/pgrep-_p_test.sh similarity index 100% rename from bin/pkill/tests/pgrep-P_test.sh rename to bin/pkill/tests/pgrep-_p_test.sh diff --git a/bin/pkill/tests/pgrep-U_test.sh b/bin/pkill/tests/pgrep-_u_test.sh similarity index 100% rename from bin/pkill/tests/pgrep-U_test.sh rename to bin/pkill/tests/pgrep-_u_test.sh diff --git a/bin/pkill/tests/pkill-F_test.sh b/bin/pkill/tests/pkill-_f_test.sh similarity index 100% rename from bin/pkill/tests/pkill-F_test.sh rename to bin/pkill/tests/pkill-_f_test.sh diff --git a/bin/pkill/tests/pkill-LF_test.sh b/bin/pkill/tests/pkill-_lf_test.sh similarity index 100% rename from bin/pkill/tests/pkill-LF_test.sh rename to bin/pkill/tests/pkill-_lf_test.sh diff --git a/bin/pkill/tests/pkill-P_test.sh b/bin/pkill/tests/pkill-_p_test.sh similarity index 100% rename from bin/pkill/tests/pkill-P_test.sh rename to bin/pkill/tests/pkill-_p_test.sh diff --git a/bin/pkill/tests/pkill-U_test.sh b/bin/pkill/tests/pkill-_u_test.sh similarity index 100% rename from bin/pkill/tests/pkill-U_test.sh rename to bin/pkill/tests/pkill-_u_test.sh From nobody Mon Mar 20 20:07:53 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQlF5LHYz409vf; Mon, 20 Mar 2023 20:07: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 4PgQlF4p3Rz3GCM; Mon, 20 Mar 2023 20:07:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679342873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f4jGDJYMNFGgSi6jwsd3UZHEQxKzf8yNXNxiduWxE6I=; b=birPfjpVc/5zELnIO5dnKCKomgKiQAxxNHZ8ysSRi+po5yZDLIZZVYTZ6UgP03drc+XNce Cu2hlsEibn6adTWSFPNmM/Bey53VWOhVZgmBcKdqdPATc9QmTdFcdowTzKGPe6O1/2pAUp uxLpX/8m6Tj0xD4cTFZevIXoQG3RhrM9r6XBZlhH5ey3ZXjmYq4rTRLRTpyRmidSrOjUUO h1UFCk/vV37BvPWOL/Y8EYWw7eTEs3PAmAMqUC9W11O/g43qqH0cuCq27n7Qk7rrby/X4I SjFydYDjA2R+E7frY2dPdtXhKO8BMegtgSF9+L1s69wTgxvhLbwcM2o/O8OadA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679342873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f4jGDJYMNFGgSi6jwsd3UZHEQxKzf8yNXNxiduWxE6I=; b=i/w/EqaPyt1IjAN1s2Xa/xaJ6lMP5voOTbpgNz2IdsmMyJdJugZjznjWA5VhFfNKyNZACC 0bw29/dprKSbFrbsCQH02y3bJMTCG8sHqsyFhPkkYD61IP6FYQLlt+i7vQr2gq0MJhGIHg mv3tk8G+2+vO87R8+EWKNn7v+enlZh7QKgsSUd0AlNGgQfu0WjU1AF7HHJtNCQFFvNX+mZ dM8hMv1J0TPxexA5v+bGBwib98jc6oKhpM9Tfr4CmS3gz3kPoaR+1Ez1BX9+amwAsHhQ1M rshoPSZCpWDdnzKuEIaRQ5fnth7P2jHmFftriXKgDxkNL49jstGljiCy2Z7QZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679342873; a=rsa-sha256; cv=none; b=cvqlk+882D2uMBBOz712N/ZjmDaVY9mbqwh/0w+Cf1Ta+ag+Gu59Wftxq8uB/oD7s7aco6 GcJKb2e92aziyEgI0vg13oSom7/SfnARqoJ+95ac37dwM8/y2RT6XQjikMVOW9gGGdHHUa 8ORxWXl2eSYVHYPL8TpeM6Ip2LLcvCuQQgFzMFpzE6ICkIeXPntmjdpHZHNw5CmQFuczRS GfsMoMhYvJlD/dpkZULng+SeJAOtkmBm30nIj9G30d5gegpcEFROWD6PoDyn7tPvLciF/p V8qwfMQWeAqmYdPx3o4ljpFc/yshQ+x/eAqsudmX7Sd3a6d8k6WkLIE0kNR1fA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQlF3rvlzk2V; Mon, 20 Mar 2023 20:07: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 32KK7rsp016740; Mon, 20 Mar 2023 20:07:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KK7ria016739; Mon, 20 Mar 2023 20:07:53 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:07:53 GMT Message-Id: <202303202007.32KK7ria016739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: bb95e6fa98a3 - main - Fix compilation issue, when DTRACE is not defined List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb95e6fa98a33ec3fdfed76249d5fdf863e930b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=bb95e6fa98a33ec3fdfed76249d5fdf863e930b0 commit bb95e6fa98a33ec3fdfed76249d5fdf863e930b0 Author: Fedor Uporov AuthorDate: 2023-03-20 20:04:38 +0000 Commit: Fedor Uporov CommitDate: 2023-03-20 20:06:57 +0000 Fix compilation issue, when DTRACE is not defined PR: 270346 Reported by: Michael Paepcke MFC after: 2 week --- sys/fs/ext2fs/ext2_lookup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 0de8c103b7f1..990cfa1260c7 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -799,12 +799,9 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, void ext2_dirbad(struct inode *ip, doff_t offset, char *how) { - struct mount *mp __sdt_used; - - mp = ITOV(ip)->v_mount; SDT_PROBE4(ext2fs, , trace, ext2_dirbad_error, - mp->mnt_stat.f_mntonname, ip->i_number, offset, how); + ITOV(ip)->v_mount->mnt_stat.f_mntonname, ip->i_number, offset, how); } /* From nobody Mon Mar 20 20:13:23 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsb3l0vz40Bql; Mon, 20 Mar 2023 20:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgQsb3CRsz3HgC; Mon, 20 Mar 2023 20:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tH4VPQapG7j8LUzfMaov2d/DvaLLGy18t78h+clsAgQ=; b=WhGJ+qSbvIDpxgT9R4oC/Zfe7lbS2POrMCrdL24LadhEMlVKGwKGzaGWYIu28dnNf8KeUl zHJZx/EGTBQgpD3mawba2+3u5W7ZhFTW7lRxLiJ44UxG/5LyWd6dnO3pdNIUBsF7U75eh3 2Gg8w5Z0LmS2dTac2cdWNT8Hvjivx3IzBu03G5obQJGElJzdG36u/+nBG9UswS+yLAaSU2 S3BUsFDVIse2USlvHlNecDXhgf3Z4rqAULJEi4tW1cRlF8acsflen1rG0qhJCwRbRk86QM TCOcCSxlJ4HniC2byNLUJV62pLicMQxFL5NFwQ2PeBwh8KlHxBPBHnzNeOILrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tH4VPQapG7j8LUzfMaov2d/DvaLLGy18t78h+clsAgQ=; b=sjr4wKN35XHRIP7tt+o5bF4XEYQa51mnDkHrAep8Bl+AjAfkacovsoFfdO3Ox40HZsYcsn Sr0zd9ov9bfzCMOZOjiCZEH7NYfzpYvv5ug73BQRV+/D597vbIP7c6zEubY6DffLgEuBea pfOlDxt8jcQor62tZ+XPR0Om1+oVWhJxQQklRgb4hXbSbvpjAfVu8jg7PccIbMpMRWUGWJ McwfKMiOhJGHJyKm+wXi8T4YCPQPMjCWl4ypyryagO6VJDoUp0AdZhM0jbXqXyfPH61ih9 x6DsEOmQ21FULLn68jPwrHXRqlf0FcKHTQZYkTUIpZSIn+Vgwb/tqJdXrehCbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343203; a=rsa-sha256; cv=none; b=XRiL+AeZMuKHgc6vadN2lbIpSPxIWNdUwo2wDF395gBwQRNCYETQOmxXqaSC9a5uTeG3lO VWESwFuqmr/YlCzWQ4PxPaJxeGK7jC7gLwSTdNTiBPvwgcV6as6I3lJuEhXOMJjCOk3PmA 9PYd1doI7NssZkveGoHF48zyZRmeQIKQCFTb19kSkYStbJGXu74qTTG6x0lVmXpsjvUJ8W LLVUg6tL3+owlGYCOqBB3w6Im6EQaJ/99C7hky+sQbnTNdKbh1/xEgl5pc0Suqp3Dv91mo Qz62XoEWPBmpQUCGFrqjJ4biysNCjmd7Mu0Ob3Ypo9T6CzSfTIJG+e4fS02mPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsb2Gw8zkSh; Mon, 20 Mar 2023 20:13: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 32KKDNAf033044; Mon, 20 Mar 2023 20:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDNhX033043; Mon, 20 Mar 2023 20:13:23 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:23 GMT Message-Id: <202303202013.32KKDNhX033043@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b54391a1f831 - main - vcount.9: remove obsolete man page List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b54391a1f83169f847e5f28e29d1938a154d54e0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b54391a1f83169f847e5f28e29d1938a154d54e0 commit b54391a1f83169f847e5f28e29d1938a154d54e0 Author: Mitchell Horne AuthorDate: 2023-03-20 19:49:59 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:11 +0000 vcount.9: remove obsolete man page These functions, vcount() and count_dev(), no longer exist in the source tree. Reviewed by: rpokala MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39128 --- ObsoleteFiles.inc | 4 +++ share/man/man9/Makefile | 2 -- share/man/man9/vcount.9 | 73 ------------------------------------------------- 3 files changed, 4 insertions(+), 75 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2492bf4731ee..e3cb44fa9f84 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20230320: vcount.9 removed +OLD_FILES+=usr/share/man/man9/count_dev.9.gz +OLD_FILES+=usr/share/man/man9/vcount.9.gz + # 20230320: case-sensitive conflicts removed OLD_FILES+=usr/tests/bin/pkill/pgrep-F_test OLD_FILES+=usr/tests/bin/pkill/pgrep-LF_test diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ab6f146fa2a9..2d8d0e94c71b 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -346,7 +346,6 @@ MAN= accept_filter.9 \ vaccess.9 \ vaccess_acl_nfs4.9 \ vaccess_acl_posix1e.9 \ - vcount.9 \ vflush.9 \ VFS.9 \ vfs_busy.9 \ @@ -2316,7 +2315,6 @@ MLINKS+=usbdi.9 usbd_do_request.9 \ usbdi.9 usb_fifo_softc.9 \ usbdi.9 usb_fifo_wakeup.9 .endif -MLINKS+=vcount.9 count_dev.9 MLINKS+=vfsconf.9 vfs_modevent.9 \ vfsconf.9 vfs_register.9 \ vfsconf.9 vfs_unregister.9 diff --git a/share/man/man9/vcount.9 b/share/man/man9/vcount.9 deleted file mode 100644 index 186a350ac56b..000000000000 --- a/share/man/man9/vcount.9 +++ /dev/null @@ -1,73 +0,0 @@ -.\" -*- nroff -*- -.\" -.\" Copyright (c) 2000 Andrew Stevenson -.\" -.\" All rights reserved. -.\" -.\" This program is free software. -.\" -.\" 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. -.\" -.\" If this manual page travels to places exotic (like projects other than -.\" FreeBSD) I would love to hear about it. -.\" Andrew -.\" -.\" $FreeBSD$ -.\" -.Dd January 19, 2012 -.Dt VCOUNT 9 -.Os -.Sh NAME -.Nm vcount , -.Nm count_dev -.Nd "get total number of references to a device" -.Sh SYNOPSIS -.In sys/param.h -.In sys/time.h -.In sys/conf.h -.In sys/vnode.h -.Ft int -.Fn vcount "struct vnode *vp" -.Ft int -.Fn count_dev "struct cdev *dev" -.Sh DESCRIPTION -.Fn vcount -is used to get the number of references to a particular device. -It allows for the fact that multiple vnodes may reference the same device. -.Fn count_dev -does the same thing as -.Fn vcount , -but takes a -.Vt "struct cdev" -rather than a -.Vt "struct vnode" -pointer as an argument. -.Sh RETURN VALUES -.Fn vcount -and -.Fn count_dev -both return the number of references to the device. -.Sh SEE ALSO -.Xr VFS 9 , -.Xr vnode 9 -.Sh AUTHORS -This manual page was written by -.An Andrew Stevenson . From nobody Mon Mar 20 20:13:24 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsc4nKHz40Bqw; Mon, 20 Mar 2023 20:13: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 4PgQsc462Kz3HjM; Mon, 20 Mar 2023 20:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gj7DVzVIqfpjq9xn8ndix3S6SK+ToQ0Q64f9tRHGEEI=; b=nZt9ggfrqcxlcGoU5ZoqfAGvAg0CUmADidX/9jjXepKIeK6znJh230AQUfW1ukn4w5bb73 dqR+bw2FDtTbbj+MKe9dug92qcUU5ytu+fIW6zPH9R1F9YVkd0KzyX2zIJCHZ2x6S8xVfT TVU76e61WeeSSvASiQRrmap57Rkbl2Hf+mNH4g63Tf7cKDyEuH0q7s7c+rp4bpp3puS7vO Is2ViDQp9M+PUVK1ltOM/Y5IQQ3Tv3OD9HZCwmZHbB9KL60vDT9IMJwT1h86b+vlrpZt0G lGrvS4UNRgs9mJ1Ve8Zd6z4cFA6D2H6JWObDWhKqC7UQTRpcsT54d/lhIlRK1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gj7DVzVIqfpjq9xn8ndix3S6SK+ToQ0Q64f9tRHGEEI=; b=aKGBY8gOKdz/qxDYgH9IWVyeOrFPc7UJjUSFIC9bRIghkU7nScaV7+yojck2HD0Y7Ss88h BTI8wh9DcPuumF/iJx2Hr5D3gkgAn+IMt9elPaL1111x5tCY2n3dJD3OXLrSb48jgC9xgv rAgDOvzzMz3gyLEhf+b+hXfepDvBibyL/1xX7GQlAhOclDHl4K4iGs8wHHFNSXtGRFKi8B CDZYIaQLj7sDJB4MwsqRIhbjZzB+oEwor3gEzgiO8nV+/ETwMjF7fJlNdoui7B5pDmN6lb S8tooNtKfblajOh5SsC9gn5TZYmq8SnKqx50GrgGnxgiSf8DJGUOKU1KJf6dOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343204; a=rsa-sha256; cv=none; b=rGEmOtTRbnMDuZDCiO/X1XW60J6pM+zr2ZHc4pzaN4J+qLUpYDjDMefXVQD8s//WOvUy5S de6lIpu1DzuisjyZo6lR1l7Gmid4eurNR2ZTJJdiRn+eQYqiaVkKDG0N2VKpOtOLHDvY11 cWFfF9r9ZYotx41H47M0ug6fSMVKXIoh1q9wTEY8a2TO7jArfzvnHRdjh4LOL5Ewc3ngwO H3pJoycCczAxyal5xkFAINjsT7i6S/dDBMBYlsBTKUDGzjiZlhRCLNBF2lVYjb9MJWhdDi iFDyjnElU3PbetraMmOgt1//W4DvWTOPDIbTPFdn43KYMMfRTjSi3dsU2dgPjg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsc39ydzkSj; Mon, 20 Mar 2023 20:13: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 32KKDOFf033070; Mon, 20 Mar 2023 20:13:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDOLE033069; Mon, 20 Mar 2023 20:13:24 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:24 GMT Message-Id: <202303202013.32KKDOLE033069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 43db15b16aa6 - main - critical(9): small updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43db15b16aa6ee24613d0b25cbf50f2aef5850d1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=43db15b16aa6ee24613d0b25cbf50f2aef5850d1 commit 43db15b16aa6ee24613d0b25cbf50f2aef5850d1 Author: Mitchell Horne AuthorDate: 2023-03-20 19:50:50 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:11 +0000 critical(9): small updates - Document CRITICAL_ASSERT() in this man page. - Clarify that a thread may also handle interrupts in a critical section, not only faults/exceptions. - Note the negative effects of critical section abuse - Some other minor clarifications - Add short SEE ALSO Reviewed by: kib, markj, rpokala, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39130 --- share/man/man9/Makefile | 3 ++- share/man/man9/critical_enter.9 | 48 +++++++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 2d8d0e94c71b..fdd81ba18b11 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -929,7 +929,8 @@ MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \ cpuset.9 CPU_OR_ATOMIC.9 \ cpuset.9 CPU_COPY_STORE_REL.9 MLINKS+=critical_enter.9 critical.9 \ - critical_enter.9 critical_exit.9 + critical_enter.9 critical_exit.9 \ + critical_enter.9 CRITICAL_ASSERT.9 MLINKS+=crypto_buffer.9 crypto_apply.9 \ crypto_buffer.9 crypto_apply_buf.9 \ crypto_buffer.9 crypto_buffer_contiguous_segment.9 \ diff --git a/share/man/man9/critical_enter.9 b/share/man/man9/critical_enter.9 index 3da3ac1d96a1..8a702e3c44fd 100644 --- a/share/man/man9/critical_enter.9 +++ b/share/man/man9/critical_enter.9 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2005 +.Dd March 20, 2023 .Dt CRITICAL_ENTER 9 .Os .Sh NAME @@ -37,15 +37,24 @@ .Fn critical_enter "void" .Ft void .Fn critical_exit "void" +.Fn CRITICAL_ASSERT "struct thread *td" .Sh DESCRIPTION These functions are used to prevent preemption in a critical region of code. All that is guaranteed is that the thread currently executing on a CPU will not be preempted. -Specifically, a thread in a critical region will not migrate to another -CPU while it is in a critical region. +Specifically, a thread in a critical region will not migrate to another CPU +while it is in a critical region, nor will the current CPU switch to a +different thread. The current CPU may still trigger faults and exceptions during a critical section; however, these faults are usually fatal. .Pp +The CPU might also receive and handle interrupts within a critical section. +When this occurs the interrupt exit will not result in a context switch, and +execution will continue in the critical section. +Thus, the net effect of a critical section on the current thread's execution is +similar to running with interrupts disabled, except that timer interrupts and +filtered interrupt handlers do not incur a latency penalty. +.Pp The .Fn critical_enter and @@ -56,18 +65,39 @@ while the current thread is in a critical section, then the preemption will be deferred until the current thread exits the outermost critical section. .Pp -Note that these functions are not required to provide any inter-CPU -synchronization, data protection, or memory ordering guarantees and thus -should +Note that these functions do not provide any inter-CPU synchronization, data +protection, or memory ordering guarantees, and thus should .Em not be used to protect shared data structures. .Pp -These functions should be used with care as an infinite loop within a -critical region will deadlock the CPU. +These functions should be used with care as an unbound or infinite loop within +a critical region will deadlock the CPU. Also, they should not be interlocked with operations on mutexes, sx locks, -semaphores, or other synchronization primitives. +semaphores, or other synchronization primitives, as these primitives may +require a context switch to operate. One exception to this is that spin mutexes include a critical section, so in certain cases critical sections may be interlocked with spin mutexes. +.Pp +Critical regions should be only as wide as necessary. +That is, code which does not require the critical section to operate correctly +should be excluded from its bounds whenever possible. +Abuse of critical sections has an effect on overall system latency and timer +precision, since disabling preemption will delay the execution of threaded +interrupt handlers and +.Xr callout 9 +events on the current CPU. +.Pp +The +.Fn CRITICAL_ASSERT +macro verifies that the provided thread +.Fa td +is currently executing in a critical section. +It is a wrapper around +.Xr KASSERT 9 . +.Sh SEE ALSO +.Xr callout 9 , +.Xr KASSERT 9 , +.Xr locking 9 .Sh HISTORY These functions were introduced in .Fx 5.0 . From nobody Mon Mar 20 20:13:25 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsf0PBNz40Bf4; Mon, 20 Mar 2023 20:13: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 4PgQsd5HXWz3J2j; Mon, 20 Mar 2023 20:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MaEePwkcXh0iJhivJgNkzeidBYkMOf6rXQbSZNVOn6c=; b=a5ppWxJZUlBa/ZYtWUY0zCIRnfrdZbqWfUB/4qLRo1jYobI6ufeIIg3Y2WKE9DsvDI/Utm jGupLGYubYr+2CYXEK5/Gb0mAMv48qzGE/qB9CPvVu6ENSO6XTKvs4Jl/mmSRm4gqeyb0V pLJENBhzfWkm4uxCaz+H5nET6cUw7IcY/dObt4I9doLKfREgB4ZN2/9XWvf79DbYx8RDC7 ZY3ZSxlScWbzWphAEaggSoeiD/1i3EpbpdFHAq92/LIgj6Klqt/9M40b4zDNUldM5gdI9W h4jxWeyGxLdIK2QC/oEP2pzML5AsbHcVAvOoakjeefZ2UWxsXTEHPGg9uuuW0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MaEePwkcXh0iJhivJgNkzeidBYkMOf6rXQbSZNVOn6c=; b=DTPj757lsvyCQ5+s2vQpTmK/wHj3m/Gx6YzyNvmOAH44wvU2FyxbP1cAWQMYiu3SXZjWvz khu8rkBhkngnYBTVdp8+o4WRbbBm9oi/lhl6PPsERFc+GAgN3LqpLzybJ5DduXRJnuVGCz e4S64snu9a3VIV/EkDHWIW9vl1/DwKGnVHliXHZ+7L9W0zexZ3oUnMvgee/u8RNXi5Xcgz 2uq5lfJQMle/6a3mzDLAYVt6Nl00wiyRGzGcLjD/u+OIZM5hwrAT+3aZ/dZD67mpZJPB9V 27mblwaq95aamPl/PX7Mjg967Zy1Ub1A4U3sBp+JKsf/Rtr6Gvaha8Jr8ezdWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343205; a=rsa-sha256; cv=none; b=WgUIKUal5QrW3mwXmaDV3rs0QJvD2V+ZxawoPGVIOHOl3piEgWs2UDjOlXjs3UkSJ2V5if ljW4tfsfUW8yeIkZX578ejHq6tKyxXJ2c4UsGN18AirdNC47VV1FhB+K/NdegcXik68OJ0 jmYvYEzXxa7vgIQH+4M5iUOKfuLolE7y/Qn8m0XXdvKGoqwH595LvTe8P/QzvX9HG6OC5D 2FjszLUYbdhr6bYixc1bfjUe32pu6/dD8hK1m3+LHCrjOx62ebkBcZ9xe22v5BrI2dVh7c rL7h8VxuvMuZcXfYc9cL+93RwRM4VXX1K0eX1GV7uQ9MNO2/Qqcossd4f+kLgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsd4Ks5zjyT; Mon, 20 Mar 2023 20: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 32KKDPvr033089; Mon, 20 Mar 2023 20: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 32KKDPLD033088; Mon, 20 Mar 2023 20:13:25 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:25 GMT Message-Id: <202303202013.32KKDPLD033088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 87132d1dce4b - main - KASSERT(9): some updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87132d1dce4b61c782871f450c17b818bf991ff6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=87132d1dce4b61c782871f450c17b818bf991ff6 commit 87132d1dce4b61c782871f450c17b818bf991ff6 Author: Mitchell Horne AuthorDate: 2023-03-20 19:54:11 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:11 +0000 KASSERT(9): some updates - Add a little bit of introductory text - Improve the existing example: ANSI C, use a better assertion than a NULL check (which is discouraged) - Document the widely used MPASS macro in this page - Drop the cross-reference to config(8) Reviewed by: kib, markj, rpokala, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39131 --- share/man/man9/KASSERT.9 | 104 ++++++++++++++++++++++++++++++++++------------- share/man/man9/Makefile | 1 + 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/share/man/man9/KASSERT.9 b/share/man/man9/KASSERT.9 index 0c6898a7799b..de2b9ca8d2a8 100644 --- a/share/man/man9/KASSERT.9 +++ b/share/man/man9/KASSERT.9 @@ -1,8 +1,11 @@ -.\" -*- nroff -*- +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2000 Jonathan M. Bresler -.\" .\" All rights reserved. +.\" Copyright (c) 2023 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Mitchell Horne +.\" under sponsorship from the FreeBSD Foundation. .\" .\" This program is free software. .\" @@ -28,59 +31,102 @@ .\" .\" $FreeBSD$ .\" -.Dd January 14, 2000 +.Dd March 16, 2023 .Dt KASSERT 9 .Os .Sh NAME .Nm KASSERT -.Nd kernel expression verification macro +.Nd kernel expression verification macros .Sh SYNOPSIS .Cd "options INVARIANTS" .Pp .In sys/param.h .In sys/systm.h .Fn KASSERT expression msg +.Fn MPASS expression .Sh DESCRIPTION -In a kernel compiled with -.Cd "options INVARIANTS" , -the -.Fn KASSERT -macro tests the given -.Fa expression -and if it is false, -calls the +Assertions are widely used within the +.Fx +kernel to verify programmatic assumptions. +For violations of run-time assumptions and invariants, it is desirable to fail +as soon and as loudly as possible. +Assertions are optional code; for non-recoverable error conditions an explicit +call to .Xr panic 9 -function, terminating the running system. +is usually preferred. .Pp -In a kernel that does not have +The +.Fn KASSERT +macro tests the given boolean +.Fa expression . +If +.Fa expression +evaluates to +.Dv false , +and the kernel is compiled with .Cd "options INVARIANTS" , the -.Fn KASSERT -macro is defined to be a no-op. -The -second argument is a +.Xr panic 9 +function is called. +This terminates the running system at the point of the error, possibly dropping +into the kernel debugger or initiating a kernel core dump. +The second argument, +.Fa msg , +is a .Xr printf 9 format string and its arguments, enclosed in parentheses. +The formatted string will become the panic string. +.Pp +In a kernel that is built without +.Cd "options INVARIANTS" , +the assertion macros are defined to be no-ops. +This eliminates the runtime overhead of widespread assertions from release +builds of the kernel. +Therefore, checks which can be performed in a constant amount of time can be +added as assertions without concern about their performance impact. +More expensive checks, such as those that output to console, or verify the +integrity of a chain of objects are generally best hidden behind the +.Cd DIAGNOSTIC +kernel option. +.Pp +The +.Fn MPASS +macro (read as: "must-pass") +is a convenience wrapper around +.Fn KASSERT +that automatically generates a sensible assertion message including file and +line information. .Sh EXAMPLES -The kernel function -.Fn vput -must not be called with a -.Dv NULL -pointer. +A hypothetical +.Vt struct foo +object must not have its 'active' flag set when calling +.Fn foo_dealloc : .Bd -literal -offset indent void -vput(vp) - struct vnode *vp; +foo_dealloc(struct foo *fp) { - struct proc *p = curproc; - KASSERT(vp != NULL, ("vput: null vp")); + + KASSERT((fp->foo_flags & FOO_ACTIVE) == 0, + ("%s: fp %p is still active", __func__, fp)); ... } .Ed +.Pp +The assertion +.Bd -literal -offset indent +MPASS(td == curthread); +.Ed +.Pp +located on line 87 of a file named foo.c would generate the following panic +message: +.Bd -literal -offset indent +panic: Assertion td == curthread failed at foo.c:87 +.Ed .Sh SEE ALSO -.Xr config 8 , .Xr panic 9 .Sh AUTHORS This manual page was written by -.An Jonathan M. Bresler Aq Mt jmb@FreeBSD.org . +.An Jonathan M. Bresler Aq Mt jmb@FreeBSD.org +and +.An Mitchell Horne Aq Mt mhorne@FreeBSD.org . diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index fdd81ba18b11..875a7f52be77 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1334,6 +1334,7 @@ MLINKS+=intr_event.9 intr_event_add_handler.9 \ intr_event.9 intr_event_handle.9 \ intr_event.9 intr_event_remove_handler.9 \ intr_event.9 intr_priority.9 +MLINKS+=KASSERT.9 MPASS.9 MLINKS+=kern_yield.9 maybe_yield.9 \ kern_yield.9 should_yield.9 MLINKS+=kernacc.9 useracc.9 From nobody Mon Mar 20 20:13:26 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsf71xYz40BZR; Mon, 20 Mar 2023 20:13: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 4PgQsf68Bdz3J4k; Mon, 20 Mar 2023 20:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SUrd9XgzO8CrXLxihjkEZQNBXlTNOnuKISxJ9dhef1k=; b=wZ99sf9D53x7OHh+Obs4LB83a4YQFuWhfJ/P3WKDTQwubjTcYETLvTwL6icYMHeA95S1Vb nTXG6WKcfTZQ6edR8sUPWWMDavhD6rmqXhrTDwll+2vAQVTlwrTC9TK1BH5VpNe4bGb7iK Cqvh0kiUaDwNTV8HpeSUqCfMr5k2UfHfLopHCTzXCAdNX1Bizzami9tPwqmYS6XP+kN56o DwadzUWufxdJGHUQHc8w61+4YGOXpsR+6G6bmCocybZ6MYZ/ZTmUZd4jwjiUAdsda+nDu/ xe01PlNLaTIr6ZDAjduc4T2dPEuIXWwKz+xc/APczgK7ogwyGQy/N0XyLXCilQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SUrd9XgzO8CrXLxihjkEZQNBXlTNOnuKISxJ9dhef1k=; b=lCsFIdoxY4vdrRyRnSEa1raZTCng9KNMoc44CXDEAldSsrDbmlMAknvyXfJRM7CxHZKgfj e3fDtjSiYoRgdnkv+VR3qc+FacuX6YtNCk20IM8TJ9URYti/xcs4aWA1bSbcfwajUh+zyZ PDhE0CpXADezY0xtyygoGVAhg3DG6WU4NF3rj0VOc2plAFUiQ2QPprjxfU9kFdLLPETT45 +Koeh09UETBdkrGpSJiDucge2VowlQT2gOr0qSFN5pYPd0ACSVOFMGfWIkOthbNfGcDHSd Jq/t3DrjyoXoXh2uQaMYc3uSEnIc9XkO5p8NmBo8tDq0Vj5q8aPINjggFLeeJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343206; a=rsa-sha256; cv=none; b=uUuJX60YJsXzZkhSzUeR+Jzddw1IgJLoSX7kSVHd1WUlU//GdKamDnI7O4Pj0maZVPGzPG GSukpNiV7K+2MtJwys/oOYvIbb0Dg4SL13xq8p7hLn15ntBidJ0Lr3xJlGGujVmb4UZGVv MfFIwmYnL7ObIzENBRVfIL5tXh+gAQfrAqhadMGloivyFFkTSOfoTpckrVs7TvGrRrWdDC LQ5Cu2dz+Vl2mcEaMHSfbFf+UrA8MTVsFOMjJYJB57Na55aUJXrVEneclLnzbdax4rI3l9 3CqHu1y91w9kcgUQ7VR960uNqOPjLC9Ly4Pal2QvZi54Z27+xTXeyYj0Z/CxMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsf5GKtzkSk; Mon, 20 Mar 2023 20:13: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 32KKDQP3033109; Mon, 20 Mar 2023 20:13:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDQ0h033108; Mon, 20 Mar 2023 20:13:26 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:26 GMT Message-Id: <202303202013.32KKDQ0h033108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: d5e105bf7e4c - main - panic(9): some updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5e105bf7e4cb7e80eb4a4f8960bd6dd12fc4885 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d5e105bf7e4cb7e80eb4a4f8960bd6dd12fc4885 commit d5e105bf7e4cb7e80eb4a4f8960bd6dd12fc4885 Author: Mitchell Horne AuthorDate: 2023-03-20 19:55:55 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:11 +0000 panic(9): some updates - Better description of what the panic() function does - Document KERNEL_PANICKED() - Add a section describing panic execution context - Add SEE ALSO Reviewed by: kib, markj, rpokala MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39132 --- share/man/man9/Makefile | 3 +- share/man/man9/panic.9 | 109 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 875a7f52be77..eb6b37f41650 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1733,7 +1733,8 @@ MLINKS+=osd.9 osd_call.9 \ osd.9 osd_reserve.9 \ osd.9 osd_set.9 \ osd.9 osd_set_reserved.9 -MLINKS+=panic.9 vpanic.9 +MLINKS+=panic.9 vpanic.9 \ + panic.9 KERNEL_PANICKED.9 MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_alloc_msix.9 \ pci.9 pci_disable_busmaster.9 \ diff --git a/share/man/man9/panic.9 b/share/man/man9/panic.9 index c467b86dd5a1..bc9b1b9e85fb 100644 --- a/share/man/man9/panic.9 +++ b/share/man/man9/panic.9 @@ -1,7 +1,13 @@ .\" $NetBSD: panic.9,v 1.2 1996/10/09 17:20:04 explorer Exp $ .\" +.\" SPDX-License-Identifier: BSD-4-Clause +.\" .\" Copyright (c) 1996 Michael Graff. .\" All rights reserved. +.\" Copyright (c) 2023 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Mitchell Horne +.\" 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 @@ -15,7 +21,7 @@ .\" must display the following acknowledgement: .\" This product includes software developed by Michael Graff .\" for the NetBSD Project. -.\" 3. The name of the author may not be used to endorse or promote products +.\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR @@ -31,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2015 +.Dd March 17, 2023 .Dt PANIC 9 .Os .Sh NAME @@ -40,10 +46,12 @@ .Sh SYNOPSIS .In sys/types.h .In sys/systm.h +.Vt extern char *panicstr; .Ft void .Fn panic "const char *fmt" ... .Ft void .Fn vpanic "const char *fmt" "va_list ap" +.Fn KERNEL_PANICKED .Sh DESCRIPTION The .Fn panic @@ -55,20 +63,97 @@ The message is a .Xr printf 3 style format string. -The message is printed to the console and the location -.Fa panicstr -is set to the address of the message text for retrieval from the OS -core dump. +The message is printed to the console and +.Va panicstr +is set pointing to the address of the message text. +This can be retrieved from a core dump at a later time. .Pp -If the kernel debugger is installed control is passed to it, otherwise -an attempt to save a core dump of the OS to a configured dump device -is made. +Upon entering the +.Fn panic +function the panicking thread disables interrupts and calls +.Xr critical_enter 9 . +This prevents the thread from being preempted or interrupted while the system +is still in a running state. +Next, it will instruct the other CPUs in the system to stop. +This synchronizes with other threads to prevent concurrent panic conditions +from interfering with one another. +In the unlikely event of concurrent panics, only one panicking thread will proceed. .Pp +Control will be passed to the kernel debugger via +.Fn kdb_enter . +This is conditional on a debugger being installed and enabled by the +.Va debugger_on_panic +variable; see +.Xr ddb 4 +and +.Xr gdb 4 . +The debugger may initiate a system reset, or it may eventually return. +.Pp +Finally, +.Xr kern_reboot 9 +is called to restart the system, and a kernel dump will be requested. If .Fn panic -is called twice (from the disk sync routines, for example) the system is -rebooted without syncing the disks. +is called recursively (from the disk sync routines, for example), +.Fn kern_reboot +will be instructed not to sync the disks. +.Pp +The +.Fn vpanic +function implements the main body of +.Fn panic . +It is suitable to be called by functions which perform their own +variable-length argument processing. +In all other cases, +.Fn panic +is preferred. +.Pp +The +.Fn KERNEL_PANICKED +macro is the preferred way to determine if the system has panicked. +It returns a boolean value. +Most often this is used to avoid taking an action that cannot possibly succeed +in a panic context. +.Sh EXECUTION CONTEXT +.\" TODO: This text describes the kernel debugger / kernel dump execution +.\" context as well. It could be moved to a future kdb(9) page, and this +.\" section would become a pointer. +Once the panic has been initiated, code executing in a panic context is subject +to the following restrictions: +.Bl -bullet +.It +Single-threaded execution. +The scheduler is disabled, and other CPUs are stopped/forced idle. +Functions that manipulate the scheduler state must be avoided. +This includes, but is not limited to, +.Xr wakeup 9 +and +.Xr sleepqueue 9 +functions. +.It +Interrupts are disabled. +Device I/O (e.g. to the console) must be achieved with polling. +.It +Dynamic memory allocation cannot be relied on, and must be avoided. +.It +Lock acquisition/release will be ignored, meaning these operations will appear +to succeed. +.It +Sleeping on a resource is not strictly prohibited, but will result in an +immediate return from the sleep function. +Time-based sleeps such as +.Xr pause 9 +may be performed as a busy-wait. +.El .Sh RETURN VALUES The .Fn panic -function does not return. +and +.Fn vpanic +functions do not return. +.Sh SEE ALSO +.Xr printf 3 , +.Xr ddb 4 , +.Xr gdb 4 , +.Xr KASSERT 9 , +.Xr kern_reboot 9 From nobody Mon Mar 20 20:13:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsh19B7z40Bsv; Mon, 20 Mar 2023 20:13: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 4PgQsh0D8bz3HmQ; Mon, 20 Mar 2023 20:13:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pz1dZoPhGQGR6ZbTq6KMVFnKiGYiRxNtg6OQIwpN/NQ=; b=WJ7kEomMz2GKaxnrMGGPWkUaHqZveUmFYN+X14CH7ztOchpm2wiLp4Z540zR+dmN9GEV+u XqHh40I9AzzjuVuKDOw9zKRiw0I62mlIclsPKAMKE48RehiPUBys9VLtqIN4Hmn8GMe6L8 faJ3Cu6RhTTV5RyH8FnDL13oO3w2HSmlfAKenj2jeGUfiVWIiwaJn9VoCxwbTD0V1ER9p8 +buYr91W3tCQK0EyxTno8+qZm7UpJRSIiw+BN3uTXB+HyfwWobDjsaTmVudaErkX6Kh9Lc zV+mwaZx5T6FhVArW3Jd0oJj46te8WCE0iAuDjw0bT6ACEsPfJDkoyd9JiTnwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pz1dZoPhGQGR6ZbTq6KMVFnKiGYiRxNtg6OQIwpN/NQ=; b=JPdev/fFA6wVY2oDUq0/3G0v529/5mQxtKstRWGlZX++Fc2jXThf/e3UvLjlGR6c62bMb9 rXdQhlEXm46EzrBrllXAjYRc8jPXIjBX4ScRz/CJtCgE9S5uIOx9YP49RCTU4VcIe9i2vw +4XcZZIiHeMjfPHIUtFLiLJZ9ix/dIIbax9nBHfn5vnaSs74LuZn9FZXPjgZDQJASWZ6ZC r8zniyBqAHe2hOwzTF1LGYSfClPFk4VdOeNIt48/KZjVHX4gArBFdsFJxRCD02PSO7DZPD +C5bRvrlbg1dT5jDq3FFXz7+4l40DNy3jRu5m6UroeuWYvJF+CT8GOkfKwaRzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343208; a=rsa-sha256; cv=none; b=RklOl8PiKSV8hGRO94dBNrlD/hOSf/Xd6cho7PfNj80YrUYhRuFPLE4xbb1Sx3X5LTX6lt utCHOFhMNFasjKW3uj4JNo3QMsR6i+K/sCAS5rGCpLVcqdmaGzBc6f9n6cs92ggGOqFXrt VPhEm2KrLNlsmcYO3E3tDgl4E8u/GpUlcrp8UI5CqnrVcWdnWuG9JWZ3jVMExbkLmBQUAx UlFkk4jRO6K6le1PCL+9j7ICYLouw7Do8YdR5JDfFK0ZSBsVfW9B4xshMJkQAlsGc9itoQ iobgD39ZB595Z0AaSPu4DjNm9J5J8COa2buFDsdz3s6SANoPWENYzYToiV0WyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsg6DdgzjyV; Mon, 20 Mar 2023 20:13: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 32KKDRUx033130; Mon, 20 Mar 2023 20:13:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDRpK033129; Mon, 20 Mar 2023 20:13:27 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:27 GMT Message-Id: <202303202013.32KKDRpK033129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: d55c1877386f - main - kern_reboot(9): some updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d55c1877386fd411129ee6d4019beda37b7f1c89 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d55c1877386fd411129ee6d4019beda37b7f1c89 commit d55c1877386fd411129ee6d4019beda37b7f1c89 Author: Mitchell Horne AuthorDate: 2023-03-20 19:56:54 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 kern_reboot(9): some updates - This function no longer disables interrupts - MLINK to reboot.9 - The mentions of autoconfiguration is more about shutdown_nice(), coming in the next commit. - Describe the RB_* flags relevant to this function - Describe behaviour when shutdown hooks fail the reset - Describe expected execution contexts - Add FF copyright - xref panic(9) - xref this page in reboot(2) Reviewed by: markj Discussed with: rpokala, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39133 --- lib/libc/sys/reboot.2 | 3 +- share/man/man9/Makefile | 1 + share/man/man9/kern_reboot.9 | 108 +++++++++++++++++++++++++++++++------------ 3 files changed, 81 insertions(+), 31 deletions(-) diff --git a/lib/libc/sys/reboot.2 b/lib/libc/sys/reboot.2 index 99d5dcc42808..2e145e3651df 100644 --- a/lib/libc/sys/reboot.2 +++ b/lib/libc/sys/reboot.2 @@ -156,7 +156,8 @@ The caller is not the super-user. .Xr halt 8 , .Xr init 8 , .Xr reboot 8 , -.Xr savecore 8 +.Xr savecore 8 , +.Xr reboot 9 .Sh HISTORY The .Fn reboot diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index eb6b37f41650..b03993b57860 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1335,6 +1335,7 @@ MLINKS+=intr_event.9 intr_event_add_handler.9 \ intr_event.9 intr_event_remove_handler.9 \ intr_event.9 intr_priority.9 MLINKS+=KASSERT.9 MPASS.9 +MLINKS+=kern_reboot.9 reboot.9 MLINKS+=kern_yield.9 maybe_yield.9 \ kern_yield.9 should_yield.9 MLINKS+=kernacc.9 useracc.9 diff --git a/share/man/man9/kern_reboot.9 b/share/man/man9/kern_reboot.9 index fe8ccd7390c3..e88574cce0d1 100644 --- a/share/man/man9/kern_reboot.9 +++ b/share/man/man9/kern_reboot.9 @@ -1,11 +1,18 @@ .\" $NetBSD: boot.9,v 1.2 1996/09/24 07:01:26 ghudson Exp $ .\" +.\" SPDX-License-Identifier: BSD-4-Clause +.\" .\" Copyright (c) 1997 .\" Mike Pritchard. All rights reserved. .\" .\" Copyright (c) 1994 Christopher G. Demetriou .\" All rights reserved. .\" +.\" Copyright (c) 2021,2023 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Mitchell Horne +.\" under sponsorship from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -18,7 +25,7 @@ .\" must display the following acknowledgement: .\" This product includes software developed by Christopher G. Demetriou .\" for the NetBSD Project. -.\" 3. The name of the author may not be used to endorse or promote products +.\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR @@ -34,16 +41,17 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2021 -.Dt KERN_REBOOT 9 +.Dd March 20, 2023 +.Dt REBOOT 9 .Os .Sh NAME .Nm kern_reboot -.Nd halt or reboot the system +.Nd reboot, halt, or power off the system .Sh SYNOPSIS .In sys/types.h .In sys/systm.h .In sys/reboot.h +.Vt extern int rebooting; .Ft void .Fn kern_reboot "int howto" .In sys/eventhandler.h @@ -53,53 +61,92 @@ .Sh DESCRIPTION The .Fn kern_reboot -function handles final system shutdown, and either halts or reboots -the system. +function handles final system shutdown, and either halts, reboots, +or powers down the system. The exact action to be taken is determined by the flags passed in +.Fa howto . +.Pp +The relevant flags are: +.Bl -tag -compact -offset indent -width "RB_POWERCYCLE" +.It Dv RB_HALT +Halt the system in-place rather than restarting. +.It Dv RB_POWEROFF +Power down the system rather than restarting. +.It Dv RB_POWERCYCLE +Request a power-cycle in addition to restarting. +.It Dv RB_NOSYNC +Do not sync filesystems during shutdown. +.It Dv RB_DUMP +Dump kernel memory during shutdown. +.El +.Pp +The .Fa howto -and by whether or not the system has finished autoconfiguration. +field, and its full list of flags are described in additional detail by +.Xr reboot 2 . .Pp -If the system has finished autoconfiguration, .Fn kern_reboot -does the following: +performs the following actions: .Bl -enum -offset indent .It -If this is the first invocation of -.Fn kern_reboot -and the +Set the +.Va rebooting +variable to +.Dv 1 , +indicating that the reboot process has begun and cannot be stopped. +.It +Set the +.Va kdb_active +variable to +.Dv 0 , +indicating that execution has left the kernel debugger, if it was previously +active. +.It +Unless the .Dv RB_NOSYNC -flag is not set in +flag is set in .Fa howto , -syncs and unmounts the system disks by calling +sync and unmount the system's disks by calling .Xr vfs_unmountall 9 . .It -Disables interrupts. -.It -If rebooting after a crash (i.e., if +If rebooting after a panic +.Po .Dv RB_DUMP is set in .Fa howto , but .Dv RB_HALT -is not), saves a system crash dump. +is not set +.Pc , +initiate a system crash dump via +.Fn doadump . .It -Runs any shutdown hooks previously registered. +Print a message indicating that the system is about to be halted +or rebooted, and a report of the total system uptime. .It -Prints a message indicating that the system is about to be halted -or rebooted. +Execute all registered shutdown hooks. .It -If -.Dv RB_HALT -is set in -.Fa howto , -halts the system. -Otherwise, reboots the system. +As a last resort, if none of the shutdown hooks handled the reboot, call the +machine-dependent +.Fn cpu_reset +function. +In the unlikely case that this is not supported, +.Fn kern_reboot +will loop forever at the end of the function. +This requires a manual reset of the system. .El .Pp -If the system has not finished autoconfiguration, .Fn kern_reboot -runs any shutdown hooks previously registered, -prints a message, and halts the system. +may be called from a typical kernel execution context, when the system is +running normally. +It may also be called as the final step of a kernel panic, or from the kernel +debugger. +Therefore, the code in this function is subject to restrictions described by +the +.Sx EXECUTION CONTEXT +section of the +.Xr panic 9 +man page. .Sh RETURN VALUES The .Fn kern_reboot @@ -107,4 +154,5 @@ function does not return. .Sh SEE ALSO .Xr reboot 2 , .Xr EVENTHANDLER 9 , +.Xr panic 9 , .Xr vfs_unmountall 9 From nobody Mon Mar 20 20:13:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsj1QSpz40Bn9; Mon, 20 Mar 2023 20:13: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 4PgQsj10T9z3J1h; Mon, 20 Mar 2023 20:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=30sxKtvf/WGWthVU5lg49drDH1kcmogiupuMf/jD988=; b=HHirMvMEYhRoXxgy+WLairk42k7w4oi5aTETwMNPKLUOasJOoT4poMqJOseWcx6N54uU59 uzfyL2/vs6wfbhV/0JMKutBk5ysSbhv2qTwaYdB1TsJ/lBcTOXL+we86ddSP47nNDxd0iS r4oGnxIkDfpXaKZOet1Oi2FobkvWM4dBF7TwzYhZZ+6rq9CdjrcTO6n7xudZnxgjlq8JFZ TlZA2OwfIb4TeHmyWCzO71Kf/taAH0hag5sYwUqRjaArfNAJMlT0P8DwNst84joZkkTwdG S/bLGHlg6ie9mKL4hs/mAUnfMWnnCtvXbz+vAAK4W9lZn7VuZ0h0sh1L6ZU3iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=30sxKtvf/WGWthVU5lg49drDH1kcmogiupuMf/jD988=; b=gL4Knr1uw16KVKpXPrxMTA2LfWeY8pkrMYkqUeNjTlvLv5SYbYTiUmUh9Oa7hOtmC6GUbS MTjgPPBxjbFkr0HW7mIkgskko+PBx183Aaw6Mhs/vcgOgn9ne/pAE5teHEq2VtdwCFogjG IGyFCRhpLupamimCGfrjjSpoj3opC+gwTx7xxbduRoQcS+B+8FefiF6h6c6MGyBVY+Uf8N 0kj5TW0OnGAjA6yvcX94Om0OHp+JsoI4ui9sLQ9fZ2ICq4rggVmZpMHn9iD6duxCuWhqdb 7S57rk0iF/Lv2+JIGW1+xtOAKxigexWjXsRe5ZtC0AQaiOC2YqHo46Nes3K8Cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343209; a=rsa-sha256; cv=none; b=FSOiyct9wwRKhRl982fHO8MyifSpQB8ue+D1yeMVdlGBwUf8Jg2haCQOFX/ZZ9SclN06nr 6yuayDWhv96sgHTO4w7sR9FTJGRC9EaMS7uGWbG/vpEAWPLTRNi/8ws6fz/LARjw2W+d75 /69NINBnMo64Mipfk5jGACGiWYcoK9AhHsb/sobQAqfhbC6NAaC0PUrAsih4B1cvTZQRZz 526oCQOsfg3LAAhAixilLUdHHwfYm2gYSD1XaAq8LMdrfPufwqBNwpe0WF4F67FevwJ7YC xbhxSWcGkuQ52xXp0HD5as0rR00q3oc3RjHQrEQge1uhW5Y4hfac2UfbKsWiIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsj02lszkWK; Mon, 20 Mar 2023 20:13: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 32KKDSDs033149; Mon, 20 Mar 2023 20:13:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDSkl033148; Mon, 20 Mar 2023 20:13:28 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:28 GMT Message-Id: <202303202013.32KKDSkl033148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b7caa912f9df - main - kern_reboot(9): document shutdown_nice() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b7caa912f9df5f76f189be18afc949a775c8e0fe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b7caa912f9df5f76f189be18afc949a775c8e0fe commit b7caa912f9df5f76f189be18afc949a775c8e0fe Author: Mitchell Horne AuthorDate: 2023-03-20 19:58:16 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 kern_reboot(9): document shutdown_nice() Reviewed by: markj, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39134 --- share/man/man9/Makefile | 3 ++- share/man/man9/kern_reboot.9 | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index b03993b57860..3bfc72b69dc6 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1335,7 +1335,8 @@ MLINKS+=intr_event.9 intr_event_add_handler.9 \ intr_event.9 intr_event_remove_handler.9 \ intr_event.9 intr_priority.9 MLINKS+=KASSERT.9 MPASS.9 -MLINKS+=kern_reboot.9 reboot.9 +MLINKS+=kern_reboot.9 reboot.9 \ + kern_reboot.9 shutdown_nice.9 MLINKS+=kern_yield.9 maybe_yield.9 \ kern_yield.9 should_yield.9 MLINKS+=kernacc.9 useracc.9 diff --git a/share/man/man9/kern_reboot.9 b/share/man/man9/kern_reboot.9 index e88574cce0d1..d120a437c521 100644 --- a/share/man/man9/kern_reboot.9 +++ b/share/man/man9/kern_reboot.9 @@ -45,7 +45,8 @@ .Dt REBOOT 9 .Os .Sh NAME -.Nm kern_reboot +.Nm kern_reboot , +.Nm shutdown_nice .Nd reboot, halt, or power off the system .Sh SYNOPSIS .In sys/types.h @@ -54,6 +55,8 @@ .Vt extern int rebooting; .Ft void .Fn kern_reboot "int howto" +.Ft void +.Fn shutdown_nice "int howto" .In sys/eventhandler.h .Fn EVENTHANDLER_REGISTER "shutdown_pre_sync" "shutdown_fn" "private" "priority" .Fn EVENTHANDLER_REGISTER "shutdown_post_sync" "shutdown_fn" "private" "priority" @@ -147,12 +150,42 @@ the section of the .Xr panic 9 man page. +.Pp +The +.Fn shutdown_nice +function is the intended path for performing a clean reboot or shutdown when +the system is operating under normal conditions. +Calling this function will send a signal to the +.Xr init 8 +process, instructing it to perform a shutdown. +When +.Xr init 8 +has cleanly terminated its children, it will perform the +.Xr reboot 2 +system call, which in turn calls +.Fn kern_reboot . +.Pp +If +.Fn shutdown_nice +is called before the +.Xr init 8 +process has been spawned, or if the system has panicked or otherwise halted, +.Fn kern_reboot +will be called directly. .Sh RETURN VALUES The .Fn kern_reboot function does not return. +.Pp +The +.Fn shutdown_nice +function will usually return to its caller, having initiated the asynchronous +system shutdown. +It will not return when called from a panic or debugger context, or during +early boot. .Sh SEE ALSO .Xr reboot 2 , +.Xr init 8 , .Xr EVENTHANDLER 9 , .Xr panic 9 , .Xr vfs_unmountall 9 From nobody Mon Mar 20 20:13:30 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsk46S4z40Br8; Mon, 20 Mar 2023 20:13: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 4PgQsk1mmCz3JF2; Mon, 20 Mar 2023 20:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rY3zq4raVW6hMAPnJK7vkf49ZrSu1dspoVStVz8leq0=; b=e5L6iyLTwr1SHLIfxrhPb2zCR2msApRjGulaJAnbu6RoP4NXUWMq0NFy35lVolzwo//dBN 1G5Bi6QkrqyrwWG2XA8Hzj6ZbZEzQEjcwkdBn0nrX/nQI8YHLege3VbEn3FrKEyiu+WR/K idfxsMum8FCCHYRhrHVu9CqfCXQZzwmBrjw2QeOHl7EfZlDTT4J0UkwX8H3pnhN9+QRd7b EcdiqUtjCVwPMkg5AZt3rzcVWBQwnYdl1ot9Z+xbT5DaNrvjeNpiWcqeaZC4+Whkn0JSq3 sY7QpWNhdeptY0xFMw/zZRCZY5/KS084UP1NH6uspQ/hyPAj39mRv70949g/gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rY3zq4raVW6hMAPnJK7vkf49ZrSu1dspoVStVz8leq0=; b=Xuqfji32r4266kdq3TQf85XhHZmSEsopBw49a9q2FmyPkzxA/o/O5sfsX3T4vGjdAL4wK5 Zr1O/HA1Zm3AmZyfXgoxt2h8ySQY15DfNr9mLzZn6f3U/1ea/OO8EZczwbIpiMvTqUA1Rb uDZQjYa4QHS+6KQGwtJWil693shBAfjyXXvw/Q0NkhsRLZJ9ToYq+/nz3FSSEUQA+so3T3 h4VYhR1A6OJqBP+pkMjO8ug091LpJidEFbAwDmEf8G2aJHCzjliU57I+FGohlOXe1Uhm/A yGfSMJ6otqy7BNy9+p9TumF3CMbTYPrOh7vSMh/UYjL3ZN6wfiQoW1vsG+k5RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343210; a=rsa-sha256; cv=none; b=IUEP8V75g+mUsQNlZVfXpNdLc7MSjQoECXQF/6XjBcoG75q/fXRzKctzT19yFR09eCTOXv g81VYkS3hjnW6nm/fL+2J+yeVWJIwC8a7KMI4+oz8e75kojl7kvhOO6BDkfrKf4EJWK+zk yyS0n+hB51GiJ5DbwTzrXm0os7AjOr1f1D55ehCvU9SavE02ljwtIYeXXbyByAc3pYQQxX WQsXHbykeZeGeddqWLV452J2NWFXHLjmjvCdlfvKx0TZ0DXzKiRmW0AbHQJkuMtl5YP7t9 FnePkVnXm4gq8tTnLWqjfzJ+SkVFSdMiwuz6cXAzefMhHnrSFphbi7TjpfkYtg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsk0t1FzkDX; Mon, 20 Mar 2023 20:13: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 32KKDU57033179; Mon, 20 Mar 2023 20:13:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDUS6033178; Mon, 20 Mar 2023 20:13:30 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:30 GMT Message-Id: <202303202013.32KKDUS6033178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: f6f8cbda8efc - main - kern_reboot(9): describe event handlers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6f8cbda8efcd32a312655842097e9095ee3e0fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f6f8cbda8efcd32a312655842097e9095ee3e0fb commit f6f8cbda8efcd32a312655842097e9095ee3e0fb Author: Mitchell Horne AuthorDate: 2023-03-20 19:58:48 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 kern_reboot(9): describe event handlers Add more details about the execution and purpose of these shutdown handlers. Make a point to mention the requirement that they can be run in a normal or panic context. Add some simple examples. Add a brief comment to the declaration in sys/eventhandler.h. Reviewed by: markj Discussed with: rpokala, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39135 --- share/man/man9/kern_reboot.9 | 111 +++++++++++++++++++++++++++++++++++++++++++ sys/sys/eventhandler.h | 9 +++- 2 files changed, 119 insertions(+), 1 deletion(-) diff --git a/share/man/man9/kern_reboot.9 b/share/man/man9/kern_reboot.9 index d120a437c521..a82b53382687 100644 --- a/share/man/man9/kern_reboot.9 +++ b/share/man/man9/kern_reboot.9 @@ -128,6 +128,9 @@ Print a message indicating that the system is about to be halted or rebooted, and a report of the total system uptime. .It Execute all registered shutdown hooks. +See +.Sx SHUTDOWN HOOKS +below. .It As a last resort, if none of the shutdown hooks handled the reboot, call the machine-dependent @@ -172,6 +175,58 @@ is called before the process has been spawned, or if the system has panicked or otherwise halted, .Fn kern_reboot will be called directly. +.Sh SHUTDOWN HOOKS +The system defines three separate +.Xr EVENTHANDLER 9 +events, which are invoked successively during the shutdown procedure. +These are +.Va shutdown_pre_sync , +.Va shutdown_post_sync , +and +.Va shutdown_final . +They will be executed unconditionally in the listed order. +Handler functions registered to any of these events will receive the value of +.Fa howto +as their second argument, which may be used to decide what action to take. +.Pp +The +.Va shutdown_pre_sync +event is invoked before syncing filesystems to disk. +It enables any action or state transition that must happen before this point to +take place. +.Pp +The +.Va shutdown_post_sync +event is invoked at the point immediately after the filesystem sync has +finished. +It enables, for example, disk drivers to complete the sync by flushing their +cache to disk. +Note that this event still takes place before the optional kernel core dump. +.Pp +The +.Va shutdown_final +event is invoked as the very last step of +.Fn kern_reboot . +Drivers and subsystems such as +.Xr acpi 4 +can register handlers to this event that will perform the actual reboot, +power-off, or halt. +.Pp +Notably, the +.Va shutdown_final +event is also the point at which all kernel modules will have their shutdown +.Po +.Dv MOD_SHUTDOWN +.Pc +hooks executed, and when the +.Xr DEVICE_SHUTDOWN 9 +method will be executed recursively on all devices. +.Pp +All event handlers, like +.Fn kern_reboot +itself, may be run in either normal shutdown context or a kernel panic or +debugger context. +Handler functions are expected to take care not to trigger recursive panics. .Sh RETURN VALUES The .Fn kern_reboot @@ -183,9 +238,65 @@ function will usually return to its caller, having initiated the asynchronous system shutdown. It will not return when called from a panic or debugger context, or during early boot. +.Sh EXAMPLES +A hypothetical driver, foo(4), defines a +.Va shutdown_final +event handler that can handle system power-off by writing to a device register, +but it does not handle halt or reset. +.Bd -literal -offset indent +void +foo_poweroff_handler(struct void *arg, int howto) +{ + struct foo_softc *sc = arg; + uint32_t reg; + + if ((howto & RB_POWEROFF) != 0) { + reg = FOO_POWEROFF; + WRITE4(sc, FOO_POWEROFF_REG, reg); + } +} +.Ed +.Pp +The handler is then registered in the device attach routine: +.Bd -literal -offset indent +int +foo_attach(device_t dev) +{ + struct foo_softc *sc; + + ... + + /* Pass the device's software context as the private arg. */ + EVENTHANDLER_REGISTER(shutdown_final, foo_poweroff_handler, sc, + SHUTDOWN_PRI_DEFAULT); + + ... +} +.Ed +.Pp +This +.Va shutdown_final +handler uses the +.Dv RB_NOSYNC +flag to detect that a panic or other unusual condition has occurred, and +returns early: +.Bd -literal -offset indent +void +bar_shutdown_final(struct void *arg, int howto) +{ + + if ((howto & RB_NOSYNC) != 0) + return; + + /* Some code that is not panic-safe. */ + ... +} +.Ed .Sh SEE ALSO .Xr reboot 2 , .Xr init 8 , +.Xr DEVICE_SHUTDOWN 9 , .Xr EVENTHANDLER 9 , +.Xr module 9 , .Xr panic 9 , .Xr vfs_unmountall 9 diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h index 8c45431c83c3..be5a027f4743 100644 --- a/sys/sys/eventhandler.h +++ b/sys/sys/eventhandler.h @@ -184,7 +184,14 @@ eventhandler_tag vimage_eventhandler_register(struct eventhandler_list *list, #define EVENTHANDLER_PRI_ANY 10000 #define EVENTHANDLER_PRI_LAST 20000 -/* Shutdown events */ +/* + * Successive shutdown events invoked by kern_reboot(9). + * + * Handlers will receive the 'howto' value as their second argument. + * + * All handlers must be prepared to be executed from a panic/debugger context; + * see the man page for details. + */ typedef void (*shutdown_fn)(void *, int); #define SHUTDOWN_PRI_FIRST EVENTHANDLER_PRI_FIRST From nobody Mon Mar 20 20:13:31 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsl3CM8z40BfM; Mon, 20 Mar 2023 20:13: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 4PgQsl2mv2z3JMv; Mon, 20 Mar 2023 20:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSWDME1QveUllroZriPJgjDGioCtKYT25TWS/e1jw94=; b=EOX6AOMk5Qw35ZHVYEWgtPWtzWmnensHIrI8JSxjyl/C4ZtxL1hWGvZHhnaN79fS0jemZn mKpuNSTcPj4KUUFgmN3oyJWJLsGjZFEV56eZWgGONOskVBZ3BPM56tOHbyA7qmd+04gUsU H27q7kVIMG5CUoLePV3Wgw0/CXVi2wVvZXthEPhU3u1PWQWwtmvXofiZNYcagKUytoXM1A PYcs3jOUMyXh3ztSziG1C9L9qj5/RTHTotKnKAk9rv3rf7hiti5cuWbAL3tzPwBy23IeSc WIetqBeFUKr5wPIYSQV9feQ7URF2EQhfxupK1j8YLuN5E4dk07TBWsD7KeGVPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSWDME1QveUllroZriPJgjDGioCtKYT25TWS/e1jw94=; b=Rcljpm1tFchm18u8k4PTIUKacPEwP43kFZHMFogtUzAwq5nHu7ScVTV+24pYMCUmPyTmzM b6p4qHgLXW8RqFSX/qB6SIdsX+IoBY9IQqp6wvB26iRp0gSz/5GHhVXOw3wAVCLtFoj43m UyHe9m+i2bllFcp7ouhC4PaMj419P/v6oSQCZVRsMgQcbOQ3xQK2sydEpfpXibfjVzC8KH xTJQO25vCsFqAk2yt7ALqWAuWb21DZNM2xiVWosPgNo0ASrJ7SrbIlB+qaYW39+fLgNkq3 I33vlZ4to1xTczKnOpT7uJ3kGifPXH4FD+wvVFwwvtdd8AEz2ZhBPPng0gtSmA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343211; a=rsa-sha256; cv=none; b=VDUwG/dvU8ezNGxRXrS8pbMbB6oi8ul/JLlJ2n11I/IHb/SLEMQPJXGlFcfD7ICPNsamEx TPkkFecqrI/SvrorelTfZRl53cN8xdtTK/mjXqnZtIZM5qYCaKc2MQYw/xvi0JK3qCaf49 n37iZXg4Ur7Ilaxvjw4E8taGxNtkJStT1Rhr2E+gugBozsp6QkdwLwC9IkEofU64LuLGIW KCuXZFU91RmrcutBESfQIujUiV/F0DmZ6I+qcSSY/5se4vW+qQ4CWJgA9TivrCrir0Qmce YL53tbN13Byzoyw8xeDa5KYWl1T8/kkOdvUlyOKW+xJjnTj+wvgliBxqu8wzPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsl1cYqzkWL; Mon, 20 Mar 2023 20:13: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 32KKDViM033198; Mon, 20 Mar 2023 20:13:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDVTO033197; Mon, 20 Mar 2023 20:13:31 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:31 GMT Message-Id: <202303202013.32KKDVTO033197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 8965b3033ea1 - main - callout(9): adopt old references to timeout(9) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8965b3033ea1750f2e064a130cf2f2158c6fc795 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8965b3033ea1750f2e064a130cf2f2158c6fc795 commit 8965b3033ea1750f2e064a130cf2f2158c6fc795 Author: Mitchell Horne AuthorDate: 2023-03-20 20:00:24 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 callout(9): adopt old references to timeout(9) timeout(9) was removed a couple of years ago; all consumers now use the callout(9) interface. Explicitly do not bump .Dd anywhere, as this is not a content or semantic change. Reviewed by: markj, jhb, Pau Amma MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39136 --- share/man/man9/condvar.9 | 4 ++-- share/man/man9/epoch.9 | 4 ++-- share/man/man9/locking.9 | 4 ++-- share/man/man9/sleep.9 | 4 ++-- share/man/man9/sleepqueue.9 | 4 ++-- share/man/man9/tvtohz.9 | 4 ++-- sys/kern/kern_timeout.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/share/man/man9/condvar.9 b/share/man/man9/condvar.9 index 4a4e8741eda0..3e02f2fa40c0 100644 --- a/share/man/man9/condvar.9 +++ b/share/man/man9/condvar.9 @@ -251,11 +251,11 @@ will fail if: Timeout expired. .El .Sh SEE ALSO +.Xr callout 9 , .Xr locking 9 , .Xr mtx_pool 9 , .Xr mutex 9 , .Xr rwlock 9 , .Xr sema 9 , .Xr sleep 9 , -.Xr sx 9 , -.Xr timeout 9 +.Xr sx 9 diff --git a/share/man/man9/epoch.9 b/share/man/man9/epoch.9 index 1f191211b041..8a5008a6b238 100644 --- a/share/man/man9/epoch.9 +++ b/share/man/man9/epoch.9 @@ -267,14 +267,14 @@ The .Nm kernel programming interface is under development and is subject to change. .Sh SEE ALSO +.Xr callout 9 , .Xr locking 9 , .Xr mtx_pool 9 , .Xr mutex 9 , .Xr rwlock 9 , .Xr sema 9 , .Xr sleep 9 , -.Xr sx 9 , -.Xr timeout 9 +.Xr sx 9 .Sh HISTORY The .Nm diff --git a/share/man/man9/locking.9 b/share/man/man9/locking.9 index e1e4ccd33664..64cba3b0159b 100644 --- a/share/man/man9/locking.9 +++ b/share/man/man9/locking.9 @@ -422,6 +422,7 @@ At this time this is a rather easy to remember table. .Xr witness 4 , .Xr atomic 9 , .Xr BUS_SETUP_INTR 9 , +.Xr callout 9 , .Xr condvar 9 , .Xr epoch 9 , .Xr lock 9 , @@ -433,7 +434,6 @@ At this time this is a rather easy to remember table. .Xr sema 9 , .Xr sleep 9 , .Xr smr 9 , -.Xr sx 9 , -.Xr timeout 9 +.Xr sx 9 .Sh BUGS There are too many locking primitives to choose from. diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9 index 78625e5e1184..1a471bcfc00d 100644 --- a/share/man/man9/sleep.9 +++ b/share/man/man9/sleep.9 @@ -366,13 +366,13 @@ A non-zero timeout was specified and the timeout expired. .El .Sh SEE ALSO .Xr ps 1 , +.Xr callout 9 , .Xr locking 9 , .Xr malloc 9 , .Xr mi_switch 9 , .Xr mtx_sleep 9 , .Xr rw_sleep 9 , -.Xr sx_sleep 9 , -.Xr timeout 9 +.Xr sx_sleep 9 .Sh HISTORY The functions .Fn sleep diff --git a/share/man/man9/sleepqueue.9 b/share/man/man9/sleepqueue.9 index 64dfc3bdee55..ae3bbaab7460 100644 --- a/share/man/man9/sleepqueue.9 +++ b/share/man/man9/sleepqueue.9 @@ -383,8 +383,8 @@ interfaces. Almost all other code in the kernel should use one of those interfaces rather than manipulating sleep queues directly. .Sh SEE ALSO +.Xr callout 9 , .Xr condvar 9 , .Xr runqueue 9 , .Xr scheduler 9 , -.Xr sleep 9 , -.Xr timeout 9 +.Xr sleep 9 diff --git a/share/man/man9/tvtohz.9 b/share/man/man9/tvtohz.9 index cf07d603a790..d3918bdb85c6 100644 --- a/share/man/man9/tvtohz.9 +++ b/share/man/man9/tvtohz.9 @@ -45,9 +45,9 @@ of system ticks that would elapse. Returns the integral number of system ticks expected to elapse in the given interval, including the current tick. .Sh SEE ALSO +.Xr callout 9 , .Xr microtime 9 , -.Xr microuptime 9 , -.Xr timeout 9 +.Xr microuptime 9 .Sh HISTORY The .Nm diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 0ac0eca36da4..05497f3d46d7 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -728,7 +728,7 @@ softclock_call_cc(struct callout *c, struct callout_cpu *cc, if (lastfunc != c_func || sbt2 > maxdt * 2) { ts2 = sbttots(sbt2); printf( - "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", + "Expensive callout(9) function: %p(%p) %jd.%09ld s\n", c_func, c_arg, (intmax_t)ts2.tv_sec, ts2.tv_nsec); } maxdt = sbt2; From nobody Mon Mar 20 20:13:32 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsm3vXmz40BrH; Mon, 20 Mar 2023 20:13: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 4PgQsm34zmz3J74; Mon, 20 Mar 2023 20:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=knghHxDOqVykZsXdQVlgb4Sjn2gvnVPgrXRer2vMj4g=; b=DCNkhvjwAkj/mZX/5/oav6L3GquoJm51Ued89pzeG+vn0tND2lWUngMZoXsrk1MVwfv9j1 EdPdI19LoQNItio/rGFEG7eYqaNubVbd19whm2owM3JGFjv2FJ7i3rpOeerkkgrgDlE5fc uvSFqNIAh8LB/CMVpux6prLTRIF2sxg06+dRloeFhu6FvP6pc8xe6nnOYrA4WRsTodqXm0 PDtFRxxDiyUmiLG7ONlPqEeRRzGhQo2eDuMBqECzKM/jrJJ725ToaWr+tdIpqnubAovR6t YKQxBrF5UE79T3Try7qLz07Nog3m7lCYqhQ6VLcBX0q6yHvXsOYuSSv65/kWoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=knghHxDOqVykZsXdQVlgb4Sjn2gvnVPgrXRer2vMj4g=; b=UhxMS0mFmpbwecAA3O7ynDsp60lslAbQc1pHvl1P5XHqjbtchmmPZPP0tMHc28rFLN34yd OB8syFjNeOjSB3wGYI832vV8ouuEsG9xa/0Ri9LNUlJaNlL3pAnAXgYUAuZcwgslSsj5SR kBE5OiBifa9npEoMNtxAHJCtntGTx2txvDGgHFqWF35hVRwy4/EY5lPTHfE0GzW2EVCTr/ 7VHfeETlbg52RIHvvh9l3SW/yZR0BANbymCYrHnhlJVadmG0KXF/5kBPloyfEBqLBHlneg pe60R79hlmiVm7FK5ShwM4LKlfjVcZ7L9EdQFZd6D4BTiCmS7ifHJ3kDgcZwVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343212; a=rsa-sha256; cv=none; b=WXa2O7WEmgqgZOLzxxZM+fn4HCujUgRg0hnXTBSESWRdIA3UcihV7LuY+wj/rtJPZ5AKIc u5kxZfk6FAALWzS33kWTvQ087eEdIRleIJNvs9XXjH68cl0pMtiJLsZJMUxmmr33XhGUYQ 4l5P7GE0sT0LB4S7FHpcyw7F+zkgLZLWOUpVVfUiay7YSXF9kl0kZfFx/lk35FPVWEpPEp rzC2xub6E3zBrt4UJa+FSOM8X1Rd8hTDmTTg1VpJnFidMdlenht+g9ubMJIGnFoG48tIML Qv4+OwqxLXeAnnxkXqZNnsnx/GJzcizY0dptXCLL0MMCyfsxGNoOfMklY3tIIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsm2B6FzkSl; Mon, 20 Mar 2023 20:13: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 32KKDWXp033217; Mon, 20 Mar 2023 20:13:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDWDr033216; Mon, 20 Mar 2023 20:13:32 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:32 GMT Message-Id: <202303202013.32KKDWDr033216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 195aa533c799 - main - hardclock(9): small cleanups List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 195aa533c7998d2ad236f1492b4bf232b5a32080 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=195aa533c7998d2ad236f1492b4bf232b5a32080 commit 195aa533c7998d2ad236f1492b4bf232b5a32080 Author: Mitchell Horne AuthorDate: 2023-03-20 20:01:03 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 hardclock(9): small cleanups - Improve the wording that describes cnt and hz (avoid "the long haul") - Use .Fa for function arguments - Fix formatting of parenthesis around swi(9) xref - removed xref to non-existent options(4) - xref polling(4) - consistently list xrefs in SEE ALSO - xref eventtimers(9) in SEE ALSO Reviewed by: mav, rpokala MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39137 --- share/man/man9/hardclock.9 | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/share/man/man9/hardclock.9 b/share/man/man9/hardclock.9 index 451ad8a28a93..757aed112ccb 100644 --- a/share/man/man9/hardclock.9 +++ b/share/man/man9/hardclock.9 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 1, 2021 +.Dd February 27, 2023 .Dt HARDCLOCK 9 .Os .Sh NAME @@ -44,19 +44,18 @@ The rate ranges from .Va hz times per second on a very busy system, to twice a second on an idle system. The -.Va cnt +.Fa cnt argument reports an estimate of the number of ticks since the last call. -The sum of -.Va cnt -over a second averages -.Va hz -over the long haul. +Over long timescales, the average sum of +.Fa cnt +over one second is +.Va hz . See .Xr hz 9 for important details over shorter time scales. -The argument -.Va usermode -is none-zero when +The +.Fa usermode +argument is non-zero when .Fn hardclock is called from an context that interrupted usermode execution. .Pp @@ -77,18 +76,23 @@ or .Xr adjtime 2 induced changes and leap seconds, as well as any necessary compensations to keep in sync with PPS signals or external clocks, if -support for this is in the kernel (see -.Xr options 4 ) . +supported by the kernel. .It -Schedule softclock interrupts ( -.Xr swi 9 ) +Schedule softclock interrupts +.Po +.Xr swi 9 +.Pc processing. .It Collect .Xr hwpmc 4 statistics. .It -Do device polling, when enabled. +Do device polling, when enabled +.Po +see +.Xr polling 4 +.Pc . .It Implement software .Xr watchdog 9 @@ -102,5 +106,11 @@ processing. .Xr adjtime 2 , .Xr ntp_adjtime 2 , .Xr signal 3 , +.Xr hwpmc 4 , +.Xr polling 4 , .Xr ntpd 8 , -.Xr hz 9 +.Xr epoch 9 , +.Xr eventtimers 9 , +.Xr hz 9 , +.Xr swi 9 , +.Xr watchdog 9 From nobody Mon Mar 20 20:13:33 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsn4kNQz40BrK; Mon, 20 Mar 2023 20:13: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 4PgQsn490Kz3JP6; Mon, 20 Mar 2023 20:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=esib0F3O+srOplCTLz3wwflHvt9JHdE3xLYt4xr1FBs=; b=kB2wR0seqjNB1UrtsVFXHsNx2a4tX+kEGcohFVJCZedycMjnkPsoAJjojczKODfOZ43bcI +g5pfuzwQCcdmJebykg3/YQ1mNdjUE9u5j8ACUlTDM9Mc56m7d+PkfcKs116Ld5gPzb2vW ftzNEsSnWavo7mIJEhO/2WAOlrbFQpQubz3EEOZvGaA0crX2/ohULPkRt08WvSW8Ute8kJ maYkZKPRb7tXvveZULFKFz0bD/o2trFIIaZu4LrtHWm83KLb8+Fmwlkcj6Mbg9RYklfiB8 lGCmphHI6e3qBmlW7Lm/ghS1VAe+Uwl4vcZkX5ABYxWync44r2apHZYpJ4WFRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=esib0F3O+srOplCTLz3wwflHvt9JHdE3xLYt4xr1FBs=; b=UtktmPMUBWSdxY6b64+IgK0z9NLx6Qf6Gw2ibL8r5tXhE2UHYABBHzOJNNRo6R7udxZFvW fg6S2DCk0t08YMcC8QQO0LD3E2GxoGXDkxmLE8+iTznyVQPz2MlxUNBfQa6U5gRYSz80GG 5+nlmjR3lSgr0kTh/fTQmYlFtdtXwNKLyPl5lYJA6AOKhnoWERTw4ktyGCLr6Vrn2X06IL 5qDTOGFqzD5NK2ZhND06gsDqb/sWaW5Ns9PQ08KcDVpx6fiFvVY5oFKhhmLo6+1i/NABxa Oib4Sl8U5fssYTLOHd+ncx1/BaipxJcCLPmKd/zAU86rBzBD/gtaI9LU/KJUaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343213; a=rsa-sha256; cv=none; b=kWSXebIzooNMQLqh2fG32AUW7XH2eJrB57M+mZZ8jfmWgxkVrZ+RWUEVpAL6Pa/k/Rw/cx Kw2w49ygiILMgjxLvPA/SHdz82qSgsan6yJTyGMnkJmp74jGpLaW/JR1KhikGfBawLmaE9 lF2vp7sotTmjfq+o48JNqQi1GytdOYNyhzseRdGEkD2j+aXkcRFilU6en9yz3hjN3Wjbib JAEPSrCYjn7Q7fdYjKtQGnbuRxQRPJW6wCPO0cog6PiCAKHg58YWo4v8yJJMi4hOJeYL/h TZgYnI2IIEoLoh7+TrNtFkb2fKMTIRAyfK1Bppl52OPmDRym+TkNBfXRyfDu2A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsn36JGzkWM; Mon, 20 Mar 2023 20:13: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 32KKDXue033238; Mon, 20 Mar 2023 20:13:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDXm5033237; Mon, 20 Mar 2023 20:13:33 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:33 GMT Message-Id: <202303202013.32KKDXm5033237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 84a44625a50f - main - printf(9): add MLINKS for vlog(9) and vprintf(9) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84a44625a50fc548aae43af9e9738c1934b3e611 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=84a44625a50fc548aae43af9e9738c1934b3e611 commit 84a44625a50fc548aae43af9e9738c1934b3e611 Author: Mitchell Horne AuthorDate: 2023-02-12 18:58:50 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 printf(9): add MLINKS for vlog(9) and vprintf(9) MFC after: 3 days Sponsored by: The FreeBSD Foundation --- share/man/man9/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 3bfc72b69dc6..84b2fbf5e34d 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1811,7 +1811,9 @@ MLINKS+=pmap_resident_count.9 pmap_wired_count.9 MLINKS+=pmap_zero_page.9 pmap_zero_area.9 MLINKS+=printf.9 log.9 \ printf.9 tprintf.9 \ - printf.9 uprintf.9 + printf.9 uprintf.9 \ + printf.9 vlog.9 \ + printf.9 vprintf.9 MLINKS+=priv.9 priv_check.9 \ priv.9 priv_check_cred.9 MLINKS+=prng.9 prng32.9 \ From nobody Mon Mar 20 20:13:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsq18ZPz40BtC; Mon, 20 Mar 2023 20:13: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 4PgQsp4w9Lz3Jb3; Mon, 20 Mar 2023 20:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TgvP1ifiuvYRm6G763tb/ZUJyuMj9ETdY/8I4iMBKKI=; b=PPCchAMFy37D5xr0YHZ7sGdkhgGBfKdZi4XHLnZn5VkMefREp+JUUfaVKG7g78CqfY3IbC +DEj67PnzBl1PkroppHm6O0Bm5NIlWD+RVGJdRjejR3IoWUWNudH20TIxTaBTwRsUywlLv mt/4EmZGrMdOCMy/Qp44aH47/SKJ5nJi9NGv9zuv1OdHW4eEeVrJ9GvAJo9KbIh+K8yIET Gsrdxhc1DAo2cNk3fJSpSyLWh+RsBzFDgQmykxFn2iemm9HHylXR6etB5rJS0s2qcCVCMs 7erLJYhLR1zdHhqbEUyf1wK/5pklsM3zYevTDHQnS5GjZwBSC170C7K/TkYjRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TgvP1ifiuvYRm6G763tb/ZUJyuMj9ETdY/8I4iMBKKI=; b=TxImeB4yDAqjQ1crGSZzpkYQf410/g1qoGxhWrM6WPwXlaoSXo+XG+MBV7a5/ZSqUlhUmK I9RSoAmQJx5Ob4m7gsqkZ/eUZH29dcZ5zxtqjwTVcxycHJeHk7HIyi3KsX9PaJpfJ2XvIq mcYPOsqyDQhXhd++T8Yn7nAouokynP6kciTFAr05MTJcaehkhUDQZbSC6kx7hooxqCP+Va yaq6cuh0Fn6Idga8R5fjl5YbkJV22PaGALgIitQESvizLp0/YgabsfRHnOo8C4Aufccee+ xNoIyfjFs+tThqOcC4fMlSqzOav+Y6r7RQqjaBTulfs0hI/LAaIXuM2Zll9GYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343214; a=rsa-sha256; cv=none; b=nDeQz3GgiFZ1bsPtDnSp4sYiZWUBV0O3hT/BJ0vGDn6k40RLnXFQG4Q/+pyueVVp3/bLmm EmwSQR03qiIF0xj3bMuQhY0OKMZGVyCE9IrELA77x1+FWxU0nmAEx4APjuXsBqpkyRhAhP AgXdZte3Swok/L/2UaYcC5muC2xUukneYMYXMGQFqV23GJWsylrQrf7MneCUO7Vw+kHdca yFjIZ/HxMewSCWgekieziw3HItkRF6Odt8hxIdoU4IpFsjggXa2fIgNr7KeGBNZvbM/Xa6 sIz0GSThAXGouxB+GzUw9v2I7ruhalRizxPP3bcDkKV9bWeouHCsfdslxDCOUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsp420gzkHW; Mon, 20 Mar 2023 20:13: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 32KKDYcN033257; Mon, 20 Mar 2023 20:13:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDYMO033256; Mon, 20 Mar 2023 20:13:34 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:34 GMT Message-Id: <202303202013.32KKDYMO033256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 005b7c5790ef - main - Cross-reference coretemp(4) and amdtemp(4) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 005b7c5790ef913bb8053f890d9653228e577185 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=005b7c5790ef913bb8053f890d9653228e577185 commit 005b7c5790ef913bb8053f890d9653228e577185 Author: Mitchell Horne AuthorDate: 2023-01-31 16:41:32 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 Cross-reference coretemp(4) and amdtemp(4) MFC after: 3 days Sponsored by: The FreeBSD Foundation --- share/man/man4/amdtemp.4 | 1 + share/man/man4/coretemp.4 | 1 + 2 files changed, 2 insertions(+) diff --git a/share/man/man4/amdtemp.4 b/share/man/man4/amdtemp.4 index 8d1764f7e877..e64192916456 100644 --- a/share/man/man4/amdtemp.4 +++ b/share/man/man4/amdtemp.4 @@ -83,6 +83,7 @@ tunable: Add the given offset to the temperature of the sensor. Default is 0. .Sh SEE ALSO +.Xr coretemp 4 , .Xr loader 8 , .Xr sysctl 8 .Sh HISTORY diff --git a/share/man/man4/coretemp.4 b/share/man/man4/coretemp.4 index 91a975861a0a..3931b1c5ff04 100644 --- a/share/man/man4/coretemp.4 +++ b/share/man/man4/coretemp.4 @@ -57,6 +57,7 @@ driver reports each core's temperature through a sysctl node in the corresponding CPU device's sysctl tree, named .Va dev.cpu.%d.temperature . .Sh SEE ALSO +.Xr amdtemp 4 , .Xr sysctl 8 .Sh HISTORY The From nobody Mon Mar 20 20:13:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgQsq6gtgz40Bl1; Mon, 20 Mar 2023 20:13: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 4PgQsq5XPkz3JbH; Mon, 20 Mar 2023 20:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EoCXCBz4rBLMgAl8yDACzwEa6+9EijzhAKaQZNr1B4Q=; b=kzeg2596bEFkmnpdjGIMvHJkvp6JanHGmj0K2OuCL4bJkL2xXgpIYDE0ujFBkrwJpoSG4E r2U7L60T4jlk9rNuzn36WZG00FVF7zty5VcPw8LIPUS4lmi/ETvIaFYsbZqDUCcRfzzZmE aEy19XIP1rR4wmFkZU0EGJsDeLcHYd2vZR3yEgrsHw+9j6kGevN3sf6M7TaWDK9g4zXxJq ow6s8/ZarwaxXsJvMEVTcY37zGX6Cpjb3ynJwFwlNF1L55cNUhY/Nacs9BC4iEcIxGXLVS w2IKsHq/52qtaW0ayY4KP0D7SKo+h7Ok7wT8VT5eXERSkWsa4+OSXgHoVfDWDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679343215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EoCXCBz4rBLMgAl8yDACzwEa6+9EijzhAKaQZNr1B4Q=; b=FCz8jrXeDHIjvjrvpvQIM2ImPdB7YJlU5YOEHJbi4y1ZEVgkYGG1pss5BCfzRWmjpU/Zw+ 3q5JG1ZEuZaFffsJunqhZLAbb40WbjhsK5XmA1YDoTpCj3H12UhJFl1cWHrWnr1TJjiGx+ qtJfv/cl8IivN9U2eFhB9Ed7nrl9JkIlxtQxyUWldYygwgPbWLLFAGITV6JFNqxlZQfBWg CsKCfu13mb3Dm4JLoG2GgCljDun00s67KZnFGZ/sQ3Ja5YMpeF6Vs1AydrLYzFlqlS26KT w4ELiLToGMhf6a0cdpCFRMFMGp530snD/l2C1+4pCKLyOb5/dlcXh2fSO/lqdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679343215; a=rsa-sha256; cv=none; b=cPPBF4MR/8/fdex9Tfs67+O+ZQHEXyLc3hE8ZoSXVqMK9apT+BK89GWNPogQndAgNDJmLg iXlF0gNo9Jqm3PITOuYFH3MZRbuOaeRmjovmUo+GhVDSLLTkpQN66f5iA3eLzgLuxfz5O2 JyP0a/u98UJt0a96xILbwZuWUG8qq/AZW3VjxkM7Wpjxl4+qW4L2/kgEvS9JmcfHWEun9D CcugZPcFC55bqhpFOfbPLbdD1Qnoix9W8QXw6gJFEk5UlHVWBNSyI/w94kqdQMTaApqVal VgMocOUEBpdara+qWOc0LwX0Xo0XtvvU/IvlzDxpLKJAat/7mGSzCthaKc1bIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgQsq4f4tzkHX; Mon, 20 Mar 2023 20:13: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 32KKDZvV033285; Mon, 20 Mar 2023 20:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKDZ06033284; Mon, 20 Mar 2023 20:13:35 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:13:35 GMT Message-Id: <202303202013.32KKDZ06033284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c05614ac97e4 - main - mi_switch(9): fix comma placement List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c05614ac97e4b03715145d2bcf9e32956aa4f5ff Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c05614ac97e4b03715145d2bcf9e32956aa4f5ff commit c05614ac97e4b03715145d2bcf9e32956aa4f5ff Author: Mitchell Horne AuthorDate: 2023-03-19 22:58:24 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:12:12 +0000 mi_switch(9): fix comma placement Sponsored by: The FreeBSD Foundation Fixes: 175db7b58270 ("mi_switch(9): update to current day") --- share/man/man9/mi_switch.9 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man9/mi_switch.9 b/share/man/man9/mi_switch.9 index 199569845380..50e026aca2ea 100644 --- a/share/man/man9/mi_switch.9 +++ b/share/man/man9/mi_switch.9 @@ -172,9 +172,9 @@ to the chosen thread .Fa newtd . First, it saves the context of .Fa oldtd -to its Process Control Block, +to its Process Control Block .Po -PCB +PCB, .Vt struct pcb .Pc , pointed at by From nobody Mon Mar 20 20:30:56 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRFr5S3Qz40Ccw; Mon, 20 Mar 2023 20:30: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 4PgRFr4lDNz3PbG; Mon, 20 Mar 2023 20:30:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mjbUycBgrmzyrfOs0ZsQAuwbL+7f37HXR726sdLXcAw=; b=BwBfgvgJvfWOrpYuwiQwz3r0yWPV6wdirHgo4/cV/vO3VFybjOzO1t3kirk7fftd3y/I3G J6xdMw2gkgqYUyIl7hMge6bCtQi2ks99RwPCLweCKPmTGesBZHbtWwuPqsMcuOTq2KlIh/ l4hRRfKV0y2zI5cV47htatYFi8GCVzhA6H3TQmiQIX5RYdzux/R3j9C9kfa2m5PBmM7xUM EwY5AsozEXIXb5/HwEalfFUbJ2MpKMgG2D5EDq17zNU+9O+jzqvUDPgb/IxN2ivtA0104Z u+t0+JzW84uKF23ObOzyehX0kllplBRd5F37lRLPCr/cM2gE5bwR1fkZI1BxRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mjbUycBgrmzyrfOs0ZsQAuwbL+7f37HXR726sdLXcAw=; b=PF59qHLeWB/OdMOB055jhCd9kwKdqVJBaBfgdHM4ZLbQMHEX9C4CL181Los3m1k+UADr6c fVgcvG1p1y9SSDQzHofsjG5Fa77kEln0Iqcg6MGRw1MViHaTMpSN7IvKoefzwWXuonZBhj 67o1qOAThRmG0bKzFzbVMrxv1PzwfF2Gl2Jt+RCYf6X9ZnBZVGqX8Ey/BVrNv0IZDrXgYy ljfhzSARGla4R1VEYlaSEPVs0eulAbgq0LUZ312jaoigCm7y0cKSMULhRIwHz/fHpfVgtO s6D3Hvci35aeLX/TWD+xPK/xJpNDvto6FWCt0cBUC8FiiEtPWR708uzP/Xpdew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344256; a=rsa-sha256; cv=none; b=STVQBBGzyx8H65u0zqxBaO0JJ5/VEhWjwyZYqjZ175rcGQ8fTqlEVXLK9xaq8GmzVhIapL 5yggMXb811GBFHTX8/CPc0si5P+z0h2cGJmUtd5HhFV/5R7QxZ/hKb1k2uXe3hEpkKYtWg x0nw0SMnTlCNfiJCwS7xFbtV6T0l1EhxcrI6QHGHx8wyCnIa6dEfgxnrUqIYkEr6M7F8O9 4yFrln6u0nwK8z1oMz/Q+HTQ5R/PCvxKYH09chzRmJNHsd8vNS9+Lln/FJJiT1wOwmbtHg elxqrUVjvH0L8SUCoMDH/99WDD/EiumwYzP85VN6XYiDeDCsC4hB73kYmS4Rzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRFr3qDZzk6N; Mon, 20 Mar 2023 20:30: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 32KKUujn060797; Mon, 20 Mar 2023 20:30:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKUupO060796; Mon, 20 Mar 2023 20:30:56 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:30:56 GMT Message-Id: <202303202030.32KKUupO060796@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: b59f9d03cd87 - main - vmrun: Expose bhyve's -G option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b59f9d03cd87b721e22e1d2b37876d3d2a86a3f1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b59f9d03cd87b721e22e1d2b37876d3d2a86a3f1 commit b59f9d03cd87b721e22e1d2b37876d3d2a86a3f1 Author: Mark Johnston AuthorDate: 2023-03-20 20:23:26 +0000 Commit: Mark Johnston CommitDate: 2023-03-20 20:26:54 +0000 vmrun: Expose bhyve's -G option MFC after: 1 week --- share/examples/bhyve/vmrun.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index c3cd05356eea..9770ff459a67 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -58,7 +58,7 @@ usage() { "[-d ]" echo " [-e ] [-f ]" \ "[-F ]" - echo " [-H ]" + echo " [-G [w][address:]port] [-H ]" echo " [-I ] [-l ]" echo " [-L ]" echo " [-m ]" \ @@ -76,6 +76,7 @@ usage() { echo " -f: Use a specific UEFI firmware" echo " -F: Use a custom UEFI GOP framebuffer size" \ "(default: ${DEFAULT_VNCSIZE})" + echo " -G: bind the GDB stub to the specified address" echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location" \ @@ -132,7 +133,7 @@ vncport=${DEFAULT_VNCPORT} vncsize=${DEFAULT_VNCSIZE} tablet="" -while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:G:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -165,6 +166,9 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do F) vncsize="${OPTARG}" ;; + G) + bhyverun_opt="${bhyverun_opt} -G ${OPTARG}" + ;; H) host_base=`realpath ${OPTARG}` ;; From nobody Mon Mar 20 20:36:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNg3g7xz40Cnc; Mon, 20 Mar 2023 20:36: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 4PgRNg2wLnz3R0l; Mon, 20 Mar 2023 20:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n8s6X7Lhp2GpxDlTL45DO56TgmBkkr+PBseTINZpl74=; b=ZZ5EFX8VZo8nIIa17pNcyMPsX1sKhLiJPTOpk/GUh/07EfGbDl1RgGSpSLVVSPRheFUyMM IalIv2vy/iyCqxpehbrS7Izq5I+mMpTVRtXtZhkNY9GgHUuioODNBI7G+yt+Fv+QkLyYPC 32KbygH/nfpoWYublWc5945G1gnG2t/cVb4H/3HYjFCIrE2EjLUgXFrUv6y/KUzNMUmCJK rev8FODU7qGyDWiEhWdRZi2edJM+mndIHuzHglzVG6Fmwfo2xLSOYAOW2zZh9/s5K/1vYI CV7SqD1ohvSendyh9NYdP55ngKhgGxK1OnE5rzDJZNn/UbmTJOf7atKO3gvI2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n8s6X7Lhp2GpxDlTL45DO56TgmBkkr+PBseTINZpl74=; b=s9zLccAYHmj7xfxFI7V6YMXTYa/PTUnOwxHyNW+sIfqJ3FD2T5bEE2ESJBFoPvqHefh3Sl E1vCn/61bKg49nFiOH7CTiwAZSMj7TI1wP1Qj5F/Wjjg2KrKqrGONIUzZ0ceDMvkZrv673 9dvQP+GTByyWS6132/6QVrQRJZXS9uWNmI2Nr0AOLfF/313MsAqMltgGrUFc3zxLhozG6c phC/pbPYmLGVlzPtmhQeUEjQWRVyyWBNLs0B2o30/qsRNCf4HcUErQmk5bVBnSAU2ji31f VWBO3SKvag0GHZs6lFPPqxMWFGlltQvXt1HroXZ92jtcqvkS6ZAk4FTmP3la1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344611; a=rsa-sha256; cv=none; b=mQ3sPLQfzkCruAZSF/qY+uxRgcy5X+vrakq0mL+zi843Os1qvykqCTxJxv89A2cvUTpa3S veLVBbZrE0z6ddpkYm84XACy9LQ1i0i1zznx+RvCD3P7BJ+nVVYothKFqTEgl3dxJntl94 K1ATNrptt5qKd/cCeH+axGKX7gapG9XNu/MfR5OAtD74aAxSxdJhVTP9lqojO+914rzTHO PItmGPoo6AeQyLCMzguBzB7y2ATONxSyzOTwpOXI6+rH5DOpkG6qVWNCLOlS7XsK2Cb8Lp 9s6Ov5lQdggYryxduTtFjGOUCjXpvv8ncmjUeMBq128crd5ebx+5pE+CmNGEaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNg1yrMzkyv; Mon, 20 Mar 2023 20:36: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 32KKapsF066199; Mon, 20 Mar 2023 20:36:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKap5j066198; Mon, 20 Mar 2023 20:36:51 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:51 GMT Message-Id: <202303202036.32KKap5j066198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c650e1949558 - main - arm: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c650e1949558c1993d7486859ad9804fd582129e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c650e1949558c1993d7486859ad9804fd582129e commit c650e1949558c1993d7486859ad9804fd582129e Author: Mitchell Horne AuthorDate: 2023-02-06 15:57:33 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 arm: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/arm/arm/nexus.c | 90 +++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c index 0cd960ec3682..48e766b0cc62 100644 --- a/sys/arm/arm/nexus.c +++ b/sys/arm/arm/nexus.c @@ -45,20 +45,20 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include -#include -#include -#include #include #include -#include +#include +#include #include +#include +#include #include @@ -79,37 +79,31 @@ struct nexus_device { static struct rman mem_rman; static struct rman irq_rman; -static int nexus_probe(device_t); -static int nexus_attach(device_t); -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, u_int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); -static bus_dma_tag_t nexus_get_dma_tag(device_t dev, device_t child); +static device_probe_t nexus_probe; +static device_attach_t nexus_attach; + +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_release_resource_t nexus_release_resource; + #ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); +static bus_bind_intr_t nexus_bind_intr; #endif -static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol); -static int nexus_describe_intr(device_t dev, device_t child, - struct resource *irq, void *cookie, const char *descr); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); - -static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +static bus_config_intr_t nexus_config_intr; +static bus_describe_intr_t nexus_describe_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; +static bus_get_dma_tag_t nexus_get_dma_tag; #ifdef FDT -static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, - int icells, pcell_t *intr); +static ofw_bus_map_intr_t nexus_ofw_map_intr; #endif /* @@ -123,27 +117,29 @@ static device_method_t nexus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, nexus_probe), DEVMETHOD(device_attach, nexus_attach), + /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_config_intr, nexus_config_intr), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), +#ifdef SMP + DEVMETHOD(bus_bind_intr, nexus_bind_intr), +#endif + DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag), - DEVMETHOD(bus_describe_intr, nexus_describe_intr), -#ifdef SMP - DEVMETHOD(bus_bind_intr, nexus_bind_intr), -#endif #ifdef FDT + /* ofw_bus interface */ DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), #endif - { 0, 0 } + DEVMETHOD_END }; static driver_t nexus_driver = { @@ -218,7 +214,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) child = device_add_child_ordered(bus, order, name, unit); - /* should we free this in nexus_child_detached? */ device_set_ivars(child, ndev); return (child); @@ -227,7 +222,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include footbridge.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -309,9 +303,9 @@ nexus_get_bus_tag(device_t bus __unused, device_t child __unused) { #ifdef FDT - return(fdtbus_bs_tag); + return (fdtbus_bs_tag); #else - return((void *)1); + return ((void *)1); #endif } @@ -319,7 +313,7 @@ static bus_dma_tag_t nexus_get_dma_tag(device_t dev, device_t child) { - return nexus_dma_tag; + return (nexus_dma_tag); } void @@ -348,7 +342,7 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; - return(intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); + return (intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); } static int From nobody Mon Mar 20 20:36:52 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNh4Q36z40CwR; Mon, 20 Mar 2023 20:36: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 4PgRNh3dz8z3R1C; Mon, 20 Mar 2023 20:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4vDsrH43PijKdj5p/pnDEzsEJjqthQG90MeQKxxMxjI=; b=ha+0a17z+7fAk5UXUs7MkLvzZvogZaP/oGaM9AYjdTFGtjk/DxkXrxuuMqtMohX/vlOMNJ 6Fq3TC2t1J0BF0Bg+v2drZs+pKgV97xzQqNUDe5ixqO20073zGCJ9WKrNZbrJjznCrXZ/3 cdNb2i9x1rFgekrkjb/kzdAaAVBm4OOOa0itlcXJcHQ3BbMKNEZn8j2SX7nwZhiJtJF4q0 Qq9oKN/M8gDrsPPxYl+UX2zfJs1fiw7wNenaJ9aiE1s4yn91Z6cQRjSHvx1kzuIjeQgaIM KgzxuAn3A7qEnuXPJPCs+J5nMZmpZo5VC19bYAoc1yXEQZhMCOu9vDgHI0c7vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4vDsrH43PijKdj5p/pnDEzsEJjqthQG90MeQKxxMxjI=; b=X9u3ZNRSNEys9pgqUsRYwfIprDgs6on7JQyO0BRGyH9ibdIcS6Kh4HQDsT2QPoxw0Ta2SN 4iWaAn4iXtGSQgKl/IO88vUtBHkE9I8zZMaDFOFSbXBcNyEDzrEcnr7+yaDPAQgwkSbQzj Fq6jgej5hI9aI+YKmJcAtlcyZWYZlbbcRoC2G9chyk8lswKYkWR4Ik52SYBkqRdpDp3dFD nUNykJiZfZneyIpkaT9cNg874JdWttDyTq2C75A3nXRU90L6JcVmyzVMOrLVEUcpoFbq/+ T2s9dhOXbEfaQKLad2x61EFsRh8hKbpe9lbEs7ld0hHyF+r6MyoK4r8iKZp53Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344612; a=rsa-sha256; cv=none; b=Bx6lhkOKQu3WBD+Yzvk8MZaVszmstCRUOxF/4eGaYsVEceQfT1ZCfVCvvcJut+d6XYVpPC pZrP3OwNdVviN/+5huU3bIvvjrB0RYSKgHXz/b4GLGXy/Hu54HicLZJkOP1nt7sd31LvdZ AVwRQFSbnvXbe97pOJeVsSnT2QbRFDA4Yaonz6qVdJieqSzFaUMsu6CLBM/DM69LNJh1mm B88sGI2NOKF4mW6+Q5+Q4tp+a5mrrIy/4Ob3q8KVZY8EFWuH9Nja6iCpZm3rdTrC9W0EIa E5NONb+x1USnuUucQQwqPuRz6NMfJcWljnOULsXXfGet9C4Mj34tGt+ihwvRUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNh2dCmzkq4; Mon, 20 Mar 2023 20:36: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 32KKaqCY066218; Mon, 20 Mar 2023 20:36:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKaqP7066217; Mon, 20 Mar 2023 20:36:52 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:52 GMT Message-Id: <202303202036.32KKaqP7066217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: e582d4a2b09e - main - arm64: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e582d4a2b09e679baae457b50c7270b4a9f501bf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=e582d4a2b09e679baae457b50c7270b4a9f501bf commit e582d4a2b09e679baae457b50c7270b4a9f501bf Author: Mitchell Horne AuthorDate: 2023-02-10 14:26:53 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 arm64: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/arm64/arm64/nexus.c | 96 +++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 0d4257406ca4..29680fe5b9c8 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -46,22 +46,22 @@ __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 #ifdef FDT #include @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "acpi_bus_if.h" -#include "pcib_if.h" #endif extern struct bus_space memmap_bus; @@ -101,63 +100,57 @@ static device_attach_t nexus_fdt_attach; static bus_activate_resource_t nexus_fdt_activate_resource; #endif #ifdef DEV_ACPI -static device_probe_t nexus_acpi_probe; -static device_attach_t nexus_acpi_attach; +static device_probe_t nexus_acpi_probe; +static device_attach_t nexus_acpi_attach; #endif -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, u_int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); -static int nexus_map_resource(device_t, device_t, int, struct resource *, - struct resource_map_request *, struct resource_map *); -static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol); -static struct resource_list *nexus_get_reslist(device_t, device_t); -static int nexus_set_resource(device_t, device_t, int, int, - rman_res_t, rman_res_t); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); - -static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_get_resource_list_t nexus_get_reslist; +static bus_map_resource_t nexus_map_resource; +static bus_release_resource_t nexus_release_resource; +static bus_set_resource_t nexus_set_resource; + #ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); +static bus_bind_intr_t nexus_bind_intr; #endif +static bus_config_intr_t nexus_config_intr; +static bus_describe_intr_t nexus_describe_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; #ifdef FDT -static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, - int icells, pcell_t *intr); +static ofw_bus_map_intr_t nexus_ofw_map_intr; #endif static device_method_t nexus_methods[] = { /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_map_resource, nexus_map_resource), - DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), - DEVMETHOD(bus_set_resource, nexus_set_resource), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), - DEVMETHOD(bus_setup_intr, nexus_setup_intr), - DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), - DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), + DEVMETHOD(bus_set_resource, nexus_set_resource), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif - { 0, 0 } + DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_setup_intr, nexus_setup_intr), + DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), + + DEVMETHOD_END }; static driver_t nexus_driver = { @@ -223,7 +216,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include footbridge.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -243,10 +235,10 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, */ if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) - return(NULL); + return (NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); if (rle == NULL) - return(NULL); + return (NULL); start = rle->start; end = rle->end; count = rle->count; @@ -369,7 +361,7 @@ static bus_space_tag_t nexus_get_bus_tag(device_t bus __unused, device_t child __unused) { - return(&memmap_bus); + return (&memmap_bus); } static int @@ -444,7 +436,7 @@ nexus_set_resource(device_t dev, device_t child, int type, int rid, /* XXX this should return a success/failure indicator */ resource_list_add(rl, type, rid, start, start + count - 1, count); - return(0); + return (0); } static int From nobody Mon Mar 20 20:36:53 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNj4zgWz40Ckt; Mon, 20 Mar 2023 20:36: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 4PgRNj4VgDz3h18; Mon, 20 Mar 2023 20:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WgIcyxg7ScyI8ogR5xdBfV3O+nR5BMtz0KyqC1Mg/lI=; b=H453LakM4Vfnj1iiqc/NxfTGTLCmk5GyehjvWoclSv11h482SCdRVwrAY5MtYsPIg2st5t 2CopuC52z0Z70GQ3W+10X/MgOHpSWxfWs3jtxbePBhPkq4nrlc8DUNYY8kMNWlo8Md5rsg 2ZJUdYoSiKwUkkUyVydmjPwUTvcFOX38AgtZt576EQf9HdxJdavgZc0TLk8U9aRHbFj793 T+tW5xRf8Ju2C8LhGle1c+pHGgOoUx8vYOtgZkdRh0Z0JJBHXzHAnOO84wlpvfaPgPHdkr FgWX0js3gDPP4i4AfI7c6+JT8sFpIlRBmpKPU/mCdacMo9bnduzb9XaHnll/Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WgIcyxg7ScyI8ogR5xdBfV3O+nR5BMtz0KyqC1Mg/lI=; b=uzNiz/WbuSFUBi/dVMS46V9pSf+5/QzgjWd2/BXleQakSzMXao5JHF39CH0v1f54T4O82v 5llVL17PbvpQfvBnaZClWGswOYVVBRZAo2vn79ikLmuucHgcJG46JZkngC44//em/qACom pDx8bsc3zh/2FQr3ujzPUHUbNEatkrjFwsZ9QsrQtHTvonvWpnVSPSd6HFCI9bTST4/ioD OCPoy7NemmaeQe1M/bTmdu5diRk3qI1L1ZyAmUCZgJ4OSvg4fwWfkfJyCu9U3se0q/dMQl CeRsIPZLmWKJyhR9ZzjmKOxWuig42EysLbRpKdjC57t24IsVUU2BLsi6Bd/jaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344613; a=rsa-sha256; cv=none; b=kg+G9FuDAioadTQUhPG0+ydhfs8Mq6fo8dmEwdhsqfw8+I8MHz+toBzh+hr0SM2PZjtTEx NRHEn69b/WSe+lAyqVjL+UBAhuO9k3+RfcORhBofE7AnEVciNViw4ofJAHMfdouLed5PFy coZo2AYi1pw+2acywmoO4hKIAgp9Owpet3VxTPjFQKDsGazgLLunO9BDWpbMXOtuxx+mQt aaLZEcC0VPLc6bOLT/kf77NeRxnKJskEzawcBUi32hSHIII6bYbF4yKRaKbT4v6DZ0DYxj 5gyLpGbMuFLpnpJ/JkvexoghxaCi1Ld7poOM3XFI9kevtj7JDm6HRldUim1TJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNj3X0mzkb6; Mon, 20 Mar 2023 20:36: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 32KKarps066237; Mon, 20 Mar 2023 20:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKar2O066236; Mon, 20 Mar 2023 20:36:53 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:53 GMT Message-Id: <202303202036.32KKar2O066236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: abe3309e71b9 - main - riscv: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abe3309e71b94527e937f034dd81ca7d6afdeb67 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=abe3309e71b94527e937f034dd81ca7d6afdeb67 commit abe3309e71b94527e937f034dd81ca7d6afdeb67 Author: Mitchell Horne AuthorDate: 2023-02-06 15:53:09 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 riscv: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/riscv/riscv/nexus.c | 85 ++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 47 deletions(-) diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index 33720475844f..96c4cf4ddca0 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -76,36 +76,28 @@ struct nexus_device { static struct rman mem_rman; static struct rman irq_rman; -static device_probe_t nexus_fdt_probe; -static int nexus_attach(device_t); - -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, u_int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); -static int nexus_map_resource(device_t, device_t, int, struct resource *, - struct resource_map_request *, struct resource_map *); -static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol); -static struct resource_list *nexus_get_reslist(device_t, device_t); -static int nexus_set_resource(device_t, device_t, int, int, - rman_res_t, rman_res_t); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); - -static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); - -static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, - int icells, pcell_t *intr); +static device_probe_t nexus_fdt_probe; +static device_attach_t nexus_attach; + +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_get_resource_list_t nexus_get_reslist; +static bus_map_resource_t nexus_map_resource; +static bus_set_resource_t nexus_set_resource; +static bus_release_resource_t nexus_release_resource; + +static bus_config_intr_t nexus_config_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; + +static ofw_bus_map_intr_t nexus_ofw_map_intr; static device_method_t nexus_methods[] = { /* Device interface */ @@ -116,21 +108,22 @@ static device_method_t nexus_methods[] = { DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_map_resource, nexus_map_resource), - DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), + DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_set_resource, nexus_set_resource), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), + DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), - { 0, 0 } + + DEVMETHOD_END }; static driver_t nexus_fdt_driver = { @@ -139,6 +132,9 @@ static driver_t nexus_fdt_driver = { 1 /* no softc */ }; +EARLY_DRIVER_MODULE(nexus_fdt, root, nexus_fdt_driver, 0, 0, + BUS_PASS_BUS + BUS_PASS_ORDER_FIRST); + static int nexus_fdt_probe(device_t dev) { @@ -203,7 +199,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) child = device_add_child_ordered(bus, order, name, unit); - /* should we free this in nexus_child_detached? */ device_set_ivars(child, ndev); return (child); @@ -212,7 +207,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include footbridge.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -232,10 +226,10 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, */ if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) - return(NULL); + return (NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); if (rle == NULL) - return(NULL); + return (NULL); start = rle->start; end = rle->end; count = rle->count; @@ -301,7 +295,7 @@ nexus_release_resource(device_t bus, device_t child, int type, int rid, if (rman_get_flags(res) & RF_ACTIVE) { error = bus_deactivate_resource(child, type, rid, res); - if (error) + if (error != 0) return (error); } return (rman_release_resource(res)); @@ -326,7 +320,7 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, /* We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(res); - if (error) + if (error != 0) return (error); error = intr_setup_irq(child, res, filt, intr, arg, flags, cookiep); @@ -403,7 +397,7 @@ nexus_set_resource(device_t dev, device_t child, int type, int rid, /* XXX this should return a success/failure indicator */ resource_list_add(rl, type, rid, start, start + count - 1, count); - return(0); + return (0); } static int @@ -474,9 +468,6 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, return (0); } -EARLY_DRIVER_MODULE(nexus_fdt, root, nexus_fdt_driver, 0, 0, - BUS_PASS_BUS + BUS_PASS_ORDER_FIRST); - static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, pcell_t *intr) From nobody Mon Mar 20 20:36:54 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNk6blDz40Cl1; Mon, 20 Mar 2023 20:36: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 4PgRNk5vj8z3RFL; Mon, 20 Mar 2023 20:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=clb9Z1eXTyqfeSfbSFlBBELfr4D00swibYHhGg5BF/o=; b=QzRpe3SMAAjSydpCnYYq52FtetpFekj1hMuI9ZvQyBSNSPM2k7isV8vXVdAFNnmehshu+A aeDD5hJSjk7E5eU/aGczVh6hRXK07ubcYBVHKrdDP5Y5FKj8hTFLRju4nGsvUEH1qjduIt 2x+4TbhsUMNjJF2NkjrMyVQxiYdw0OsjFQ39JaOux2uuXImRU9VY++lrLt3NhtVu5tFJVA CE0Ia46mqgmY4KoEJZWhH66miCOnegiWXztFmkCFbH05Z/x9CywdDKJYG8DS4CxAQ0dbW1 FXV4lzde6x4X4R6vgoWvGlKiy6JgmFc1hAUtO84bElEjWzFB3WQmtMM19ney3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=clb9Z1eXTyqfeSfbSFlBBELfr4D00swibYHhGg5BF/o=; b=s868h24kZYOzDHNg7tbDP5w0n7VtjxVSZbDuYaF0xJ1dmfuqCrqZrN6AVwTdFOI6bfL4ud sa4/APafhBMEMHQqZvPJVUa8FDoC9nm5yXV3MoVCJrqSGDMJYH4o7uQlGWEFCDCdn4IPAP QJFSVuSHQoHm6C6NaP6WCQnrJegK7sr3Kp1SiDAeKaPlpoY6wfvEn2GRadpbyYH8Qjq7Pb Gnh161ln+Pzte3quoYR+0c3depMyYFnXyXm5KwDcTVOsH5gwzD5ITDgjdgBhU7xqsMB75k OWhkQWbAqImQeKu7v+UFX6BaLW3aK5Uh04NPTnzuaL+yzVx8qYIkKYWFQgU3jg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344614; a=rsa-sha256; cv=none; b=KWL5tVvAVXjSR8wILimNlJ6/Sks+q62ddCf4f0rS2gjentaLI/PkQiNfTcDsahR7fCdNhq BYevhTetreAjNgi/atHs1/OCMEL6O21KMUYM7k9vgOmW01mAKVzb2ANSWhGyfJpbM3SgNj qh0s/Km7ts0pwXQxqylOxXgakZYUB1kABHil6iT54OulFWfzVOeREFhRWbcbZKsbTHLW6Y 2c3n0vMtislzmCeoQDmENIZ7Cc9P5VZab9Dy+Ho+jYS9HRVJcW1GoTLmTneMMtzUZOF6dY ERi9OxXH4VatR7/gJRUKAvjB5M0K9pfK3x3WgXWyu0L/Jck6wJzzSOivC6TE1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNk4jkVzkml; Mon, 20 Mar 2023 20:36: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 32KKasTt066256; Mon, 20 Mar 2023 20:36:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKastX066255; Mon, 20 Mar 2023 20:36:54 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:54 GMT Message-Id: <202303202036.32KKastX066255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c514686aa06a - main - powerpc: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c514686aa06a08a97df051a75da9ea7964a74fb0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c514686aa06a08a97df051a75da9ea7964a74fb0 commit c514686aa06a08a97df051a75da9ea7964a74fb0 Author: Mitchell Horne AuthorDate: 2023-02-10 14:37:08 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 powerpc: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. Update the top-level comment to be closer to other nexus implementations. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/powerpc/powerpc/nexus.c | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 3a1e961c743e..7ae542d67afa 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -32,62 +32,62 @@ * from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09 */ +/* + * This code implements a `root nexus' for Power ISA Architecture + * machines. The function of the root nexus is to serve as an + * attachment point for both processors and buses, and to manage + * resources which are common to all of them. In particular, + * this code implements the core resource managers for interrupt + * requests and I/O memory address space. + */ + #include __FBSDID("$FreeBSD$"); -#include #include #include #include -#include #include #include #include -#include #include -#include #include #include -#include -#include -#include - #include +#include #include #include -/* - * The nexus handles root-level resource allocation requests and interrupt - * mapping. All direct subdevices of nexus are attached by DEVICE_IDENTIFY(). - */ +#include +#include +#include static struct rman intr_rman; static struct rman mem_rman; -static device_probe_t nexus_probe; -static device_attach_t nexus_attach; -static bus_setup_intr_t nexus_setup_intr; -static bus_teardown_intr_t nexus_teardown_intr; -static bus_alloc_resource_t nexus_alloc_resource; -static bus_activate_resource_t nexus_activate_resource; +static device_probe_t nexus_probe; +static device_attach_t nexus_attach; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; static bus_deactivate_resource_t nexus_deactivate_resource; -static bus_adjust_resource_t nexus_adjust_resource; -static bus_release_resource_t nexus_release_resource; -static int nexus_map_resource(device_t bus, device_t child, int type, - struct resource *r, - struct resource_map_request *argsp, - struct resource_map *map); -static int nexus_unmap_resource(device_t bus, device_t child, int type, - struct resource *r, struct resource_map *map); - -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); +static bus_map_resource_t nexus_map_resource; +static bus_release_resource_t nexus_release_resource; +static bus_unmap_resource_t nexus_unmap_resource; + #ifdef SMP -static bus_bind_intr_t nexus_bind_intr; +static bus_bind_intr_t nexus_bind_intr; #endif -static bus_config_intr_t nexus_config_intr; -static ofw_bus_map_intr_t nexus_ofw_map_intr; +static bus_config_intr_t nexus_config_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; + +static ofw_bus_map_intr_t nexus_ofw_map_intr; static device_method_t nexus_methods[] = { /* Device interface */ @@ -96,19 +96,19 @@ static device_method_t nexus_methods[] = { /* Bus interface */ DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_release_resource, nexus_release_resource), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_map_resource, nexus_map_resource), + DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), - DEVMETHOD(bus_setup_intr, nexus_setup_intr), - DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_setup_intr, nexus_setup_intr), + DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), /* ofw_bus interface */ @@ -222,7 +222,7 @@ nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, { return (powerpc_config_intr(irq, trig, pol)); -} +} static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, From nobody Mon Mar 20 20:36:55 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNm1Vdcz40CjG; Mon, 20 Mar 2023 20:36: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 4PgRNl6m4Wz3h6W; Mon, 20 Mar 2023 20:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Fvp6KNfIjXCvCe4Ro9fSf6YSayGtfBUNI/h4buSqg4=; b=GGcOHJykj/DgTB1ANP/dNWzu0wXFbhhbwb7JRxb6ASa2Ea0TrGuCyAk1MY07wQ8Z5ogR0B MdxEZaKTaLjTHTfjNFQf/39D2biaXSNYrUOIkdXsbEJinkagvrSY1Gt95xgkZ1EO9f7xv6 rL5C8pZN9QdAESe+3jfepwmOTD+lJ+vQd1s+a8x/JUYojHYqdUak3Ze1kCnGIwrOGQfGaS M0RPvuocSDtGnim9xzEuklXUYZJYQoAVoRLglTKFQnfz7fW1rjmawabjMYs/cRFcKYWBc3 FU8gWK7uo2csNqjtrZcLg+JkmHnE5aMCS6nxwZufTxU8dRxX6FaHyTRg0aZ6Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Fvp6KNfIjXCvCe4Ro9fSf6YSayGtfBUNI/h4buSqg4=; b=qG/5ScwpARIds/07/kGRX2yUfXnBuTHd1+ojvcsBeFdTscyHAsOVRbn6CAUxYoo/Y/Emxy /RTA+HakmFXvGFdY5L+IKywjOIjoE2fR9ogoFnSei3R0L0khgUuJG20zwfGAe2BlYIrX0o hlbMx6g0JRlAPKUCg5pzBk+ZeZnubJTOLrlFnse/n3CWXgxCrrnXnDT0/7jQy3nc0HBe1M 4PQwkYoADw/vJvAEtHWX5TdLmg0jA5yF5/uEsXXbLSDKcepUwPJd8XnH38z+NzZ0xza3+M coen4YWdCciKr5SHqpSIUuQ0ppfyrrGgufl2a1reoSu6HMUvkQ6KeP9UsNDfNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344616; a=rsa-sha256; cv=none; b=dqlI+/Gs/Oa5k5fQSdeMy30V+jv4AP9qDWNcs+NHg05gpOR1k3ZHgBEShzj2b4SgMJRt4t HYv3qeUC35V9aQ+o3BwvPB7WNFD9DCcYOrUGNRTymUyL/oPW80Yo78EFS514l3aJnzrs5b hKD3NVqOpkuUTYg4YAFFElF6wm2Rnaif18Ox7idNiQG6Eu2I6G0MfAeCYcermrLqS/ik0+ bABpWTwjOA6M5YGUFLnE53KSZ9zXgPvG0h/73ct1cL6nE3E7t2KrsZfgDMLv38qOjNSR/Z JcFYbDmZLt8rF+zCgtOkRMoEGVo5pKy9YGTIIQVUChVwtTFaJiUXhJCPxWRaCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNl5fp5zkdy; Mon, 20 Mar 2023 20:36: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 32KKatDX066279; Mon, 20 Mar 2023 20:36:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKatKu066278; Mon, 20 Mar 2023 20:36:55 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:55 GMT Message-Id: <202303202036.32KKatKu066278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 99bd5c1fe322 - main - x86: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99bd5c1fe32272ce6e8d9b2d575b42dd94593b25 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=99bd5c1fe32272ce6e8d9b2d575b42dd94593b25 commit 99bd5c1fe32272ce6e8d9b2d575b42dd94593b25 Author: Mitchell Horne AuthorDate: 2023-02-10 14:52:38 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 x86: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/x86/x86/nexus.c | 165 ++++++++++++++++++++++++---------------------------- 1 file changed, 76 insertions(+), 89 deletions(-) diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c index 5bb53c22de1c..d02d081de1e8 100644 --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -52,16 +52,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include -#include #include -#include -#include #include #include #include @@ -69,10 +66,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include #include -#include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -82,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#include #define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") @@ -92,58 +91,44 @@ static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); struct rman irq_rman, drq_rman, port_rman, mem_rman; -static int nexus_probe(device_t); -static int nexus_attach(device_t); -static int nexus_print_all_resources(device_t dev); -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, u_int order, const char *name, - int unit); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, - u_int); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); +static int nexus_print_all_resources(device_t dev); + +static device_probe_t nexus_probe; +static device_attach_t nexus_attach; + +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_delete_resource_t nexus_delete_resource; +static bus_get_resource_t nexus_get_resource; +static bus_get_resource_list_t nexus_get_reslist; +static bus_map_resource_t nexus_map_resource; +static bus_release_resource_t nexus_release_resource; +static bus_set_resource_t nexus_set_resource; +static bus_unmap_resource_t nexus_unmap_resource; + #ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); +static bus_bind_intr_t nexus_bind_intr; #endif -static int nexus_config_intr(device_t, int, enum intr_trigger, - enum intr_polarity); -static int nexus_describe_intr(device_t dev, device_t child, - struct resource *irq, void *cookie, - const char *descr); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_map_resource(device_t bus, device_t child, int type, - struct resource *r, - struct resource_map_request *argsp, - struct resource_map *map); -static int nexus_unmap_resource(device_t bus, device_t child, int type, - struct resource *r, struct resource_map *map); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_setup_intr(device_t, device_t, struct resource *, int flags, - driver_filter_t filter, void (*)(void *), void *, - void **); -static int nexus_teardown_intr(device_t, device_t, struct resource *, - void *); -static int nexus_suspend_intr(device_t, device_t, struct resource *); -static int nexus_resume_intr(device_t, device_t, struct resource *); -static struct resource_list *nexus_get_reslist(device_t dev, device_t child); -static int nexus_set_resource(device_t, device_t, int, int, - rman_res_t, rman_res_t); -static int nexus_get_resource(device_t, device_t, int, int, - rman_res_t *, rman_res_t *); -static void nexus_delete_resource(device_t, device_t, int, int); -static int nexus_get_cpus(device_t, device_t, enum cpu_sets, size_t, - cpuset_t *); +static bus_config_intr_t nexus_config_intr; +static bus_describe_intr_t nexus_describe_intr; +static bus_resume_intr_t nexus_resume_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_suspend_intr_t nexus_suspend_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_cpus_t nexus_get_cpus; + #if defined(DEV_APIC) && defined(DEV_PCI) -static int nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); -static int nexus_release_msi(device_t pcib, device_t dev, int count, int *irqs); -static int nexus_alloc_msix(device_t pcib, device_t dev, int *irq); -static int nexus_release_msix(device_t pcib, device_t dev, int irq); -static int nexus_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data); +static pcib_alloc_msi_t nexus_alloc_msi; +static pcib_release_msi_t nexus_release_msi; +static pcib_alloc_msix_t nexus_alloc_msix; +static pcib_release_msix_t nexus_release_msix; +static pcib_map_msi_t nexus_map_msi; #endif static device_method_t nexus_methods[] = { @@ -158,26 +143,26 @@ static device_method_t nexus_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_get_resource, nexus_get_resource), + DEVMETHOD(bus_get_resource_list, nexus_get_reslist), + DEVMETHOD(bus_delete_resource, nexus_delete_resource), DEVMETHOD(bus_map_resource, nexus_map_resource), + DEVMETHOD(bus_release_resource, nexus_release_resource), + DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), - DEVMETHOD(bus_setup_intr, nexus_setup_intr), - DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), - DEVMETHOD(bus_suspend_intr, nexus_suspend_intr), - DEVMETHOD(bus_resume_intr, nexus_resume_intr), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_describe_intr, nexus_describe_intr), - DEVMETHOD(bus_get_resource_list, nexus_get_reslist), - DEVMETHOD(bus_set_resource, nexus_set_resource), - DEVMETHOD(bus_get_resource, nexus_get_resource), - DEVMETHOD(bus_delete_resource, nexus_delete_resource), + DEVMETHOD(bus_resume_intr, nexus_resume_intr), + DEVMETHOD(bus_setup_intr, nexus_setup_intr), + DEVMETHOD(bus_suspend_intr, nexus_suspend_intr), + DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_cpus, nexus_get_cpus), /* pcib interface */ @@ -188,7 +173,7 @@ static device_method_t nexus_methods[] = { DEVMETHOD(pcib_release_msix, nexus_release_msix), DEVMETHOD(pcib_map_msi, nexus_map_msi), #endif - { 0, 0 } + DEVMETHOD_END }; DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, 1); @@ -294,7 +279,7 @@ nexus_attach(device_t dev) if (BUS_ADD_CHILD(dev, 10, "legacy", 0) == NULL) panic("legacy: could not attach"); bus_generic_attach(dev); - return 0; + return (0); } static int @@ -311,7 +296,7 @@ nexus_print_all_resources(device_t dev) retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#jx"); retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); - return retval; + return (retval); } static int @@ -336,7 +321,7 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO); if (!ndev) - return(0); + return (0); resource_list_init(&ndev->nx_resources); child = device_add_child_ordered(bus, order, name, unit); @@ -344,7 +329,7 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* should we free this in nexus_child_detached? */ device_set_ivars(child, ndev); - return(child); + return (child); } static struct rman * @@ -367,7 +352,6 @@ nexus_rman(int type) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include npx.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -388,10 +372,10 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, */ if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) - return(NULL); + return (NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); if (rle == NULL) - return(NULL); + return (NULL); start = rle->start; end = rle->end; count = rle->count; @@ -404,17 +388,17 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) - return 0; + return (0); rman_set_rid(rv, *rid); if (needactivate) { if (bus_activate_resource(child, type, *rid, rv)) { rman_release_resource(rv); - return 0; + return (0); } } - return rv; + return (rv); } static int @@ -556,11 +540,12 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + int error; if (rman_get_flags(r) & RF_ACTIVE) { - int error = bus_deactivate_resource(child, type, rid, r); - if (error) - return error; + error = bus_deactivate_resource(child, type, rid, r); + if (error != 0) + return (error); } return (rman_release_resource(r)); } @@ -590,7 +575,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, * We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(irq); - if (error) + if (error != 0) return (error); if (bus_get_domain(child, &domain) != 0) domain = 0; @@ -666,7 +651,7 @@ nexus_set_resource(device_t dev, device_t child, int type, int rid, /* XXX this should return a success/failure indicator */ resource_list_add(rl, type, rid, start, start + count - 1, count); - return(0); + return (0); } static int @@ -679,12 +664,12 @@ nexus_get_resource(device_t dev, device_t child, int type, int rid, rle = resource_list_find(rl, type, rid); if (!rle) - return(ENOENT); + return (ENOENT); if (startp) *startp = rle->start; if (countp) *countp = rle->count; - return(0); + return (0); } static void @@ -794,7 +779,7 @@ ram_attach(device_t dev) /* Retrieve the system memory map from the loader. */ kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) - kmdp = preload_search_by_type(ELF_KERN_STR); + kmdp = preload_search_by_type(ELF_KERN_STR); smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase != NULL) { @@ -857,7 +842,8 @@ static device_method_t ram_methods[] = { DEVMETHOD(device_identify, ram_identify), DEVMETHOD(device_probe, ram_probe), DEVMETHOD(device_attach, ram_attach), - { 0, 0 } + + DEVMETHOD_END }; static driver_t ram_driver = { @@ -887,13 +873,13 @@ sysresource_probe(device_t dev) if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, sysresource_ids)) <= 0) { device_quiet(dev); } - return(result); + return (result); } static int sysresource_attach(device_t dev) { - return(0); + return (0); } static device_method_t sysresource_methods[] = { @@ -904,7 +890,8 @@ static device_method_t sysresource_methods[] = { DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume, bus_generic_resume), - { 0, 0 } + + DEVMETHOD_END }; static driver_t sysresource_driver = { From nobody Mon Mar 20 20:47:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdF3XbNz40DmW; Mon, 20 Mar 2023 20:47: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 4PgRdF377Bz3kKr; Mon, 20 Mar 2023 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PWyGIAU6W76OmUtCHQ4vAAGUV79WvGC5nsmQa3JP/jU=; b=BtBnqgvtqKAnipNItuBqdRE/gxCsdVghMelpF9R3OzMN2sUbJznSMX7l6MvEJHmRSrGb2M nGsd6fh6KZNRdNObinDg5Pqiia3OinwTrWW47g4+rFuzqP4m+gO3muHXDSgxzXMkdtlhMN EVQDNtLaK9b5iVfmWfOGbmrL9GAuR5dVPRLS/MYWw0loWazenWZO7gGGU5ewt2/mlpjCkJ W9DfBFcL0X6pJqS7OlnBpYz4PhABYs10clFAr9rKAslDswSbNxQX5evDy0MQ2Vm8nhyhls FGG5MjBCqtWZc8+t6gafb8hvcD6gY8u8NvK/5U8vzOlXbA4sqR4XxK3q/Q2KYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PWyGIAU6W76OmUtCHQ4vAAGUV79WvGC5nsmQa3JP/jU=; b=u/IfvEurC31/m0m25omZE5gOVMabZvmMDRo7G5aJFoX4ZfXbbyE5kAyBXNZZL43vbFhdRP 7dyiUj5t42xscpxNyGxuvBxcwPSTVIsn5j37/v8rSQH9tAbH5+FxraNeekwgc1bt1FhuXS SbvYi0tp5ZpIr+bzlnhmM3Nr94jas+RazHO1d3bzIbldyzYlpvx3bqG43YrvG6WwDqSbSy mLJSu6Ocdnzu0HbaofBmNsRjZEy+nlynUaPiFBAiGnlaVr0plWdTVq1YIrsia7w6V72Jkf AgWBgS2iFoi96i0PDV9PWGyJX0vF+4IBpbCbml0bLssY66twzaZeNn0QrkX95g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345265; a=rsa-sha256; cv=none; b=NbypIvgh+ucDDiz1IHxEGTGp/254FNmcFLB7fKqSp0UMptrDIOJucKyGV6sCbOjvfKWd1C /bxeQmKFD40zNLqHIipSAmvrkah6GaTRKALmYis1dZ1W7f4gbBl/2WNTSxImF+j8ZyZKhl ti03bEez9fVWJBT0/rA6wIzsDR9qZlxp4fJSLY20wlzGlt0wkbe4BpLF2zylUglRLMJjiR tGeg0+IApLtObOiHV5AodSyvQ1AHmcS58cZ943BZPsv8vD57svKoLaxD1+sAJvmJ4yXJYo laFEL+7shggF5kRWBFr0QIC94tZWdpzfhEsTcGJqiNFDRHTpih7eeTzkt2cdBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdF247rzlCS; Mon, 20 Mar 2023 20:47: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 32KKljVH083188; Mon, 20 Mar 2023 20:47:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKljre083187; Mon, 20 Mar 2023 20:47:45 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:45 GMT Message-Id: <202303202047.32KKljre083187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 0777b000f111 - main - linuxkpi: Define `dev_WARN()` and `dev_WARN_ONCE()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0777b000f1118af4abd7adf18bcff358fe8afd5e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=0777b000f1118af4abd7adf18bcff358fe8afd5e commit 0777b000f1118af4abd7adf18bcff358fe8afd5e Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:42:22 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:28 +0000 linuxkpi: Define `dev_WARN()` and `dev_WARN_ONCE()` Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39049 --- sys/compat/linuxkpi/common/include/linux/device.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 18f2eef895c0..09a61bdd0a64 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -199,6 +199,20 @@ show_class_attr_string(struct class *class, #define dev_printk(lvl, dev, fmt, ...) \ device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) +#define dev_WARN(dev, fmt, ...) \ + device_printf((dev)->bsddev, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__) + +#define dev_WARN_ONCE(dev, condition, fmt, ...) do { \ + static bool __dev_WARN_ONCE; \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) { \ + if (!__dev_WARN_ONCE) { \ + __dev_WARN_ONCE = true; \ + device_printf((dev)->bsddev, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__); \ + } \ + } \ +} while (0) + #define dev_info_once(dev, ...) do { \ static bool __dev_info_once; \ if (!__dev_info_once) { \ From nobody Mon Mar 20 20:47:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdG4z09z40Df3; Mon, 20 Mar 2023 20:47: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 4PgRdG3z15z3kNZ; Mon, 20 Mar 2023 20:47:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sSAinii4acS6PmVtQAPe2iOwb2MsTXe+qbMBPmW/wBw=; b=EkpI+pcm8IHOp7P9iO6WVj+JMrGuiDkrYBWGyiWr2zGN12X7qnbIT8L5xc1fBuHBxRviP5 6OdX26Prs7BZdRDFFa4QRceY+QkV/A1dhP85sqo5+x0DR/UyRQAaT39H2qkxibx2GXRcJ3 pcvdVBFHgNk1ZnN9lQGoJ60j4OTcAzJetPbAT+czUzkDzzGpJfoHfqZVFlHNDPcM218KUO /UgAXRkIZeYuaNjnqE9pfIyMQ7MTMhGt1jpBYnFd4dSkirm7tSbRtnSEhQqpCwqEAbxg/j n68HaqZXoEXmQKeQXjJp8efKS/n/FSDbVFjrYJAh0kUNRTriBbkugfg4rVbA0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sSAinii4acS6PmVtQAPe2iOwb2MsTXe+qbMBPmW/wBw=; b=GkJ8OYNrD81SNO+1Mz/rG8bKzxH/fl/dU0UACPRE0XtebXRff2CtAfQjWyxdd9Y3zofQaH ttUf0ELvdSKK32PkbCEmiEC8Hqxusb0VBndUydqt9muEVbw8jX1sqCkqhwwLK78XCWMRlV qjonllOKj4lkL/LyNc4rO5CKJicsdvWFRols+18qIqUndHKUufgrwXnQU84vl9lXoQMo5u T2TXV0MG/kvoZ8VoqVQQPtnnvQsh1zzMWM266y4OM9BMu4GGrJJq4FxRcmJ+mo9hiZwj8O 2DjpGBRsrISje+8K/BmvP53VCacg6cL/5QXfE/OGsBBHu0KnD38Maa42W92XNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345266; a=rsa-sha256; cv=none; b=eInxz5FRFvbGVkhj3cWTa+VKFzTu/r1BajVJdSgxD87gxqBnNsiH6+bW+hte5sqqanuIxf gMKTxw+b7ABMb0J+oIJKxsgnhN5mey3NaUDoANOx97Rd3v6qUpnNKloR5f4KR2ViRsfbrY KqI8acgJMDG7ynqZGlvKkiCvtMlkbyeY3wvoTg7INrRG4dtOcE5lHxOa6yENLQ6dkiHfy3 KqY32+PY6QpQ5iJWYg3A3zE5zpxb8yrKY/RnwSaz7M+RlyCINdxbaHdy17J2Z/agcq9OQx wWYAkmo7lbN73OvXo/2djzh+rneM+9f43Dsa7FJ/sEcC3CH9RtEfoBTJpPbltg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdG2Xg2zl9n; Mon, 20 Mar 2023 20:47: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 32KKlknf083213; Mon, 20 Mar 2023 20:47:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKlki0083212; Mon, 20 Mar 2023 20:47:46 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:46 GMT Message-Id: <202303202047.32KKlki0083212@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: e91f5814b8e0 - main - linuxkpi: Define `device_iommu_mapped()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e91f5814b8e0b2fcf154ec6161c6f5a7d0528c18 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=e91f5814b8e0b2fcf154ec6161c6f5a7d0528c18 commit e91f5814b8e0b2fcf154ec6161c6f5a7d0528c18 Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:42:38 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:35 +0000 linuxkpi: Define `device_iommu_mapped()` For now, it always return false. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39050 --- sys/compat/linuxkpi/common/include/linux/device.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 09a61bdd0a64..4b665e8db8d1 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -577,6 +577,12 @@ device_wakeup_enable(struct device *dev) return (0); } +static inline bool +device_iommu_mapped(struct device *dev __unused) +{ + return (false); +} + #define dev_pm_set_driver_flags(dev, flags) do { \ } while (0) From nobody Mon Mar 20 20:47:47 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdH58TRz40DRb; Mon, 20 Mar 2023 20:47: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 4PgRdH4VHxz3kNv; Mon, 20 Mar 2023 20:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WnV8jujC9hKDuaXxU2PtA7M/neo79TBiBxXqUjBAqOs=; b=XKSQfWUB0Z+XdN6EoQpf/DUH26ot16hLoLlgD10P33DaK8VVX2eRa+actvIr4D8qTzmkK4 ZIXeQH8VNSg0pDoLPQVtGirdM3U+FXi7p0z8ZqAQQZXWDHMOyVzQMZw1ImIx8P4nZY/M8h 807MJz5P7toph2NnN9Z2AduKYWQH/IhIaG6+zVPhCD9jXPwjohT9lV5NNmqkUhAz6R2YN1 MvFy0nlVl7Npr7AsDTn5AKpkKtYCPDGOPxAUqYBAwgwbgO2HGATBpgyDwVWURb4HNEq/xi 1j4mqEg1yIN69TPufrNuQCzZybHXiR7R63aEiu7llKJP/cnL56rvOBaFNvyQBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WnV8jujC9hKDuaXxU2PtA7M/neo79TBiBxXqUjBAqOs=; b=Ou1gmNL2/W+Wt9goKrQCe7vMOjGH0LrwSDdflECEuq1phZvSmKJU1ghUri4XLIDKVEW2tJ y2xPTiIJLMxxvT7OHdnuZLjYCTWKOXg73WkjlDglMdt0lOd6EmD9coVyoeWmiV1CEg1V7a GTx++709595bk8K1aPexxYZyzSkENfTg+q7ZvoKaZl2oHY4zbnufuaU0Q7ohAKErrdNdjC 7RLq0PgDeCAVa/HblzFTkfckU2ASxhiv8oa21CoGmKvJeUYNA8vowXE/ZbCkUR7hp/sd/G Mmm2/NsFJg9QPuNMCk7WSyYcl4ZSpmaUEUieqdMkJ7DthWwsQaeMN1UY/9ZAJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345267; a=rsa-sha256; cv=none; b=iOQY1HkTaLfO9EpYm3QOfVXu4bGUF/lgzuYtG1mopaZRUxzq4FfEhfihvUzLISXrKIlcx8 94wqcegRaN2H/FEjDoBnIM3cNAIWuXaTxR+x5+zZ4VCYDCZzGUofPVjD5yMJPt35Aei8af K7dTOBbYXqqL1Zd32RBXZCDJdoHB9xA2jfV0PpqNjtCox13Mw1GT9jxUWO1eYbmDXWfrek rPrOl2f71QA7igz9RTpYOCria2XE+nfBMhIJMcWfocRqg6Kh8ywM+KuLLSvcrj1SbYMiS2 Y6YV8KC/eVYrZOIpZMLMG8IYif8xExiTkZN/gG9ru+rJynocFZdizN172vPyhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdH3XPwzlCT; Mon, 20 Mar 2023 20:47: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 32KKll4w083245; Mon, 20 Mar 2023 20:47:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKllKo083244; Mon, 20 Mar 2023 20:47:47 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:47 GMT Message-Id: <202303202047.32KKllKo083244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 19a355436e03 - main - linuxkpi: Add `default_groups` field to `struct kobj_type` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19a355436e03e52c674dddbfd8694a728961ea1a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=19a355436e03e52c674dddbfd8694a728961ea1a commit 19a355436e03e52c674dddbfd8694a728961ea1a Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:43:46 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:35 +0000 linuxkpi: Add `default_groups` field to `struct kobj_type` We don't use it, but it is set by the DRM drivers. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39051 --- sys/compat/linuxkpi/common/include/linux/kobject.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kobject.h b/sys/compat/linuxkpi/common/include/linux/kobject.h index ad25058028fc..d52d330407bb 100644 --- a/sys/compat/linuxkpi/common/include/linux/kobject.h +++ b/sys/compat/linuxkpi/common/include/linux/kobject.h @@ -47,6 +47,7 @@ struct kobj_type { void (*release)(struct kobject *kobj); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; + const struct attribute_group **default_groups; }; extern const struct kobj_type linux_kfree_type; From nobody Mon Mar 20 20:47:48 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdK1KDpz40Dmv; Mon, 20 Mar 2023 20:47: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 4PgRdJ5vx9z3kGW; Mon, 20 Mar 2023 20:47:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r0WbltFq5AdoP3gCW/yKCNZv4Us+tefpGGz7gv1T+rs=; b=AV12sdIg7T4PCJBMg4TNRWzzs29Yt3ud9AzQ15qkJDKwff4GR8u0NZt4ZX0+QrNz/0jNF6 6l/967PxK2ic9UosyDcJTJBWPAU+i45mfVudQ6yqjCcd5nYLaqct1RdDYyVfzAAed2i5ZZ lvdujNgIabjg8ezQDhZ/Nj6cU7qhYcMOYMjdMEGLVtvg8MeL44sXfitZut/W90xB21KQ+G sH9mYpTyZX9lUJZn0ONIwp3N3gSXarxoKYJlZ128p0gI+WfaFZjYRiLVRYt85+Rf7OTqlS 2rmc8bDVIjVLKLCKnmujM/14+389om6uxT59ONpli9Yc9n4kpK+bZA9aTEsAAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r0WbltFq5AdoP3gCW/yKCNZv4Us+tefpGGz7gv1T+rs=; b=hAlplurwlsuRA36B6ijFLi7CppJ+x57RaP1u0jUc4gqlZPlGs9sFofK2k5aDks83av2bv7 9aO0K7xtiEGknrzdEiZg8dpg+VRvKCyDkQ1SxweFsuFIIXHHqnUwOeGrcmg8LTeGBK83Uz Pe0BJbSt+A4glL+EijP+wPx4dJ1oFXfBhvIbHTaudkgFmEjlh/bJkeeV5zo/ZQeIo77QRH Ah10cEuaCEqgbaxk3YtCSIx8oZ/7NeDUQ8txmB/F7RoxAzXcLzPnRkFqcgbnLH73FJMXCN mg9ippm2tjDdgBD2a9x6ajeSCsb21STunLSfBuz87yZbuPglpUNLaXf455ZGHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345268; a=rsa-sha256; cv=none; b=xhjQDb22u7wmp11d26x70D4mnilw0/x0dwQ/KS3JpzSLNhXLgdtb/pBji+2y2KkMCkcaiZ 7mvFlD9zI8Wbfy2wkn6e+Eni6opa8eEtKAhX/rEKpxooQgxJ5nWOqNGxogOyvJG0m+6z1w TlKPmdEvFWhH85kuzxm70EWV6ciJQfzkUQOcTPKGyuakw7Ikgh91lE6jjRuPWJszzpHLUP QCECdmyP6K189kFd1pA+VV3+Hcy0sY3DnPMVt0hYq1g7mVD1QYfY2eF7a1GRpESKJRxZwN Jh+YlnBQzYy4yHsziRleLGb3o7n3ZOatMH5TDTryPI6p1UdruxGDixwZkHbBeQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdJ4hWQzkqk; Mon, 20 Mar 2023 20:47: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 32KKlmWp083270; Mon, 20 Mar 2023 20:47:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKlmPc083269; Mon, 20 Mar 2023 20:47:48 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:48 GMT Message-Id: <202303202047.32KKlmPc083269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: af19988f6cd3 - main - linuxkpi: Define `pcie_aspm_enabled()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af19988f6cd3918fd222003540769a38abb63174 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=af19988f6cd3918fd222003540769a38abb63174 commit af19988f6cd3918fd222003540769a38abb63174 Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:46:38 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:36 +0000 linuxkpi: Define `pcie_aspm_enabled()` This is not the same as querying the PCIE ASPM capability. The function should return if the feature is actually enabled or not. It always return false on FreeBSD. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39053 --- sys/compat/linuxkpi/common/include/linux/pci.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index c9ebdf546696..2c222bf1cdbe 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1370,6 +1370,12 @@ pcie_bandwidth_available(struct pci_dev *pdev, return (nwidth * PCIE_SPEED2MBS_ENC(nspeed)); } +static inline bool +pcie_aspm_enabled(struct pci_dev *pdev) +{ + return (false); +} + static inline struct pci_dev * pcie_find_root_port(struct pci_dev *pdev) { From nobody Mon Mar 20 20:47:49 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdL0YNYz40Dh2; Mon, 20 Mar 2023 20:47: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 4PgRdK6ws8z3kZ1; Mon, 20 Mar 2023 20:47:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sb2C7bh6jzl7N4ntEZnbbIvp9xA7e5nx1CNoOH7J/hI=; b=aHykTe8Z9bgU8QogBBxNDGJ3EIv4+jFihdv641XRZGkEhtKAeX7rcscs715kFukSkhjHmO lW5lRVlO+jENMnTakzNbtpNc6NFpzvCnjnLMOvUPtxM7gG2IuXFOSue0kGFiKIrra+x1Z3 r+7D8hzpqBNp4e+R2Qrr7znP3wk7gTXrol6zaG8L36YIExWAc64HL1IFKOyT11nfW2gvGG 7dce+NR3ZtPTadgkZeR4/JkrznTGkq/yQQwCYeoczYrh/j4ZLvNtSQBDNtw2FQIPcTZaL3 Ukk1WJvoC7+mnotgINlFqnDoOxyEEbeQTE76IlSnTO/tod3x+rcyIsSzIkOKfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sb2C7bh6jzl7N4ntEZnbbIvp9xA7e5nx1CNoOH7J/hI=; b=EfLO4eXa78/mqaS4+lYoo6R1VMuGHZvT0txiFV1eAjeULUL8Gb3P03ENq1PwjOtgAiaVMS qXGtv/uWZuSmP9CJd0Pi/7napS2rUDVs0silWQe1IaML6bxsyGhhcDGIrQ69WBwwYbmp/v u3FzK4CZj5xSzPPu8+3KE7TlAr5wkauzkqA7ZvNl3YFKYClTf60ria4gYuL5y+MTt8jEBJ eiP2w6pj+wQBp0Est+eAZpvMl0OilnQ5Xb1Sslp6texsM+nat1uAfMK43VvWgo/fxXzmYD 1zu4dUmOxZujXDDuMawoHsWOJFEAoUtiFaofA6/dnbgcrFAwwd+B4a/5thQ7Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345270; a=rsa-sha256; cv=none; b=EvaZ8jWroCUoHZR5ReG1JLYoPYaNnyt87P4NZ6bLv0WuChFKUVJvtPSjojA6Oc/a2ziZG1 7tjg0q8lxKA046wKiMWrumBbH7Rg1lpMLwzsJsJndbkGdlsFheZInuRSKvk/QL4ltEnEws 36pzYIxghxRMvdFAgHInkmJcA1teHoIzcZGy4XkS7ey3XH0z1ni+3m1zLwhhZnvewwbT6a 6L03G+UUiK489QaoEyBcYiHI8eRKA8kMtktmKhA7kJj17yjwi9mnZrTT1nFpsJeTOfQnU8 gpRZIp3ZVgRf/HIikng6jUcCFMvIyMYJaA3iMq4cQdLBJwnYiv6fqxO09QWoNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdK5L27zl9p; Mon, 20 Mar 2023 20:47: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 32KKlnXQ083294; Mon, 20 Mar 2023 20:47:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKln02083293; Mon, 20 Mar 2023 20:47:49 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:49 GMT Message-Id: <202303202047.32KKln02083293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: eef905a85907 - main - linuxkpi: Add List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eef905a85907102bc00b76b5b135c24cabe0456a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=eef905a85907102bc00b76b5b135c24cabe0456a commit eef905a85907102bc00b76b5b135c24cabe0456a Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:48:06 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:36 +0000 linuxkpi: Add It defines a small part of the IOMMU API of Linux. We don't implement that yet. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39054 --- sys/compat/linuxkpi/common/include/linux/iommu.h | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/iommu.h b/sys/compat/linuxkpi/common/include/linux/iommu.h new file mode 100644 index 000000000000..391d9778a0c8 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/iommu.h @@ -0,0 +1,29 @@ +/* Public domain. */ + +#ifndef _LINUXKPI_LINUX_IOMMU_H_ +#define _LINUXKPI_LINUX_IOMMU_H_ + +#include + +#define __IOMMU_DOMAIN_PAGING (1U << 0) +#define __IOMMU_DOMAIN_DMA_API (1U << 1) +#define __IOMMU_DOMAIN_PT (1U << 2) +#define __IOMMU_DOMAIN_DMA_FQ (1U << 3) + +#define IOMMU_DOMAIN_BLOCKED (0U) +#define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT) +#define IOMMU_DOMAIN_UNMANAGED (__IOMMU_DOMAIN_PAGING) +#define IOMMU_DOMAIN_DMA (__IOMMU_DOMAIN_PAGING | __IOMMU_DOMAIN_DMA_API) +#define IOMMU_DOMAIN_DMA_FQ (__IOMMU_DOMAIN_PAGING | __IOMMU_DOMAIN_DMA_API | __IOMMU_DOMAIN_DMA_FQ) + +struct iommu_domain { + unsigned int type; +}; + +static inline struct iommu_domain * +iommu_get_domain_for_dev(struct device *dev __unused) +{ + return (NULL); +} + +#endif /* _LINUXKPI_LINUX_IOMMU_H_ */ From nobody Mon Mar 20 20:47:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdM1kPPz40DhL; Mon, 20 Mar 2023 20:47: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 4PgRdM0NFnz3kJr; Mon, 20 Mar 2023 20:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p+xLAXk56Y5Wmwb4CG/E2A4EVM7p9L3tX+SFXIxlaxk=; b=fhkt9MBt2vvMxKd1Mb2hU9XiWuBnyvx+HNC0A/krEy2LbAda3z/WPn/i9KubsKaB4Ds0kA eNAdQ/l2P8p/DLezhOE4EjI9VMAuZ/FXA77o64hyIBF2Dwoi437m1tn5jma5zeF4cQEtFb LeXujYdLgNjtosAZ63qmV1GLrVcfA5pH5zFOD/tzYjyyDDPRkmKdqMabVv2iZWUHnHTHxl l1Q2exOVzB8bfSdJkXy/pV80sati9z36nqNR/m/JwqVBxlQxzy85wQaCKAfHDTQiXhIMUG 6UrMthvddoP03vLWyE4OBzNP1aEJ1SA4rcK2V/abCwy2a1UNw5p7N0g7C6dzBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p+xLAXk56Y5Wmwb4CG/E2A4EVM7p9L3tX+SFXIxlaxk=; b=vokINdo9fG9w+Pj9G4HCU8npKODURO5L72ZYuyCZYVpnmCEA8hZsKD+B74tAxvkInEuMN0 MsMvpKqElb00UgBIEPKmehntSpC00THqKoqnU+3Kuwiuwf8TDgvT6xN9UgTBCdu+CcCLek ncEl+DW+qPMJ5bRABypBn8+Ueo5H4kbE3I/e43dnV+eoAbMZYfhPhjxOhWsZLrA5psRNfN bQpiYhQGTeRIj7NBSELO9oflQ9+2WDsCUXBPBlAf93hUfJFs3eRs28rleoYl8FaC3/ZMls hvbKyIs0LjP4fvaSOSBzgFJQoNONdtNANYQM7wvMWQt83gY8QbXOD/+gJFfI/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345271; a=rsa-sha256; cv=none; b=k9czoy2ZTT0NBKJGB22E+zzf1XyAae3lq13qir0OtCfU5Fy5CzdwfCF4BYLZ0PH5EOV+5n F0NxMv84ODQPjGSNBaDonFyqw0qMjARU8iVDdd48Ca2B9oaBZ8Il3odFtDPU8Qq2jV+L3i KsMetWOOjagQ3XQFn6eTD/MxkycF7xGcPH4KOX7tmv4ndq2jiBLnWnXjQcxHY09JlxlZgY TZ4kiePfCAZRWzHnknLMOuvnXvMXq/GHjGxfHiYkoAEHsCv2xY2ZQj2/H7ZIjzoZ+AaHB4 Dco/uImp1hqoZa/5jn+abXKlVD0Jm1jXCMfO+AFKfoSxjYy+NSjG6VS6sPmxjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdL6Ktczl1v; Mon, 20 Mar 2023 20:47: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 32KKloU1083319; Mon, 20 Mar 2023 20:47:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKlo0v083318; Mon, 20 Mar 2023 20:47:50 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:50 GMT Message-Id: <202303202047.32KKlo0v083318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 1b4e08b4832d - main - linuxkpi: Support non-NULL zero-size pointers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b4e08b4832deeea4b9121cdaed4f6700bdab03f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=1b4e08b4832deeea4b9121cdaed4f6700bdab03f commit 1b4e08b4832deeea4b9121cdaed4f6700bdab03f Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:50:29 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:36 +0000 linuxkpi: Support non-NULL zero-size pointers DRM drivers set some pointers to `ZERO_SIZE_PTR` directly (without allocating anything), to treat pointers which were "initialized" (set to `ZERO_SIZE_PTR`) with no memory allocation like really allocated pointers. NULL isn't used because it represents a third state. Reviewed by: emaste, manu Approved by: emaste, manu Differential Revision: https://reviews.freebsd.org/D39055 --- sys/compat/linuxkpi/common/include/linux/slab.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 915f33acf67e..a2cce4cfe75a 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -90,7 +90,8 @@ struct linux_kmem_cache; /* drm-kmod 5.4 compat */ #define kfree_async(ptr) kfree(ptr); -#define ZERO_OR_NULL_PTR(x) ((x) == NULL) +#define ZERO_SIZE_PTR ((void *)16) +#define ZERO_OR_NULL_PTR(x) ((x) == NULL || (x) == ZERO_SIZE_PTR) static inline gfp_t linux_check_m_flags(gfp_t flags) @@ -195,6 +196,9 @@ extern void linux_kfree_async(void *); static inline void kfree(const void *ptr) { + if (ZERO_OR_NULL_PTR(ptr)) + return; + if (curthread->td_critnest != 0) linux_kfree_async(__DECONST(void *, ptr)); else @@ -204,6 +208,9 @@ kfree(const void *ptr) static __inline void kfree_sensitive(const void *ptr) { + if (ZERO_OR_NULL_PTR(ptr)) + return; + zfree(__DECONST(void *, ptr), M_KMALLOC); } From nobody Mon Mar 20 20:47:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdN2mHlz40Drn; Mon, 20 Mar 2023 20: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 4PgRdN1cyRz3kK4; Mon, 20 Mar 2023 20:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tXFo9jUWEycwrGy1dB8wvguhyg6Dcrvfmo9kuJFLbcM=; b=sSiQtfpunokX+WJDhyzu5fdNpioxWHLzIMKntxwalRnnEgoPgtSAprDj+AjLG7wjtAaMAv Vv9gYkBa64cr5Bt6dQ39AX5NpeYO7NaJ53ifyAWrAFP+8bbiJEpQ163vaPrPILurXrx/jt O5hZr5CiZgMZN2O5DDiy3bRs+CxTs4vqNZ4Vzu9uCU/SS7FF+0/ceYmULwaj29b116oXF8 YuONnRrc8a3dn1SPD5iQEKFedM3mW5hMjUZoZMNc/FzmpsmXBRbdVvEvRu/eG6BzYdkGDD 0XNp1ybwm14qstH15hH/ASrorzhByFkB6OX9dOFA2QfPgwL0CcFMm8JkfPZj1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tXFo9jUWEycwrGy1dB8wvguhyg6Dcrvfmo9kuJFLbcM=; b=agDDrqOxYJUIMWsherLj/bSv1ru5WF9zrj8idiRDSX9QCOSrTjv6YfD5JAbtdM9oEAuNtf W8EkD93pk/5seCrYOqpDeHj8f6aMxAmJpDalhHZHyxy/gzXyH6SPSZwM5bcf1UGhYCcVLH tbasVjHdpqTbfQPfBYtQqi8hpW+biZLwGS76jVqjNqnUHQN8gy026eo3XspUdVbw6aovHO k6sToritvOjBUYpCY0pkqUwF/qXLHAGLLOQVB81ecjzduUZ9TKtxSIN/nnXVI2Xq0k6YaT K11lS41ZKGEnRuofUmbv8T2baP5/Y8S0X6IUWD9jM6Kk3QL/ZFmWhV5RDneTeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345272; a=rsa-sha256; cv=none; b=lKRyEEdtob2F2Kxrc7lrcgLRvLx9wewpO7j5cLrl6byMVQZa2iVAW25lDi9la+2+nSueN/ PUOD3BUGOyBhazz3DXd22QYZ3ShbxJbHfGnEZOE2qZ25E0PbXpOKmsirkjNnFn80jcIQj+ IVhEsVgFPn7jL2RdGj20HJSRI599L2quxk6J3u5ZBP+b0I+INbXw0jDQA8oGzjeO5U8Tgy GO/4VKngQ6RprSokqnUYNLdBNGUTrr8eAhPDexkFFtIV9YocwyvS1TGd5uXa7b4NIFxCOY RghCzWcQ8TvHS8Kpgg2v4O/6vhViztbsWL639mod50/VcQi0ZTGy3Eo/yzjo/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdN0D60zlJT; Mon, 20 Mar 2023 20:47: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 32KKlp3o083343; Mon, 20 Mar 2023 20: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 32KKlpOO083342; Mon, 20 Mar 2023 20:47:51 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:51 GMT Message-Id: <202303202047.32KKlpOO083342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 5fbfe9517b4d - main - linuxkpi: Define `seq_has_overflowed()` and `single_open_size()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fbfe9517b4dab41a95e91b3fd8e73310c9eaa8b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=5fbfe9517b4dab41a95e91b3fd8e73310c9eaa8b commit 5fbfe9517b4dab41a95e91b3fd8e73310c9eaa8b Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:53:36 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:36 +0000 linuxkpi: Define `seq_has_overflowed()` and `single_open_size()` This required non-trivial changes to `linux_seq_file.c` to manage a new `(struct seq_file)->size` field. This field is read directly by DRM drivers, so we can't alias it to a call to sbuf_len(9). `single_open_size()` also depended on the ability to allocate the sbuf with a specified size instead of relying on `sbuf_new_auto()`. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39056 --- .../linuxkpi/common/include/linux/seq_file.h | 8 +- sys/compat/linuxkpi/common/src/linux_seq_file.c | 89 +++++++++++++++++++--- 2 files changed, 85 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/seq_file.h b/sys/compat/linuxkpi/common/include/linux/seq_file.h index 8fb93646f9a5..d18d3cd906ab 100644 --- a/sys/compat/linuxkpi/common/include/linux/seq_file.h +++ b/sys/compat/linuxkpi/common/include/linux/seq_file.h @@ -54,6 +54,7 @@ static const struct file_operations __name ## _fops = { \ struct seq_file { struct sbuf *buf; + size_t size; const struct seq_operations *op; const struct linux_file *file; void *private; @@ -68,6 +69,9 @@ struct seq_operations { ssize_t seq_read(struct linux_file *, char *, size_t, off_t *); int seq_write(struct seq_file *seq, const void *data, size_t len); +void seq_putc(struct seq_file *m, char c); +void seq_puts(struct seq_file *m, const char *str); +bool seq_has_overflowed(struct seq_file *m); void *__seq_open_private(struct linux_file *, const struct seq_operations *, int); int seq_release_private(struct inode *, struct linux_file *); @@ -77,6 +81,7 @@ int seq_release(struct inode *inode, struct linux_file *file); off_t seq_lseek(struct linux_file *file, off_t offset, int whence); int single_open(struct linux_file *, int (*)(struct seq_file *, void *), void *); +int single_open_size(struct linux_file *, int (*)(struct seq_file *, void *), void *, size_t); int single_release(struct inode *, struct linux_file *); void lkpi_seq_vprintf(struct seq_file *m, const char *fmt, va_list args); @@ -85,9 +90,6 @@ void lkpi_seq_printf(struct seq_file *m, const char *fmt, ...); #define seq_vprintf(...) lkpi_seq_vprintf(__VA_ARGS__) #define seq_printf(...) lkpi_seq_printf(__VA_ARGS__) -#define seq_puts(m, str) sbuf_printf((m)->buf, str) -#define seq_putc(m, str) sbuf_putc((m)->buf, str) - #define file linux_file #endif /* _LINUXKPI_LINUX_SEQ_FILE_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c index d4d8ef059ac4..80b13a3ac28f 100644 --- a/sys/compat/linuxkpi/common/src/linux_seq_file.c +++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c @@ -79,8 +79,33 @@ seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos) int seq_write(struct seq_file *seq, const void *data, size_t len) { + int ret; - return (sbuf_bcpy(seq->buf, data, len)); + ret = sbuf_bcpy(seq->buf, data, len); + if (ret == 0) + seq->size = sbuf_len(seq->buf); + + return (ret); +} + +void +seq_putc(struct seq_file *seq, char c) +{ + int ret; + + ret = sbuf_putc(seq->buf, c); + if (ret == 0) + seq->size = sbuf_len(seq->buf); +} + +void +seq_puts(struct seq_file *seq, const char *str) +{ + int ret; + + ret = sbuf_printf(seq->buf, "%s", str); + if (ret == 0) + seq->size = sbuf_len(seq->buf); } /* @@ -115,21 +140,32 @@ single_stop(struct seq_file *p, void *v) { } -int -seq_open(struct linux_file *f, const struct seq_operations *op) +static int +_seq_open_without_sbuf(struct linux_file *f, const struct seq_operations *op) { struct seq_file *p; if ((p = malloc(sizeof(*p), M_LSEQ, M_NOWAIT|M_ZERO)) == NULL) return (-ENOMEM); - p->buf = sbuf_new_auto(); p->file = f; p->op = op; f->private_data = (void *) p; return (0); } +int +seq_open(struct linux_file *f, const struct seq_operations *op) +{ + int ret; + + ret = _seq_open_without_sbuf(f, op); + if (ret == 0) + ((struct seq_file *)f->private_data)->buf = sbuf_new_auto(); + + return (ret); +} + void * __seq_open_private(struct linux_file *f, const struct seq_operations *op, int size) { @@ -153,8 +189,8 @@ __seq_open_private(struct linux_file *f, const struct seq_operations *op, int si return (private); } -int -single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d) +static int +_single_open_without_sbuf(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d) { struct seq_operations *op; int rc = -ENOMEM; @@ -165,7 +201,7 @@ single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void * op->next = single_next; op->stop = single_stop; op->show = show; - rc = seq_open(f, op); + rc = _seq_open_without_sbuf(f, op); if (rc) free(op, M_LSEQ); else @@ -174,6 +210,31 @@ single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void * return (rc); } +int +single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d) +{ + int ret; + + ret = _single_open_without_sbuf(f, show, d); + if (ret == 0) + ((struct seq_file *)f->private_data)->buf = sbuf_new_auto(); + + return (ret); +} + +int +single_open_size(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d, size_t size) +{ + int ret; + + ret = _single_open_without_sbuf(f, show, d); + if (ret == 0) + ((struct seq_file *)f->private_data)->buf = sbuf_new( + NULL, NULL, size, SBUF_AUTOEXTEND); + + return (ret); +} + int seq_release(struct inode *inode __unused, struct linux_file *file) { @@ -219,7 +280,11 @@ single_release(struct vnode *v, struct linux_file *f) void lkpi_seq_vprintf(struct seq_file *m, const char *fmt, va_list args) { - sbuf_vprintf(m->buf, fmt, args); + int ret; + + ret = sbuf_vprintf(m->buf, fmt, args); + if (ret == 0) + m->size = sbuf_len(m->buf); } void @@ -228,6 +293,12 @@ lkpi_seq_printf(struct seq_file *m, const char *fmt, ...) va_list args; va_start(args, fmt); - seq_vprintf(m, fmt, args); + lkpi_seq_vprintf(m, fmt, args); va_end(args); } + +bool +seq_has_overflowed(struct seq_file *m) +{ + return (sbuf_len(m->buf) == -1); +} From nobody Mon Mar 20 20:47:53 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdP3mdVz40DvQ; Mon, 20 Mar 2023 20: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 4PgRdP1xqgz3kg0; Mon, 20 Mar 2023 20:47:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yCPFO/VKdCQRRU7ZRfMna44fKSFwlS47a2WSgmWRbNs=; b=rXySzQPqPjdSfJ90OQHTqdkX4GfqI1hrt0mBGv+o59f33s4S/FFPp3IZkzTSr551vT2NsJ +libYDRy5h/2s3lOclq3HM+BI2pwR5COOSX3HcevdMVWv8Mvpu0X1kzuyt8rDof+oaO9km BmZoFJDAMeOPPIEWxgh2HRG8iNTl0gWhTKDohJDBna3X8nhfOq+fjWj4Qsme4OEQT7LuM1 YQ0F7KfZtWnNLiHmVnkE71w0urEuk9D5NDO1w4JDeedVFeLLDLUChNQbCDAOAr/QV5Fxsp 2SGhPmtZgWpQxoIVDiHF0/4Fe2f7Da5oyCE8Sl9ntqvAqTocB5bKOVolP7ukuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yCPFO/VKdCQRRU7ZRfMna44fKSFwlS47a2WSgmWRbNs=; b=IH+huZg6E0k65NdP1cwECnB3Foqaup/n0hQb8+7Tl5c5/Y3Okn73j6cZeQsA5H3hfXyaHb zbWyuQjNFaIMB8/q6nMv4HTIgopNw30qeuhybGI80qA4rG/dY5BehytndW/JXAUHLiC+Id tm5tf7hLGTbG3XiIfGflg7FbZVMGLyHXzjJjeTi4pUJDZWiFz0nuJuGssqn53i2GjQBojj Ln7QgUUeOa0oC6Mg6L7US/zxqlu5v6UzIl2GjMdvuYyRSo4CGJzZahW/mJB/FjzlxSxIjY H5Y416xWEv+bYIaklgRas01mP+nt1KJQkOriSbwx/2mTMvy6+cGvcVPsBBQSAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345273; a=rsa-sha256; cv=none; b=fHkyDLKs9M3eJUCgWDUitZkDoU73vSbbgXMCRJk/VxL4DwVT0dfa1BWUL243dwEY//xRPH 62AbCD4cY7xij/RyD6GuT++que47TmqVKbxkG+dH/vIRh/3c51Nzfpdks94hAQvwE7H+3W Yfn2BAtlG0eIvkMOPciOZWgapLXbJc6kboCMj/qRU02zyOJt0vuStLWZR/UdnD2Olz6XZi Yv+bcMRM/h9vIFb2k74Y2J/J+KjZykN2lZdlTxBPYkpr3RMT+F4ROGffn9X452vTAmSyeD 4xog+eFF5r0GOWhV+FXLEnMf9FHfzNs1A2G1+0wmkEOvhjoHb7n2kBVSoz7Dxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdP11QzzlG5; Mon, 20 Mar 2023 20: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 32KKlrlK083374; Mon, 20 Mar 2023 20: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 32KKlrbx083372; Mon, 20 Mar 2023 20:47:53 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:53 GMT Message-Id: <202303202047.32KKlrbx083372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: d780c6a6abb5 - main - x86/pci_early_quirks: Support Intel 11th+ gen List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d780c6a6abb5275c8c7219539553d51ac94a023e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=d780c6a6abb5275c8c7219539553d51ac94a023e commit d780c6a6abb5275c8c7219539553d51ac94a023e Author: Jean-Sébastien Pédron AuthorDate: 2023-03-13 14:28:22 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:36 +0000 x86/pci_early_quirks: Support Intel 11th+ gen Newer Intel CPUs/iGPUs use a new method to determine the base address of the stolen memory. This code was ported from Linux. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39057 --- sys/x86/pci/pci_early_quirks.c | 26 ++++++++++++ sys/x86/pci/pci_early_quirks.h | 95 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/sys/x86/pci/pci_early_quirks.c b/sys/x86/pci/pci_early_quirks.c index 29788cdd19d4..b9de1d78e022 100644 --- a/sys/x86/pci/pci_early_quirks.c +++ b/sys/x86/pci/pci_early_quirks.c @@ -71,6 +71,19 @@ intel_stolen_base_gen3(int bus, int slot, int func) return (val); } +static vm_paddr_t +intel_stolen_base_gen11(int bus, int slot, int func) +{ + uint32_t ctrl; + vm_paddr_t val; + + ctrl = pci_cfgregread(bus, slot, func, INTEL_GEN11_BSM_DW0, 4); + val = ctrl & INTEL_BSM_MASK; + val |= (uint64_t)pci_cfgregread( + bus, slot, func, INTEL_GEN11_BSM_DW1, 4) << 32; + return (val); +} + static vm_paddr_t intel_stolen_size_gen3(int bus, int slot, int func) { @@ -201,6 +214,11 @@ static const struct intel_stolen_ops intel_stolen_ops_chv = { .size = intel_stolen_size_chv, }; +static const struct intel_stolen_ops intel_stolen_ops_gen11 = { + .base = intel_stolen_base_gen11, + .size = intel_stolen_size_gen9, +}; + static const struct pci_device_id intel_ids[] = { INTEL_I915G_IDS(&intel_stolen_ops_gen3), INTEL_I915GM_IDS(&intel_stolen_ops_gen3), @@ -228,6 +246,14 @@ static const struct pci_device_id intel_ids[] = { INTEL_CFL_IDS(&intel_stolen_ops_gen9), INTEL_GLK_IDS(&intel_stolen_ops_gen9), INTEL_CNL_IDS(&intel_stolen_ops_gen9), + INTEL_ICL_11_IDS(&intel_stolen_ops_gen11), + INTEL_EHL_IDS(&intel_stolen_ops_gen11), + INTEL_JSL_IDS(&intel_stolen_ops_gen11), + INTEL_TGL_12_IDS(&intel_stolen_ops_gen11), + INTEL_RKL_IDS(&intel_stolen_ops_gen11), + INTEL_ADLS_IDS(&intel_stolen_ops_gen11), + INTEL_ADLP_IDS(&intel_stolen_ops_gen11), + INTEL_RPLS_IDS(&intel_stolen_ops_gen11), }; /* diff --git a/sys/x86/pci/pci_early_quirks.h b/sys/x86/pci/pci_early_quirks.h index fcb8e3ab1f1e..5267a5b3e303 100644 --- a/sys/x86/pci/pci_early_quirks.h +++ b/sys/x86/pci/pci_early_quirks.h @@ -39,6 +39,8 @@ #define PCI_CLASS_VGA 0x0300 #define INTEL_BSM 0x5c +#define INTEL_GEN11_BSM_DW0 0xc0 +#define INTEL_GEN11_BSM_DW1 0xc4 #define INTEL_BSM_MASK (-(1u << 20)) #define INTEL_GMCH_CTRL 0x52 @@ -477,4 +479,97 @@ INTEL_VGA_DEVICE(0x8A71, info), \ INTEL_VGA_DEVICE(0x8A70, info) +/* EHL */ +#define INTEL_EHL_IDS(info) \ + INTEL_VGA_DEVICE(0x4541, info), \ + INTEL_VGA_DEVICE(0x4551, info), \ + INTEL_VGA_DEVICE(0x4555, info), \ + INTEL_VGA_DEVICE(0x4557, info), \ + INTEL_VGA_DEVICE(0x4571, info) + +/* JSL */ +#define INTEL_JSL_IDS(info) \ + INTEL_VGA_DEVICE(0x4E51, info), \ + INTEL_VGA_DEVICE(0x4E55, info), \ + INTEL_VGA_DEVICE(0x4E57, info), \ + INTEL_VGA_DEVICE(0x4E61, info), \ + INTEL_VGA_DEVICE(0x4E71, info) + +/* TGL */ +#define INTEL_TGL_12_GT1_IDS(info) \ + INTEL_VGA_DEVICE(0x9A60, info), \ + INTEL_VGA_DEVICE(0x9A68, info), \ + INTEL_VGA_DEVICE(0x9A70, info) + +#define INTEL_TGL_12_GT2_IDS(info) \ + INTEL_VGA_DEVICE(0x9A40, info), \ + INTEL_VGA_DEVICE(0x9A49, info), \ + INTEL_VGA_DEVICE(0x9A59, info), \ + INTEL_VGA_DEVICE(0x9A78, info), \ + INTEL_VGA_DEVICE(0x9AC0, info), \ + INTEL_VGA_DEVICE(0x9AC9, info), \ + INTEL_VGA_DEVICE(0x9AD9, info), \ + INTEL_VGA_DEVICE(0x9AF8, info) + +#define INTEL_TGL_12_IDS(info) \ + INTEL_TGL_12_GT1_IDS(info), \ + INTEL_TGL_12_GT2_IDS(info) + +/* RKL */ +#define INTEL_RKL_IDS(info) \ + INTEL_VGA_DEVICE(0x4C80, info), \ + INTEL_VGA_DEVICE(0x4C8A, info), \ + INTEL_VGA_DEVICE(0x4C8B, info), \ + INTEL_VGA_DEVICE(0x4C8C, info), \ + INTEL_VGA_DEVICE(0x4C90, info), \ + INTEL_VGA_DEVICE(0x4C9A, info) + +/* DG1 */ +#define INTEL_DG1_IDS(info) \ + INTEL_VGA_DEVICE(0x4905, info), \ + INTEL_VGA_DEVICE(0x4906, info), \ + INTEL_VGA_DEVICE(0x4907, info), \ + INTEL_VGA_DEVICE(0x4908, info), \ + INTEL_VGA_DEVICE(0x4909, info) + +/* ADL-S */ +#define INTEL_ADLS_IDS(info) \ + INTEL_VGA_DEVICE(0x4680, info), \ + INTEL_VGA_DEVICE(0x4682, info), \ + INTEL_VGA_DEVICE(0x4688, info), \ + INTEL_VGA_DEVICE(0x468A, info), \ + INTEL_VGA_DEVICE(0x4690, info), \ + INTEL_VGA_DEVICE(0x4692, info), \ + INTEL_VGA_DEVICE(0x4693, info) + +/* ADL-P */ +#define INTEL_ADLP_IDS(info) \ + INTEL_VGA_DEVICE(0x46A0, info), \ + INTEL_VGA_DEVICE(0x46A1, info), \ + INTEL_VGA_DEVICE(0x46A2, info), \ + INTEL_VGA_DEVICE(0x46A3, info), \ + INTEL_VGA_DEVICE(0x46A6, info), \ + INTEL_VGA_DEVICE(0x46A8, info), \ + INTEL_VGA_DEVICE(0x46AA, info), \ + INTEL_VGA_DEVICE(0x462A, info), \ + INTEL_VGA_DEVICE(0x4626, info), \ + INTEL_VGA_DEVICE(0x4628, info), \ + INTEL_VGA_DEVICE(0x46B0, info), \ + INTEL_VGA_DEVICE(0x46B1, info), \ + INTEL_VGA_DEVICE(0x46B2, info), \ + INTEL_VGA_DEVICE(0x46B3, info), \ + INTEL_VGA_DEVICE(0x46C0, info), \ + INTEL_VGA_DEVICE(0x46C1, info), \ + INTEL_VGA_DEVICE(0x46C2, info), \ + INTEL_VGA_DEVICE(0x46C3, info) + +/* RPL-S */ +#define INTEL_RPLS_IDS(info) \ + INTEL_VGA_DEVICE(0xA780, info), \ + INTEL_VGA_DEVICE(0xA781, info), \ + INTEL_VGA_DEVICE(0xA782, info), \ + INTEL_VGA_DEVICE(0xA783, info), \ + INTEL_VGA_DEVICE(0xA788, info), \ + INTEL_VGA_DEVICE(0xA789, info) + #endif /* _PCI_EARLY_QUIRKS_H_ */ From nobody Mon Mar 20 22:17:17 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgTcY5RnRz40Lgt; Mon, 20 Mar 2023 22:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgTcY50wxz3wls; Mon, 20 Mar 2023 22:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679350637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OEt3w+I3H4bl8BSYGG0XC0A5C+pUMgKuaN6Jxv07DG0=; b=kZlbEFodZqLgu4RHvAEgRNpXCY3ouqMueywValySPUiY1oJtdnOFxmp6q6bwCT/Gf++bbZ r2vn69Oyn0oissFK5sGGfuPYINJgOf8vxB95DTQPIkmpUpHUUMrEVVvYpgUxMluRyxfMlx rlaawi5FIv2Kx1D+Pe7bDz6YT2n2+uESTu9In3h4oCcRWyeH5YWzOTakI3SxNir6KUfb95 6BtLqUPFeSGYr7+ENlLW8x4XRnqXP3dVHT7/5lZpth7OvOGAjUWBQ8ybrqWvDfUGrXr2wT 8EpPmEOmJNMbAoeGGnvlgevO9kPTtKjm7VBlCRUM+EQBimAa039Wq2Sees31Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679350637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OEt3w+I3H4bl8BSYGG0XC0A5C+pUMgKuaN6Jxv07DG0=; b=Hlnexrq+UotCzsm5Fw1koJXLtd5s6D162TgoSsUMJKEzTuX6+w4EQQ3S0qMfVPDei5Ku0Z FA+OChSAfLSs5nwjlZKkI8HhHGBV9Dwpd6e0kU0KZ6SydW27TXpZgi72V7/lu6nr2l5zNZ 7RrAixfdgHNSu98dnf6JQleD/VqH/P6HFs5+/hK78sw0dcLIZgKN5zJ1/G5dBEJ+JUBz6H nwtd94x6Ab2d996nDK9ifqGdazZjyVeUVCRywusVxih8t1gpET+iQloBQ5qOpb7CoE0xGv vFZU1XMFdp8yRAuWJi+VL7vQD44JR/VBTSVwCax8TXiaWR/sJ914QnpjReSh3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679350637; a=rsa-sha256; cv=none; b=sdjH2h2f/Y8NUckAnmT3iYB1Hk6sXIyExTnwNXwlR5NUKk6Ka2XVmUuDv4DEDEC9rxgVip aLGl9Po7KTIY1qh/urgUV5pHWQ/ORe1ndokfoIu3Rc7HLKKxH0ZfQiFuxOWjT8q33RLOO7 a9IF3TBWPX1bNUdd5HoNEQ1jx8yOzZhtScTESCTfUQthn5uil4CgvQHkE74X6CFnZjlxjT mvtNJRY0v6qCGLjfCqfXccu+NjOH+m1VPQxVJVeaA62kAhbDUqLTrtlJMb5eOhCSwbXqbL XqaHQUji8meetvbgXUL+TO9Xss0E4WnSWwKZ2wwwsq2OkZ1GSagUrC3VHDq7MA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgTcY44YpznSP; Mon, 20 Mar 2023 22:17: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 32KMHHoK031286; Mon, 20 Mar 2023 22:17:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KMHHo6031285; Mon, 20 Mar 2023 22:17:17 GMT (envelope-from git) Date: Mon, 20 Mar 2023 22:17:17 GMT Message-Id: <202303202217.32KMHHo6031285@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: 9432e798fc6d - main - mountd.8: Update for mountd running in jails List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9432e798fc6daaad341a496e9abcf9e3b760a63b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9432e798fc6daaad341a496e9abcf9e3b760a63b commit 9432e798fc6daaad341a496e9abcf9e3b760a63b Author: Rick Macklem AuthorDate: 2023-03-20 22:16:03 +0000 Commit: Rick Macklem CommitDate: 2023-03-20 22:16:03 +0000 mountd.8: Update for mountd running in jails Mountd can now be run in an appropriately configured vnet jail. This man page update adds some information for this case. This is a content change. Reviewed by: markj MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D39168 --- usr.sbin/mountd/mountd.8 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mountd/mountd.8 b/usr.sbin/mountd/mountd.8 index 128b305cb5d9..207b50e3501d 100644 --- a/usr.sbin/mountd/mountd.8 +++ b/usr.sbin/mountd/mountd.8 @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 11, 2020 +.Dd March 18, 2023 .Dt MOUNTD 8 .Os .Sh NAME @@ -158,7 +158,7 @@ When is started, it loads the export host addresses and options into the kernel using the -.Xr mount 2 +.Xr nmount 2 system call. After changing the exports file, a hangup signal should be sent to the @@ -172,6 +172,20 @@ check the syslog output to see if logged any parsing errors in the exports file. .Pp +If multiple instances of +.Nm +are being run, either in multiple jails or both within +and outside of a jail, care must be taken to export +any given file system in only one of the instances. +Note that the +.Va allow.nfsd +jail parameter is required to allow +.Nm +to run in a jail. +See +.Xr jail 8 +for more information. +.Pp If .Nm detects that the running kernel does not include @@ -185,6 +199,15 @@ If this fails, or no KLD was available, .Nm exits with an error. +When run in a jail, the +.Xr kldload 2 +must be done outside the jail, typically by adding +.Dq nfsd +to +.Va kld_list +in the +.Xr rc.conf 5 +file on the jail host. .Sh FILES .Bl -tag -width /var/run/mountd.pid -compact .It Pa /etc/exports @@ -199,6 +222,8 @@ the current list of remote mounted file systems .Xr kldload 2 , .Xr nfsv4 4 , .Xr exports 5 , +.Xr rc.conf 5 , +.Xr jail 8 , .Xr nfsd 8 , .Xr rpcbind 8 , .Xr showmount 8 From nobody Tue Mar 21 04:45:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgfDv1TBwz40lRP; Tue, 21 Mar 2023 04:45: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 4PgfDt6zSCz3GsP; Tue, 21 Mar 2023 04:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679373951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BSIsd6c16QfaOkFdF23DnpfZC5w131ydCcXA3U+1ktI=; b=TZJl1WfluHgSaMSw5OJvdEfDSTqPbeaUrfrlFCv5VF7s4CSEBGuAU/BouldDpwvTbCg/Hi Vi3zr67DrDm/9DnuCnIoRont2DMJF9S3zKfxcvpX4uUySATvi/NtKPyYWmEYzFsldufrJK zewDhUrIkkusSyM5wMuAGRs46XHOH8AiKsr6Z3DLdRqKaMvoAQc6IhkGU15a7UYH6JOsZV Y0VAo5VP7u7N32JW6otauf/C3aMl0dTT0you1Jd9qMsCGx8bw28PVVvBTmEqFklQlEtKMn Rgc0c3T5v8sf0fN9WhUoqzf/VpeB1B0FbSmIwvSqd3Kq1VeA14jlNA/Zs7Mfqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679373951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BSIsd6c16QfaOkFdF23DnpfZC5w131ydCcXA3U+1ktI=; b=FDkIzh8/dmtkG//MDAyXFVnVguDtr1c/IcKBhczpqMLu7i0K2FBQOdBTp62eDKE7oBfOdF pyBk7J/NuJfD3YckFSNMKkdVDfLLGyecP57eKTju/Z+7l3pXIWC/AZgs5NrF7ZyPovQfIy AFnM+UkOFNnt4Mn/z+4ytHjSIuhR0B4jbEKmsPf3bMAS0AQZcYQnoHwAbA6mv1FqCjZm5L 3p1SMKZMbySiwH8V6EVvw3Hsa7rBajB6YUJ0nYNx2houahchXW3XCedeQfkw1TQFRNcOFq 6Et/G2j+crVxAMp6TGodeY9kxNJ7udi5/dC712H+V52LmEA5lvles6TxBbW05Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679373951; a=rsa-sha256; cv=none; b=rczNBMDPyUcYtwxazbQqd8UfqWfjo5w+EpiX1Os5JcyOdvr6gKHniGcC+UzmIo6Q4gGN+V YJpr6SVVo6Y+tvarJGQ9pGPwKSC9CL/JlsR815NZ937cXqT7/3RnZ++gI2npmN2DjN2g3F rWiAZfNGetpdqiQRfRVhoeY8L82O2tRZiFXeS1APNuIbxZZuEAveCfMRduM30oMUsfqFq+ y22fqTu7enlH2aJkoyPaXPRxab+H31oV0MPBlecTGUB089ZtZZ4Z7IZ9F4TTub3gn6aIjZ l+vPpiBDCJd/On+o+m/c25vRWH2kGflY6f++q9w/JuLpvJQeMZvgkumCaie3iw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgfDt5tx0zyTk; Tue, 21 Mar 2023 04:45: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 32L4joOB071130; Tue, 21 Mar 2023 04:45:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32L4joqG071129; Tue, 21 Mar 2023 04:45:50 GMT (envelope-from git) Date: Tue, 21 Mar 2023 04:45:50 GMT Message-Id: <202303210445.32L4joqG071129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 535946ce1145 - main - if_re: Drop redundant assignments for ifq_maxlen and ifq_drv_maxlen List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 535946ce1145309e8445fd7a56667cd08d33f7a0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=535946ce1145309e8445fd7a56667cd08d33f7a0 commit 535946ce1145309e8445fd7a56667cd08d33f7a0 Author: Zhenlei Huang AuthorDate: 2023-03-21 04:29:24 +0000 Commit: Zhenlei Huang CommitDate: 2023-03-21 04:29:24 +0000 if_re: Drop redundant assignments for ifq_maxlen and ifq_drv_maxlen Fixes: 4519a073c326b Mechanically convert if_re(4) to DrvAPI --- sys/dev/re/if_re.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 734760898e55..11708293acd5 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1653,7 +1653,6 @@ re_attach(device_t dev) if_setcapenable(ifp, if_getcapabilities(ifp)); if_setinitfn(ifp, re_init); if_setsendqlen(ifp, RL_IFQ_MAXLEN); - if_setsendqlen(ifp, RL_IFQ_MAXLEN); if_setsendqready(ifp); NET_TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc); From nobody Tue Mar 21 05:14:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgfsN4MWMz40msw; Tue, 21 Mar 2023 05:14: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 4PgfsN2cDyz3Kxv; Tue, 21 Mar 2023 05:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679375640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rDW3sZQOM9DLR5DwtRTHiW3+1ZXn++czw0IfgVk3go8=; b=ZFyH3AblQ1yh0/L+OGCrT4zZQ7zvHoCEeb4pRJ4jEFXCjF7OVzV0FvQju5JA1qcnWoddtk /Nmtfwbp4dUdS0nJ5fDdjOJSrJI/i9Mvy2KFy7fVYBfyMgZs6d3dumWvGua4ou3C7YPzwY BISDiLxfifSsPjgIvR5Wpqkmam0x27XcL+hj0RzF6Rq70aCEBvn1FUn2HMMyOSNIUK5hG/ TuoUVINA1CoT4NPJRx/Q8iWB7UZxulHdJcPwPcY+zMdaFt03DzTb3k97ooqVyMb5VjnGrE 2a8c/YTU8AzW9NUly2FGa3kuRDzxb5dxVad/qYnrHabQFXH/uZchUnv0UP9RbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679375640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rDW3sZQOM9DLR5DwtRTHiW3+1ZXn++czw0IfgVk3go8=; b=EEcx1itJ6dD8gg9zRHFOsICcJLUe7cqaOaa+gAq7+snlxlTwGH+I9xmOI1uvBaJK2DPLOf od0euTYqZJjKpDB7776Qv4kdId2ot6TOe6POSXWONCCQygFcL3IFKx46z95JvjLEAN4tCG d+AVorvAJyVM/7QgOyYzNVRuLU/tp5KZUHYqV8IWFMAR4Vd+/+8oDBgwKRmctRnIWpqdnz 8YLJ/M55bayieeNAOiLPLAubE7RuLQqvps2i2zU5NgLz/vgvdPUCVB5g/pNRH8UG5Kl5VL kllLsdTLlb6hrS8wIIdGrNpC0Ijih2jraFR2+BJj+lzIYGdvdXRDEit0nbavhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679375640; a=rsa-sha256; cv=none; b=NW1kJKhWR3MZV/Aj82Hm3nusYOjgo4wLI4342iVUPA5bid3Hex9l3CIaSCAMM1V/rAVYax pCQvHP/xuoleTzEhC7bOwrRp1Q0ZdF1XEJ6XBR54SoKC0dJ4QQs7wi2kklx0w8X3ZICgXA RtLR21rEHpQHnagH8eoEXduK3gpHAvvfg5bZT7kOMJxYxRALfQYx/JP25XQOd83tt9zH6E 16Ab6FkJpwZKRKqsZNy1POQYkk8skQBy5n7TUwzH8+9L+dVH1Tus+xocpDCciXYBi9w4n1 aT5aT5mBiDvbcJevaqzZiwqex98tN8xS6n8YSTb8mB4ueG/WF6R1XjbODyChgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgfsN1j7sz10SD; Tue, 21 Mar 2023 05:14: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 32L5E0TZ021121; Tue, 21 Mar 2023 05:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32L5E0Ze021120; Tue, 21 Mar 2023 05:14:00 GMT (envelope-from git) Date: Tue, 21 Mar 2023 05:14:00 GMT Message-Id: <202303210514.32L5E0Ze021120@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: 9ee1faeebab5 - main - daemon: move signal setup into a function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ee1faeebab594712ed302ea51949410c9744920 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9ee1faeebab594712ed302ea51949410c9744920 commit 9ee1faeebab594712ed302ea51949410c9744920 Author: Ihor Antonov AuthorDate: 2023-03-21 04:40:04 +0000 Commit: Kyle Evans CommitDate: 2023-03-21 04:40:04 +0000 daemon: move signal setup into a function No functional change intended. Reviewed by: kevans --- usr.sbin/daemon/daemon.c | 142 ++++++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 54e2aeea6874..983dbdc7ed8c 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -83,6 +83,7 @@ struct daemon_state { bool log_reopen; }; +static void setup_signals(struct daemon_state *); static void restrict_process(const char *); static void handle_term(int); static void handle_chld(int); @@ -168,10 +169,40 @@ main(int argc, char *argv[]) sigset_t mask_susp; daemon_state_init(&state); + + /* + * Signal handling logic: + * + * - SIGTERM is masked while there is no child. + * + * - SIGCHLD is masked while reading from the pipe. SIGTERM has to be + * caught, to avoid indefinite blocking on read(). + * + * - Both SIGCHLD and SIGTERM are masked before calling sigsuspend() + * to avoid racing. + * + * - After SIGTERM is recieved and propagated to the child there are + * several options on what to do next: + * - read until EOF + * - read until EOF but only for a while + * - bail immediately + * Currently the third option is used, because otherwise there is no + * guarantee that read() won't block indefinitely if the child refuses + * to depart. To handle the second option, a different approach + * would be needed (procctl()?). + * + * - Child's exit might be detected by receiveing EOF from the pipe. + * But the child might have closed its stdout and stderr, so deamon + * must wait for the SIGCHLD to ensure that the child is actually gone. + */ sigemptyset(&mask_susp); sigemptyset(&mask_read); sigemptyset(&mask_term); sigemptyset(&mask_orig); + sigaddset(&mask_susp, SIGTERM); + sigaddset(&mask_susp, SIGCHLD); + sigaddset(&mask_term, SIGTERM); + sigaddset(&mask_read, SIGCHLD); /* * Supervision mode is enabled if one of the following options are used: @@ -312,57 +343,20 @@ main(int argc, char *argv[]) pidfile_write(state.parent_pidfh); if (state.supervision_enabled) { - struct sigaction act_term = { 0 }; - struct sigaction act_chld = { 0 }; - struct sigaction act_hup = { 0 }; - - /* Avoid PID racing with SIGCHLD and SIGTERM. */ - act_term.sa_handler = handle_term; - sigemptyset(&act_term.sa_mask); - sigaddset(&act_term.sa_mask, SIGCHLD); - - act_chld.sa_handler = handle_chld; - sigemptyset(&act_chld.sa_mask); - sigaddset(&act_chld.sa_mask, SIGTERM); - - act_hup.sa_handler = handle_hup; - sigemptyset(&act_hup.sa_mask); - - /* Block these when avoiding racing before sigsuspend(). */ - sigaddset(&mask_susp, SIGTERM); - sigaddset(&mask_susp, SIGCHLD); - /* Block SIGTERM when we lack a valid child PID. */ - sigaddset(&mask_term, SIGTERM); - /* - * When reading, we wish to avoid SIGCHLD. SIGTERM - * has to be caught, otherwise we'll be stuck until - * the read() returns - if it returns. - */ - sigaddset(&mask_read, SIGCHLD); /* Block SIGTERM to avoid racing until we have forked. */ if (sigprocmask(SIG_BLOCK, &mask_term, &mask_orig)) { warn("sigprocmask"); daemon_terminate(&state); } - if (sigaction(SIGTERM, &act_term, NULL) == -1) { - warn("sigaction"); - daemon_terminate(&state); - } - if (sigaction(SIGCHLD, &act_chld, NULL) == -1) { - warn("sigaction"); - daemon_terminate(&state); - } + + setup_signals(&state); + /* * Try to protect against pageout kill. Ignore the * error, madvise(2) will fail only if a process does * not have superuser privileges. */ (void)madvise(NULL, 0, MADV_PROTECT); - if (state.log_reopen && state.output_fd >= 0 && - sigaction(SIGHUP, &act_hup, NULL) == -1) { - warn("sigaction"); - daemon_terminate(&state); - } restart: if (pipe(state.pipe_fd)) { err(1, "pipe"); @@ -419,9 +413,9 @@ restart: /* * else: pid > 0 * fork succeeded, this is the parent branch, this can only happen when - * supervision is enabled + * supervision is enabled. * - * Unblock SIGTERM after we know we have a valid child PID to signal. + * Unblock SIGTERM - now there is a valid child PID to signal to. */ if (sigprocmask(SIG_UNBLOCK, &mask_term, NULL)) { warn("sigprocmask"); @@ -431,28 +425,7 @@ restart: state.pipe_fd[1] = -1; setproctitle("%s[%d]", state.title, (int)pid); - /* - * As we have closed the write end of pipe for parent process, - * we might detect the child's exit by reading EOF. The child - * might have closed its stdout and stderr, so we must wait for - * the SIGCHLD to ensure that the process is actually gone. - */ for (;;) { - /* - * We block SIGCHLD when listening, but SIGTERM we accept - * so the read() won't block if we wish to depart. - * - * Upon receiving SIGTERM, we have several options after - * sending the SIGTERM to our child: - * - read until EOF - * - read until EOF but only for a while - * - bail immediately - * - * We go for the third, as otherwise we have no guarantee - * that we won't block indefinitely if the child refuses - * to depart. To handle the second option, a different - * approach would be needed (procctl()?) - */ if (child_gone && state.child_eof) { break; } @@ -516,6 +489,49 @@ daemon_sleep(time_t secs, long nsecs) } } +/* + * Setup SIGTERM, SIGCHLD and SIGHUP handlers. + * To avoid racing SIGCHLD with SIGTERM corresponding + * signal handlers mask the other signal. + */ +static void +setup_signals(struct daemon_state *state) +{ + struct sigaction act_term = { 0 }; + struct sigaction act_chld = { 0 }; + struct sigaction act_hup = { 0 }; + + /* Setup SIGTERM */ + act_term.sa_handler = handle_term; + sigemptyset(&act_term.sa_mask); + sigaddset(&act_term.sa_mask, SIGCHLD); + if (sigaction(SIGTERM, &act_term, NULL) == -1) { + warn("sigaction"); + daemon_terminate(state); + } + + /* Setup SIGCHLD */ + act_chld.sa_handler = handle_chld; + sigemptyset(&act_chld.sa_mask); + sigaddset(&act_chld.sa_mask, SIGTERM); + if (sigaction(SIGCHLD, &act_chld, NULL) == -1) { + warn("sigaction"); + daemon_terminate(state); + } + + /* Setup SIGHUP if configured */ + if (!state->log_reopen || state->output_fd < 0) { + return; + } + + act_hup.sa_handler = handle_hup; + sigemptyset(&act_hup.sa_mask); + if (sigaction(SIGHUP, &act_hup, NULL) == -1) { + warn("sigaction"); + daemon_terminate(state); + } +} + static void open_pid_files(struct daemon_state *state) { From nobody Tue Mar 21 06:09:59 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pgh5z6zgFz40r8C; Tue, 21 Mar 2023 06:09:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pgh5z4jj4z3R0V; Tue, 21 Mar 2023 06:09:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679378999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xoj7rRPK4v1h5vAIkrvY2i5vgJC67oIrkYYXW1tKxJk=; b=EMz4LtuuFveCxhXJ27gx6MAg5ws7EsRpjf1MygZ54bTZXwFqgcOaZRTrzr+L+XjMcggplS XpwIeg/6/o/txSeuCvIr6kQnJ0KnOVODqKVSLj1zIyn7pODulAZL4KgCXJR/tCZahOG72o 3Wb0Px0d13FrJOzQODeAAXnrXEhdVBP8VfK1UF6X5A9b2P9KxStWMeaCx+rcHS7MBNYQvl KgfWLKZdyc3d+RuKwB2k7HB/HeDXYfuOYFjpOFhbezlbj5+17T/hPz70ffcckCD9A1Pag4 lxq5laBT2+Bwq7hUb6jITo2M66KmFQ2tGwDy1gY1hTemX+eCU15p+kJwO6WKPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679378999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xoj7rRPK4v1h5vAIkrvY2i5vgJC67oIrkYYXW1tKxJk=; b=evam7XZ+Qx4+MU5P+NGiH4TG/ryew2S5+7MSUzF6sRJt+CfpUIPgWBpi70MbOhde1ZfAQc zsPKxchnyniOC9bJrdmOlYQX+3Dfz4UArl6rfuDqj8RezV/pZJHaavpVfYWWFgsLzDM5e7 j76u9uM02SsU5hzO7tltiOq5Wu5RAmn+mWBOQa9mzi+YtV5zDNvI2IVXm4O+tEgyK6C7os E0zGbD0wZhZIHeVpo8Mphfjuf88TXRSrbX0xAbsXo0y2hTFE3qTd7X5Zi29D1NgRc9qrRK fHekPnTByctUVVCRMBeeRcwAIVyvc4QFo+2iCkcUHKPyLzO6Fj7ozxKNyAqenw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679378999; a=rsa-sha256; cv=none; b=d+3TSinnBiveu7ACvhtNE5Kvh8NttcO2/cw02AkWx7gSuzWR3jlXer0ht9J6TTNoxNijyj U64MO2iq9ZlOBbZJE67VdGzkDPc5FqCoVgyx9X+c6rnKedoZO00tuT5vRCKYQpwEu73EgQ KaYlPkSasW7W8hvVrRGvOvUBNrI1gJ9fFpYsk+aqd1e+arWPNARQQ1jP0AB7KIKUgeXjVM ZFHvK9YCrvM0a4demoXGjxT35RI/EwL5zmS2ZITk/+DZezM/ZGhHCRlbtzSJ0EOjWgAcx4 ssJPvmNJoCLfiOU0NDPtIP8seIIrCwHrnp9pBKfmd+k42Yh33HzMcu7wQp9Tig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pgh5z3pYjz11SY; Tue, 21 Mar 2023 06:09: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 32L69x3l003718; Tue, 21 Mar 2023 06:09:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32L69xRZ003717; Tue, 21 Mar 2023 06:09:59 GMT (envelope-from git) Date: Tue, 21 Mar 2023 06:09:59 GMT Message-Id: <202303210609.32L69xRZ003717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "David E. O'Brien" Subject: git: daa0b64a2260 - main - pmap_mapdev_attr() doesn't use any of its arguments. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: daa0b64a226031d5f753f96cd5a6fb3234cdd8b1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=daa0b64a226031d5f753f96cd5a6fb3234cdd8b1 commit daa0b64a226031d5f753f96cd5a6fb3234cdd8b1 Author: David E. O'Brien AuthorDate: 2023-03-21 06:05:29 +0000 Commit: David E. O'Brien CommitDate: 2023-03-21 06:09:34 +0000 pmap_mapdev_attr() doesn't use any of its arguments. --- sys/arm/include/pmap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h index 90b1cdb827af..b16651f789cc 100644 --- a/sys/arm/include/pmap.h +++ b/sys/arm/include/pmap.h @@ -50,7 +50,8 @@ void *pmap_mapdev(vm_paddr_t, vm_size_t); void pmap_unmapdev(void *, vm_size_t); static inline void * -pmap_mapdev_attr(vm_paddr_t addr, vm_size_t size, int attr) +pmap_mapdev_attr(vm_paddr_t addr __unused, vm_size_t size __unused, + int attr __unused) { panic("%s is not implemented yet!\n", __func__); } From nobody Tue Mar 21 14:00:44 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgtY85vkhz40Lh1; Tue, 21 Mar 2023 14:00: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 4PgtY85McJz3CkN; Tue, 21 Mar 2023 14:00:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZC7xgGp4icbRtfHDgkaobLhqiM63WM8w+/Ap5FUz8yg=; b=RP9x4KrJatil76IZZBngKkV9iQooge6jywrx9t9MSXFcfzBGFNz0bzl4saNaaWQZpRw3YH KRaqkyw9CTPjpqDpNYCPkq79q3lpgxcXtnL2+X4m2nEWnERvwnSlAZDzyG/mvnV5aeVLWj HJvL5CNBo0cKDSujuZJVsRuW0gb2VUWoah8BO+unPnbryEh2CFqI8iu/njOk1dkUZZVQnl M0g8qbhlWZZqHuuLKFyAkvYaoXBgugjHqtgWNr+MmBo+ckqo3RRoRx54yEv1T8N0iMmzJC 0A/i7OVUNtm1bMvt01rHqziPcezq4qHPIUeroaKhnzucZvWrPvyp+AUAq/q3Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZC7xgGp4icbRtfHDgkaobLhqiM63WM8w+/Ap5FUz8yg=; b=RlSf7prJ2g+nRjPEmPYJr1dhNeym8T8UF5xxRWDsaY5B8vnG12Ee8/04ur5pz5vHUC0UFI zWY0IcaBIU6SE20RR1jJkeKcYtII3HeFDHa/mdYp/j2+B85cN9IQeW8bXEgSX/VI3QTCxx 60ROEfVFrZfQsO7FV9qjnRwE6zUHN3jjKhzmJ8mas4JoNdYMY/MhUrIfmpVsBcFCN4Pob8 rbisMaAk0x+0sZYQnhtpUezr1wVskMzIkT8A/lEgaIXTp4LNXg6++Bo1ci1eutrcQipiAq lDgmIGV0UfYWE5UebB6Fa72b6Cwo9aKzT6G7zs4OLlGEFG3lqlWxmnHNFaaNkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679407244; a=rsa-sha256; cv=none; b=QR8Y1oClJIxo8lF4vrvbYamZuq1vi2IK5MiS1X+RcOKIwCPC+8rtn8rmGdg4OpNQycE0AS viR++Kx9CXkUYdXAFkQtIOfkOCw5Cj6qsHmfwqv/JtbQQ+Oap9elvQvaUIiYa6hVJzb1Co iEzBCZxr0q0+7SHVdYiC9sA0Jp8GDmW1+45wCDccdYjrPD19MnqWI/gM6NSqV6oNsSI7jI PD+hHChmXYyKqkTliSA/BcGryxSFNEWn2oCv8CbHdgtK50AGTlYUe1KSjWfYyiGgsQ6bDh zqvkt6U0YjVdgwhJLNEgH1e0ivUYfWfxqoLq+Q0NH2thtwwva0Sh6lgjnjJy4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgtY84SLszFCS; Tue, 21 Mar 2023 14:00: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 32LE0iDk087111; Tue, 21 Mar 2023 14:00:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LE0iJP087110; Tue, 21 Mar 2023 14:00:44 GMT (envelope-from git) Date: Tue, 21 Mar 2023 14:00:44 GMT Message-Id: <202303211400.32LE0iJP087110@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 379e14ba6c61 - main - powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 379e14ba6c61634cc1f50272b6f8f147758ec92f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=379e14ba6c61634cc1f50272b6f8f147758ec92f commit 379e14ba6c61634cc1f50272b6f8f147758ec92f Author: Justin Hibbits AuthorDate: 2023-03-21 13:18:18 +0000 Commit: Justin Hibbits CommitDate: 2023-03-21 13:56:26 +0000 powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache It's apparently possible for pcpu->pc_curpmap to be NULL at some point, leading to a panic. Account for this as is done with the other 64-bit AIM pmap. Reported by: pkubaj Tested by: pkubaj Fixes: 6f0b2a235a1 ("Add pmap_sync_icache() for radix pmap") MFC after: 3 days --- sys/powerpc/aim/mmu_radix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 1e7661ba8068..c95de527f554 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -5929,6 +5929,9 @@ mmu_radix_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) vm_paddr_t pa = 0; int sync_sz; + if (__predict_false(pm == NULL)) + pm = &curthread->td_proc->p_vmspace->vm_pmap; + while (sz > 0) { pa = pmap_extract(pm, va); sync_sz = PAGE_SIZE - (va & PAGE_MASK); From nobody Tue Mar 21 14:02:23 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgtbD4wShz40M4t; Tue, 21 Mar 2023 14:02:32 +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 4PgtbD2cm2z3Djr; Tue, 21 Mar 2023 14:02:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.17.1/8.17.1) with ESMTPS id 32LE2N60012231 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 21 Mar 2023 16:02:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 32LE2N60012231 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 32LE2Nsf012230; Tue, 21 Mar 2023 16:02:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Mar 2023 16:02:23 +0200 From: Konstantin Belousov To: =?utf-8?Q?Jean-S=C3=A9bastien_P=C3=A9dron?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d780c6a6abb5 - main - x86/pci_early_quirks: Support Intel 11th+ gen Message-ID: References: <202303202047.32KKlrbx083372@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202303202047.32KKlrbx083372@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4PgtbD2cm2z3Djr X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Mon, Mar 20, 2023 at 08:47:53PM +0000, Jean-Sébastien Pédron wrote: > The branch main has been updated by dumbbell: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d780c6a6abb5275c8c7219539553d51ac94a023e > > commit d780c6a6abb5275c8c7219539553d51ac94a023e > Author: Jean-Sébastien Pédron > AuthorDate: 2023-03-13 14:28:22 +0000 > Commit: Jean-Sébastien Pédron > CommitDate: 2023-03-20 20:47:36 +0000 > > x86/pci_early_quirks: Support Intel 11th+ gen > > Newer Intel CPUs/iGPUs use a new method to determine the base address of > the stolen memory. This code was ported from Linux. > > Reviewed by: manu > Approved by: manu > Differential Revision: https://reviews.freebsd.org/D39057 > --- > sys/x86/pci/pci_early_quirks.c | 26 ++++++++++++ > sys/x86/pci/pci_early_quirks.h | 95 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 121 insertions(+) Is this stuff still needed or useful? When it was added, the claim was that it would be soon used to reserve regions of physical memory that buggy BIOSes did not. That never happen. If the only current consumer of the stolen memory calculations are in drm kmods, wouldn't it be better to move the code there? From nobody Tue Mar 21 14:03:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgtcJ5QHWz40LlM; Tue, 21 Mar 2023 14:03: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 4PgtcJ4dKFz3F8k; Tue, 21 Mar 2023 14:03:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l7JYDKKsR7eVS7BIsb2L1qh6zBzwQ+fsDbZZK/LrNww=; b=KO7VxnLVHrg1nM3Fb2z5CFPzYQWZOYzhEADf7BXDtkHPLaVNhXHWFJIegeh0IMLtKp6sRM 24FA5PVFeKftrCBsCfTR7yXU+7VDo71YWjY1M1tLn70cgls3XMcvtmZh7k0+JJDMLwxwXY H/7/g5tB3Adc+ameoxcivpcPdJpYE6pADS00WwVegNwb5siYy7mUd+I1c2oh+1rzE9oCCD 6jRsgVbr5TXp3xZuuBnw06sxItXxYNBVkmbqL54uIV80DO+/A0TCHr3PIGx22WFYiEgnK7 FHUjNlJzFIciejr7q9pZeA7bNeM0nsL1YX8+ZJueFfogQVNbeX7Uj54LiWY9ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l7JYDKKsR7eVS7BIsb2L1qh6zBzwQ+fsDbZZK/LrNww=; b=Qx6gmpbmBw/M8SYo/68I6oVyzZeb0hRX+1+T5XvoYfr8GHB7Bstdt5vkfGzCpHdJmxoGOR x8/vN9cS0tuqrWP61Gkd1X+cFbYSM/Dp5zZEJuyNSL88W1C/HohLZglF+5qTbjjRzFABW3 Sg0Q0TuEhuoT2XoCmD8wcrVBJ4nssgtgYEWNNGnnYF5271vW1vZUDl/JUDfXWQKGOv0DAN gox+faXIJsHEjXhAVSTDaYE7ln304lvCHb0uE+8wshLO6zZm06VKcTCuAtfv9SY54cScLl hpHxowcpgs96brMKBDKYAOoIGQnlNTesd3xyEcd7X8wwtMu5L8Ap+Kq9yX5Pfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679407408; a=rsa-sha256; cv=none; b=qR3bIwKFO0drq54op8RZl/RXeDA1EYqHPH1LtXaKu4H9xxqbhp1sQNluKGiX0qhZLS7yzf YEeeJ7OvVHPDrn/mjO+zDbHL20IOZxDmDSOZKdQ8vmX7UBgtuCuDKXhPJJeLuUjSBkuv4y AZi+mwJTsuYV208fTOFxfsMrDNCXubGfgLnG+t08TxfZqYL1ogp9sFiuQ/wdrwtOQRkrs3 du8fyFO8F9Yc1oc1nwlqeBrUJQKPjsHx7B42j+3RG/zCZf8Oge4MhY29/eHEpVOnpVHtg+ nsIWVR5ENzuhj0dmNGULAmxZX6hS7AlvddVzVTnzjedqxlb65cFeUlhrqyEnbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgtcJ3gWhzFjF; Tue, 21 Mar 2023 14:03: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 32LE3SN4093755; Tue, 21 Mar 2023 14:03:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LE3SHP093753; Tue, 21 Mar 2023 14:03:28 GMT (envelope-from git) Date: Tue, 21 Mar 2023 14:03:28 GMT Message-Id: <202303211403.32LE3SHP093753@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: 87bb53cb5380 - main - gvinum: correct assertions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87bb53cb538059a3085db1fa4295dde5fcba55fe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=87bb53cb538059a3085db1fa4295dde5fcba55fe commit 87bb53cb538059a3085db1fa4295dde5fcba55fe Author: Ed Maste AuthorDate: 2022-12-12 17:08:39 +0000 Commit: Ed Maste CommitDate: 2023-03-21 14:03:12 +0000 gvinum: correct assertions Pointer addresses are always >= 0. Assert that the value is >= 0 instead. PR: 207855, 207856 Reviewed by: imp Reported by: David Binderman Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37677 --- sys/geom/vinum/geom_vinum_plex.c | 2 +- sys/geom/vinum/geom_vinum_raid5.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c index b217cff7d6ab..1f39204b9e07 100644 --- a/sys/geom/vinum/geom_vinum_plex.c +++ b/sys/geom/vinum/geom_vinum_plex.c @@ -173,7 +173,7 @@ gv_plex_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off, return (GV_ERR_ISBUSY); *sdno = stripeno % sdcount; - KASSERT(sdno >= 0, ("gv_plex_offset: sdno < 0")); + KASSERT(*sdno >= 0, ("gv_plex_offset: sdno < 0")); stripestart = (stripeno / sdcount) * p->stripesize; KASSERT(stripestart >= 0, ("gv_plex_offset: stripestart < 0")); diff --git a/sys/geom/vinum/geom_vinum_raid5.c b/sys/geom/vinum/geom_vinum_raid5.c index 43a6a8bce330..ecc3ae99b56b 100644 --- a/sys/geom/vinum/geom_vinum_raid5.c +++ b/sys/geom/vinum/geom_vinum_raid5.c @@ -602,7 +602,7 @@ gv_raid5_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off, /* The number of the subdisk containing the parity stripe. */ psd = sdcount - 1 - ( boff / (p->stripesize * (sdcount - 1))) % sdcount; - KASSERT(psdno >= 0, ("gv_raid5_offset: psdno < 0")); + KASSERT(psd >= 0, ("gv_raid5_offset: psdno < 0")); /* Offset of the start address from the start of the stripe. */ stripeoff = boff % (p->stripesize * (sdcount - 1)); @@ -610,7 +610,7 @@ gv_raid5_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off, /* The number of the subdisk where the stripe resides. */ sd = stripeoff / p->stripesize; - KASSERT(sdno >= 0, ("gv_raid5_offset: sdno < 0")); + KASSERT(sd >= 0, ("gv_raid5_offset: sdno < 0")); /* At or past parity subdisk. */ if (sd >= psd) From nobody Tue Mar 21 14:11:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pgtnz4GQ3z40MDm; Tue, 21 Mar 2023 14:11: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 4Pgtnz2GBMz3Gx3; Tue, 21 Mar 2023 14:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a/vNy49yMCWMjdP3iKLGM1FVKOy9BJ+AIk6UhW4sxVk=; b=eAVlHYObEEGuT5iI3WeLX5EADrZb4eIPj/zJ16iYtlTaJoP3KyPSSERok41N+iNaeI1eP1 V+j7V7qjZawSluBH6Tlo5RLqhDa3jyOhfVjGBGGZtH2hG6WwOM3k6RQE9vMxT/WM/j/MO+ YjEV0j+looMy5V3BPhZsPk1Q2ot9f2hAWiqiOwZ3JWa0F7Jl0P6/ixvvH83OF7kCKFn37z Iz8EdUVhojuzKg+0gvoStDPxonRowQLESl3fRfDJanZ2ORfsbMhTtu2NKtyJ8JHktRGKRi C+crB/GaRhXSqJ29A8FLnlAkhFrBfB215XQOuLb+HPwRTup0S/Q/zT9GVGGbNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679407911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a/vNy49yMCWMjdP3iKLGM1FVKOy9BJ+AIk6UhW4sxVk=; b=MPN8Wbo7kpHrJlksLj7NKogK3NrIPC3hUZG29tQJeXMu+EDGCz/1bAqB/30Q25yMwjk34D zy1pILdot1rNAmbLS7eV9BX8ziNfJX7Eca1vrxXHGKa0zEmPdWkuHWG4QaGJ1dH+IDq/rD 3bjbXM57ctUSmUaAiOPQm+Bzn/zQVXgmyl3PsacUlSl91jpty3CKX3AijyYk5Qbj6/S3lW y/Q/6bDlpWZyAwdKgtfGBhlsr9J7GCjlAgpj20WUm8bMlxMppXh4egXSf7/eSzVnvCoCmM +5R0CZQJIEWMM8K6PmCVbX4zS2452WMmD2EPczGgKdFz/fMv/z4YztSk02k7DQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679407911; a=rsa-sha256; cv=none; b=pmu6ykHjy8w9BEb+TVpf3q4yxgaL+AVAZiz/BHL+EVR9EgSIOvQyV6erGP9BDZYYyl8LZh sE2XDyXq29a7gSWLHYgjZkVEUqO07kgHyc5+cczOJ2SRV44EptK65RkcBQTLPXm0W8un07 ZHlzrB6VlJtDcKP1ZUPGYpqBPzlgSgtXlTJoHnOYt2BrI5Ap+GDPjAQHMKarINVFfNi6fi 78TA/m5oc3RA/r0p3SKZqZlFwAXplHoqSPgu3Fc4Yt7RA9E3NS48P33N763P8DjalEFxmO hqaXzFV6Fl7GdbTCrVSURkpmjpgsvbyi1AmOQhrRCU22q8twkf4X8b0FwVE6TQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pgtnz1LHjzFPZ; Tue, 21 Mar 2023 14:11: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 32LEBpTA006156; Tue, 21 Mar 2023 14:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LEBpkM006155; Tue, 21 Mar 2023 14:11:51 GMT (envelope-from git) Date: Tue, 21 Mar 2023 14:11:51 GMT Message-Id: <202303211411.32LEBpkM006155@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: 14f102eacc84 - main - tcp_wrappers: Use ANSI (c89) function definitions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14f102eacc8434a5a1f96466752578a4167140c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=14f102eacc8434a5a1f96466752578a4167140c9 commit 14f102eacc8434a5a1f96466752578a4167140c9 Author: Ed Maste AuthorDate: 2023-03-21 14:08:28 +0000 Commit: Ed Maste CommitDate: 2023-03-21 14:09:34 +0000 tcp_wrappers: Use ANSI (c89) function definitions Although this code is in contrib/ there is no active upstream. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36047 --- contrib/tcp_wrappers/clean_exit.c | 3 +- contrib/tcp_wrappers/diag.c | 6 +--- contrib/tcp_wrappers/environ.c | 32 +++++------------- contrib/tcp_wrappers/eval.c | 18 ++++------ contrib/tcp_wrappers/fakelog.c | 10 ++---- contrib/tcp_wrappers/fix_options.c | 3 +- contrib/tcp_wrappers/fromhost.c | 3 +- contrib/tcp_wrappers/hosts_access.c | 44 +++++++------------------ contrib/tcp_wrappers/hosts_ctl.c | 6 +--- contrib/tcp_wrappers/inetcf.c | 19 +++-------- contrib/tcp_wrappers/misc.c | 12 ++----- contrib/tcp_wrappers/miscd.c | 4 +-- contrib/tcp_wrappers/myvsyslog.c | 5 +-- contrib/tcp_wrappers/ncr.c | 3 +- contrib/tcp_wrappers/options.c | 65 ++++++++++--------------------------- contrib/tcp_wrappers/percent_m.c | 4 +-- contrib/tcp_wrappers/percent_x.c | 7 ++-- contrib/tcp_wrappers/ptx.c | 6 ++-- contrib/tcp_wrappers/refuse.c | 3 +- contrib/tcp_wrappers/rfc931.c | 14 +++----- contrib/tcp_wrappers/safe_finger.c | 10 ++---- contrib/tcp_wrappers/scaffold.c | 22 ++++--------- contrib/tcp_wrappers/setenv.c | 5 +-- contrib/tcp_wrappers/shell_cmd.c | 3 +- contrib/tcp_wrappers/socket.c | 12 +++---- contrib/tcp_wrappers/strcasecmp.c | 7 ++-- contrib/tcp_wrappers/tcpd.c | 4 +-- contrib/tcp_wrappers/tcpdchk.c | 33 ++++++------------- contrib/tcp_wrappers/tcpdmatch.c | 15 +++------ contrib/tcp_wrappers/tli-sequent.c | 8 ++--- contrib/tcp_wrappers/tli.c | 18 ++++------ contrib/tcp_wrappers/try-from.c | 4 +-- contrib/tcp_wrappers/update.c | 5 ++- contrib/tcp_wrappers/vfprintf.c | 9 ++--- contrib/tcp_wrappers/workarounds.c | 36 +++++--------------- 35 files changed, 128 insertions(+), 330 deletions(-) diff --git a/contrib/tcp_wrappers/clean_exit.c b/contrib/tcp_wrappers/clean_exit.c index 41caaf030665..04b1626d1a72 100644 --- a/contrib/tcp_wrappers/clean_exit.c +++ b/contrib/tcp_wrappers/clean_exit.c @@ -21,8 +21,7 @@ extern void exit(); /* clean_exit - clean up and exit */ -void clean_exit(request) -struct request_info *request; +void clean_exit(struct request_info *request) { /* diff --git a/contrib/tcp_wrappers/diag.c b/contrib/tcp_wrappers/diag.c index ac3df07a202e..f3b8b1aaf589 100644 --- a/contrib/tcp_wrappers/diag.c +++ b/contrib/tcp_wrappers/diag.c @@ -29,11 +29,7 @@ jmp_buf tcpd_buf; /* tcpd_diag - centralize error reporter */ -static void tcpd_diag(severity, tag, format, ap) -int severity; -char *tag; -char *format; -va_list ap; +static void tcpd_diag(int severity, char *tag, char *format, va_list ap) { char fmt[BUFSIZ]; diff --git a/contrib/tcp_wrappers/environ.c b/contrib/tcp_wrappers/environ.c index e7f846ddd6b7..93499189d3fb 100644 --- a/contrib/tcp_wrappers/environ.c +++ b/contrib/tcp_wrappers/environ.c @@ -37,8 +37,7 @@ static int allocated = 0; /* environ is, or is not, allocated */ /* namelength - determine length of name in "name=whatever" */ -static int namelength(name) -char *name; +static int namelength(char *name) { char *equal; @@ -48,9 +47,7 @@ char *name; /* findenv - given name, locate name=value */ -static char **findenv(name, len) -char *name; -int len; +static char **findenv(char *name, int len) { char **envp; @@ -62,8 +59,7 @@ int len; /* getenv - given name, locate value */ -char *getenv(name) -char *name; +char *getenv(char *name) { int len = namelength(name); char **envp = findenv(name, len); @@ -73,8 +69,7 @@ char *name; /* putenv - update or append environment (name,value) pair */ -int putenv(nameval) -char *nameval; +int putenv(char *nameval) { char *equal = strchr(nameval, '='); char *value = (equal ? equal : ""); @@ -84,8 +79,7 @@ char *nameval; /* unsetenv - remove variable from environment */ -void unsetenv(name) -char *name; +void unsetenv(char *name) { char **envp; @@ -96,10 +90,7 @@ char *name; /* setenv - update or append environment (name,value) pair */ -int setenv(name, value, clobber) -char *name; -char *value; -int clobber; +int setenv(char *name, char *value, int clobber) { char *destination; char **envp; @@ -133,9 +124,7 @@ int clobber; /* cmalloc - malloc and copy block of memory */ -static char *cmalloc(new_len, old, old_len) -char *old; -int old_len; +static char *cmalloc(int new_len, char *old, int old_len) { char *new = malloc(new_len); @@ -146,8 +135,7 @@ int old_len; /* addenv - append environment entry */ -static int addenv(nameval) -char *nameval; +static int addenv(char *nameval) { char **envp; int n_used; /* number of environment entries */ @@ -190,9 +178,7 @@ static void printenv() printf("%s\n", *envp); } -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { char *cp; int changed = 0; diff --git a/contrib/tcp_wrappers/eval.c b/contrib/tcp_wrappers/eval.c index d68358f3b9c3..cb4ef0650fa7 100644 --- a/contrib/tcp_wrappers/eval.c +++ b/contrib/tcp_wrappers/eval.c @@ -42,8 +42,7 @@ char paranoid[] = STRING_PARANOID; /* eval_user - look up user name */ -char *eval_user(request) -struct request_info *request; +char *eval_user(struct request_info *request) { if (request->user[0] == 0) { strcpy(request->user, unknown); @@ -55,8 +54,7 @@ struct request_info *request; /* eval_hostaddr - look up printable address */ -char *eval_hostaddr(host) -struct host_info *host; +char *eval_hostaddr(struct host_info *host) { if (host->addr[0] == 0) { strcpy(host->addr, unknown); @@ -68,8 +66,7 @@ struct host_info *host; /* eval_hostname - look up host name */ -char *eval_hostname(host) -struct host_info *host; +char *eval_hostname(struct host_info *host) { if (host->name[0] == 0) { strcpy(host->name, unknown); @@ -81,8 +78,7 @@ struct host_info *host; /* eval_hostinfo - return string with host name (preferred) or address */ -char *eval_hostinfo(host) -struct host_info *host; +char *eval_hostinfo(struct host_info *host) { char *hostname; @@ -100,8 +96,7 @@ struct host_info *host; /* eval_client - return string with as much about the client as we know */ -char *eval_client(request) -struct request_info *request; +char *eval_client(struct request_info *request) { static char both[2 * STRING_LENGTH]; char *hostinfo = eval_hostinfo(request->client); @@ -120,8 +115,7 @@ struct request_info *request; /* eval_server - return string with as much about the server as we know */ -char *eval_server(request) -struct request_info *request; +char *eval_server(struct request_info *request) { static char both[2 * STRING_LENGTH]; char *host = eval_hostinfo(request->server); diff --git a/contrib/tcp_wrappers/fakelog.c b/contrib/tcp_wrappers/fakelog.c index 97802dba7fb1..ad4a420ff557 100644 --- a/contrib/tcp_wrappers/fakelog.c +++ b/contrib/tcp_wrappers/fakelog.c @@ -17,20 +17,14 @@ static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21"; /* ARGSUSED */ -void openlog(name, logopt, facility) -char *name; -int logopt; -int facility; +void openlog(char *name, int logopt, int facility) { /* void */ } /* vsyslog - format one record */ -void vsyslog(severity, fmt, ap) -int severity; -char *fmt; -va_list ap; +void vsyslog(int severity, char *fmt, va_list ap) { char buf[BUFSIZ]; diff --git a/contrib/tcp_wrappers/fix_options.c b/contrib/tcp_wrappers/fix_options.c index b31c61a0382d..76ddaae419b4 100644 --- a/contrib/tcp_wrappers/fix_options.c +++ b/contrib/tcp_wrappers/fix_options.c @@ -35,8 +35,7 @@ static char sccsid[] = "@(#) fix_options.c 1.6 97/04/08 02:29:19"; /* fix_options - get rid of IP-level socket options */ void -fix_options(request) -struct request_info *request; +fix_options(struct request_info *request) { #ifdef IP_OPTIONS unsigned char optbuf[BUFFER_SIZE / 3], *cp; diff --git a/contrib/tcp_wrappers/fromhost.c b/contrib/tcp_wrappers/fromhost.c index a46c506e7915..ca065badbd4f 100644 --- a/contrib/tcp_wrappers/fromhost.c +++ b/contrib/tcp_wrappers/fromhost.c @@ -28,8 +28,7 @@ static char sccsid[] = "@(#) fromhost.c 1.17 94/12/28 17:42:23"; /* fromhost - find out what network API we should use */ -void fromhost(request) -struct request_info *request; +void fromhost(struct request_info *request) { /* diff --git a/contrib/tcp_wrappers/hosts_access.c b/contrib/tcp_wrappers/hosts_access.c index 140225fabace..05c62d194091 100644 --- a/contrib/tcp_wrappers/hosts_access.c +++ b/contrib/tcp_wrappers/hosts_access.c @@ -108,8 +108,7 @@ int yp_get_default_domain(char **); /* hosts_access - host access control facility */ -int hosts_access(request) -struct request_info *request; +int hosts_access(struct request_info *request) { int verdict; @@ -142,9 +141,7 @@ struct request_info *request; /* table_match - match table entries with (daemon, client) pair */ -static int table_match(table, request) -char *table; -struct request_info *request; +static int table_match(char *table, struct request_info *request) { FILE *fp; char sv_list[BUFLEN]; /* becomes list of daemons */ @@ -237,9 +234,7 @@ static int list_match(char *list, struct request_info *request, /* server_match - match server information */ -static int server_match(tok, request) -char *tok; -struct request_info *request; +static int server_match(char *tok, struct request_info *request) { char *host; @@ -253,9 +248,7 @@ struct request_info *request; /* client_match - match client information */ -static int client_match(tok, request) -char *tok; -struct request_info *request; +static int client_match(char *tok, struct request_info *request) { char *host; @@ -269,9 +262,7 @@ struct request_info *request; /* hostfile_match - look up host patterns from file */ -static int hostfile_match(path, host) -char *path; -struct host_info *host; +static int hostfile_match(char *path, struct host_info *host) { char tok[BUFSIZ]; int match = NO; @@ -289,9 +280,7 @@ struct host_info *host; /* host_match - match host name and/or address against pattern */ -static int host_match(tok, host) -char *tok; -struct host_info *host; +static int host_match(char *tok, struct host_info *host) { char *mask; @@ -332,9 +321,7 @@ struct host_info *host; /* string_match - match string against pattern */ -static int string_match(tok, string) -char *tok; -char *string; +static int string_match(char *tok, char *string) { int n; @@ -393,22 +380,16 @@ char *string; /* masked_match - match address against netnumber/netmask */ #ifdef INET6 -static int masked_match(net_tok, mask_tok, string) -char *net_tok; -char *mask_tok; -char *string; +static int masked_match(char *net_tok, char *mask_tok, char *string) { return (masked_match4(net_tok, mask_tok, string) || masked_match6(net_tok, mask_tok, string)); } -static int masked_match4(net_tok, mask_tok, string) +static int masked_match4(char *net_tok, char *mask_tok, char *string) #else -static int masked_match(net_tok, mask_tok, string) +static int masked_match(char *net_tok, char *mask_tok, char *string) #endif -char *net_tok; -char *mask_tok; -char *string; { #ifdef INET6 u_int32_t net; @@ -439,10 +420,7 @@ char *string; } #ifdef INET6 -static int masked_match6(net_tok, mask_tok, string) -char *net_tok; -char *mask_tok; -char *string; +static int masked_match6(char *net_tok, char *mask_tok, char *string) { struct addrinfo hints, *res; struct sockaddr_in6 net, addr; diff --git a/contrib/tcp_wrappers/hosts_ctl.c b/contrib/tcp_wrappers/hosts_ctl.c index e57f30aaa4a4..5477c49fdcdd 100644 --- a/contrib/tcp_wrappers/hosts_ctl.c +++ b/contrib/tcp_wrappers/hosts_ctl.c @@ -21,11 +21,7 @@ static char sccsid[] = "@(#) hosts_ctl.c 1.4 94/12/28 17:42:27"; /* hosts_ctl - limited interface to the hosts_access() routine */ -int hosts_ctl(daemon, name, addr, user) -char *daemon; -char *name; -char *addr; -char *user; +int hosts_ctl(char *daemon, char *name, char *addr, char *user) { struct request_info request; diff --git a/contrib/tcp_wrappers/inetcf.c b/contrib/tcp_wrappers/inetcf.c index d68faa06b127..44854c0f6f34 100644 --- a/contrib/tcp_wrappers/inetcf.c +++ b/contrib/tcp_wrappers/inetcf.c @@ -55,8 +55,7 @@ static char whitespace[] = " \t\r\n"; /* inet_conf - read in and examine inetd.conf (or tlid.conf) entries */ -char *inet_cfg(conf) -char *conf; +char *inet_cfg(char *conf) { char buf[BUFSIZ]; FILE *fp; @@ -159,11 +158,7 @@ char *conf; /* inet_chk - examine one inetd.conf (tlid.conf?) entry */ -static void inet_chk(protocol, path, arg0, arg1) -char *protocol; -char *path; -char *arg0; -char *arg1; +static void inet_chk(char *protocol, char *path, char *arg0, char *arg1) { char daemon[BUFSIZ]; struct stat st; @@ -274,9 +269,7 @@ char *arg1; /* inet_set - remember service status */ -void inet_set(name, type) -char *name; -int type; +void inet_set(char *name, int type) { struct inet_ent *ip = (struct inet_ent *) malloc(sizeof(struct inet_ent) + strlen(name)); @@ -293,8 +286,7 @@ int type; /* inet_get - look up service status */ -int inet_get(name) -char *name; +int inet_get(char *name) { struct inet_ent *ip; @@ -310,8 +302,7 @@ char *name; /* base_name - compute last pathname component */ -static char *base_name(path) -char *path; +static char *base_name(char *path) { char *cp; diff --git a/contrib/tcp_wrappers/misc.c b/contrib/tcp_wrappers/misc.c index 258d7091adce..c5fb1c6e92fc 100644 --- a/contrib/tcp_wrappers/misc.c +++ b/contrib/tcp_wrappers/misc.c @@ -25,10 +25,7 @@ static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29"; /* xgets - fgets() with backslash-newline stripping */ -char *xgets(ptr, len, fp) -char *ptr; -int len; -FILE *fp; +char *xgets(char *ptr, int len, FILE *fp) { int got; char *start = ptr; @@ -52,9 +49,7 @@ FILE *fp; /* split_at - break string at delimiter or return NULL */ -char *split_at(string, delimiter) -char *string; -int delimiter; +char *split_at(char *string, int delimiter) { char *cp; @@ -87,8 +82,7 @@ int delimiter; /* dot_quad_addr - convert dotted quad to internal form */ -unsigned long dot_quad_addr(str) -char *str; +unsigned long dot_quad_addr(char *str) { int in_run = 0; int runs = 0; diff --git a/contrib/tcp_wrappers/miscd.c b/contrib/tcp_wrappers/miscd.c index 1ab835c45061..4e7db2402cd6 100644 --- a/contrib/tcp_wrappers/miscd.c +++ b/contrib/tcp_wrappers/miscd.c @@ -43,9 +43,7 @@ static char sccsid[] = "@(#) miscd.c 1.10 96/02/11 17:01:30"; int allow_severity = SEVERITY; /* run-time adjustable */ int deny_severity = LOG_WARNING; /* ditto */ -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { struct request_info request; char path[MAXPATHNAMELEN]; diff --git a/contrib/tcp_wrappers/myvsyslog.c b/contrib/tcp_wrappers/myvsyslog.c index 20401f1f371b..d8cf9fd7b65f 100644 --- a/contrib/tcp_wrappers/myvsyslog.c +++ b/contrib/tcp_wrappers/myvsyslog.c @@ -18,10 +18,7 @@ static char sccsid[] = "@(#) myvsyslog.c 1.1 94/12/28 17:42:33"; #include "tcpd.h" #include "mystdarg.h" -myvsyslog(severity, format, ap) -int severity; -char *format; -va_list ap; +myvsyslog(int severity, char *format, va_list ap) { char fbuf[BUFSIZ]; char obuf[3 * STRING_LENGTH]; diff --git a/contrib/tcp_wrappers/ncr.c b/contrib/tcp_wrappers/ncr.c index b903fb85a565..e62a48948ce5 100644 --- a/contrib/tcp_wrappers/ncr.c +++ b/contrib/tcp_wrappers/ncr.c @@ -24,8 +24,7 @@ static char sccsid[] = "@(#) ncr.c 1.1 94/12/28 17:42:34"; /* fromhost - tear down the streams stack then rebuild it */ -void fromhost(request) -struct request_info *request; +void fromhost(struct request_info *request) { int i; int num_mod; diff --git a/contrib/tcp_wrappers/options.c b/contrib/tcp_wrappers/options.c index 64ad355faa61..481ba2d372d5 100644 --- a/contrib/tcp_wrappers/options.c +++ b/contrib/tcp_wrappers/options.c @@ -95,7 +95,8 @@ static void banners_option(); /* execute "banners path" option */ struct option { char *name; /* keyword name, case is ignored */ - void (*func) (); /* function that does the real work */ + void (*func) (char *value, struct request_info *request); + /* function that does the real work */ int flags; /* see below... */ }; @@ -132,9 +133,7 @@ static struct option option_table[] = { /* process_options - process access control options */ -void process_options(options, request) -char *options; -struct request_info *request; +void process_options(char *options, struct request_info *request) { char *key; char *value; @@ -218,9 +217,7 @@ struct request_info *request; /* banners_option - expand %, terminate each line with CRLF */ -static void banners_option(value, request) -char *value; -struct request_info *request; +static void banners_option(char *value, struct request_info *request) { char path[MAXPATHNAMELEN]; char ibuf[BUFSIZ]; @@ -250,9 +247,7 @@ struct request_info *request; /* ARGSUSED */ -static void group_option(value, request) -char *value; -struct request_info *request; +static void group_option(char *value, struct request_info *request) { struct group *grp; struct group *getgrnam(); @@ -269,9 +264,7 @@ struct request_info *request; /* ARGSUSED */ -static void user_option(value, request) -char *value; -struct request_info *request; +static void user_option(char *value, struct request_info *request) { struct passwd *pwd; struct passwd *getpwnam(); @@ -291,9 +284,7 @@ struct request_info *request; /* ARGSUSED */ -static void umask_option(value, request) -char *value; -struct request_info *request; +static void umask_option(char *value, struct request_info *request) { unsigned mask; char junk; @@ -307,9 +298,7 @@ struct request_info *request; /* ARGSUSED */ -static void spawn_option(value, request) -char *value; -struct request_info *request; +static void spawn_option(char *value, struct request_info *request) { if (dry_run == 0) shell_cmd(value); @@ -319,9 +308,7 @@ struct request_info *request; /* ARGSUSED */ -static void linger_option(value, request) -char *value; -struct request_info *request; +static void linger_option(char *value, struct request_info *request) { struct linger linger; char junk; @@ -341,9 +328,7 @@ struct request_info *request; /* ARGSUSED */ -static void keepalive_option(value, request) -char *value; -struct request_info *request; +static void keepalive_option(char *value, struct request_info *request) { static int on = 1; @@ -356,9 +341,7 @@ struct request_info *request; /* ARGSUSED */ -static void nice_option(value, request) -char *value; -struct request_info *request; +static void nice_option(char *value, struct request_info *request) { int niceval = 10; char junk; @@ -371,9 +354,7 @@ struct request_info *request; /* twist_option - replace process by shell command */ -static void twist_option(value, request) -char *value; -struct request_info *request; +static void twist_option(char *value, struct request_info *request) { char *error; @@ -409,9 +390,7 @@ struct request_info *request; /* rfc931_option - look up remote user name */ -static void rfc931_option(value, request) -char *value; -struct request_info *request; +static void rfc931_option(char *value, struct request_info *request) { int timeout; char junk; @@ -428,9 +407,7 @@ struct request_info *request; /* ARGSUSED */ -static void setenv_option(value, request) -char *value; -struct request_info *request; +static void setenv_option(char *value, struct request_info *request) { char *var_value; @@ -442,9 +419,7 @@ struct request_info *request; /* severity_map - lookup facility or severity value */ -static int severity_map(table, name) -const CODE *table; -char *name; +static int severity_map(const CODE *table, char *name) { const CODE *t; int ret = -1; @@ -464,9 +439,7 @@ char *name; /* ARGSUSED */ -static void severity_option(value, request) -char *value; -struct request_info *request; +static void severity_option(char *value, struct request_info *request) { char *level = split_at(value, '.'); @@ -477,8 +450,7 @@ struct request_info *request; /* get_field - return pointer to next field in string */ -static char *get_field(string) -char *string; +static char *get_field(char *string) { static char *last = ""; char *src; @@ -520,8 +492,7 @@ char *string; /* chop_string - strip leading and trailing blanks from string */ -static char *chop_string(string) -register char *string; +static char *chop_string(register char *string) { char *start = 0; char *end; diff --git a/contrib/tcp_wrappers/percent_m.c b/contrib/tcp_wrappers/percent_m.c index 1019b82d8c36..1cedbd9c4c0c 100644 --- a/contrib/tcp_wrappers/percent_m.c +++ b/contrib/tcp_wrappers/percent_m.c @@ -19,9 +19,7 @@ extern int sys_nerr; #include "mystdarg.h" -char *percent_m(obuf, ibuf) -char *obuf; -char *ibuf; +char *percent_m(char *obuf, char *ibuf) { char *bp = obuf; char *cp = ibuf; diff --git a/contrib/tcp_wrappers/percent_x.c b/contrib/tcp_wrappers/percent_x.c index 9b37329cf369..433dc4f9a153 100644 --- a/contrib/tcp_wrappers/percent_x.c +++ b/contrib/tcp_wrappers/percent_x.c @@ -29,11 +29,8 @@ extern void exit(); /* percent_x - do % expansion, abort if result buffer is too small */ -char *percent_x(result, result_len, string, request) -char *result; -int result_len; -char *string; -struct request_info *request; +char *percent_x(char *result, int result_len, char *string, + struct request_info *request) { char *bp = result; char *end = result + result_len - 1; /* end of result buffer */ diff --git a/contrib/tcp_wrappers/ptx.c b/contrib/tcp_wrappers/ptx.c index b9c312b82cdc..e8ea7ed08676 100644 --- a/contrib/tcp_wrappers/ptx.c +++ b/contrib/tcp_wrappers/ptx.c @@ -35,8 +35,7 @@ static void ptx_sink(); /* tli_host - determine TLI endpoint info, PTX version */ -void tli_host(request) -struct request_info *request; +void tli_host(struct request_info *request) { static struct sockaddr_in client; static struct sockaddr_in server; @@ -81,8 +80,7 @@ struct request_info *request; /* ptx_sink - absorb unreceived IP datagram */ -static void ptx_sink(fd) -int fd; +static void ptx_sink(int fd) { char buf[BUFSIZ]; struct sockaddr sa; diff --git a/contrib/tcp_wrappers/refuse.c b/contrib/tcp_wrappers/refuse.c index fd04e08ae9bf..833ecbe7e3e1 100644 --- a/contrib/tcp_wrappers/refuse.c +++ b/contrib/tcp_wrappers/refuse.c @@ -24,8 +24,7 @@ static char sccsid[] = "@(#) refuse.c 1.5 94/12/28 17:42:39"; /* refuse - refuse request */ -void refuse(request) -struct request_info *request; +void refuse(struct request_info *request) { #ifdef INET6 syslog(deny_severity, "refused connect from %s (%s)", diff --git a/contrib/tcp_wrappers/rfc931.c b/contrib/tcp_wrappers/rfc931.c index 033254b61261..e2adafb8f6ff 100644 --- a/contrib/tcp_wrappers/rfc931.c +++ b/contrib/tcp_wrappers/rfc931.c @@ -44,10 +44,7 @@ static jmp_buf timebuf; /* fsocket - open stdio stream on top of socket */ -static FILE *fsocket(domain, type, protocol) -int domain; -int type; -int protocol; +static FILE *fsocket(int domain, int type, int protocol) { int s; FILE *fp; @@ -73,15 +70,12 @@ static void timeout(int sig) /* rfc931 - return remote user name, given socket structures */ -void rfc931(rmt_sin, our_sin, dest) #ifdef INET6 -struct sockaddr *rmt_sin; -struct sockaddr *our_sin; +void rfc931(struct sockaddr *rmt_sin, struct sockaddr *our_sin, char *dest) #else -struct sockaddr_in *rmt_sin; -struct sockaddr_in *our_sin; +void rfc931(struct sockaddr_in *rmt_sin, struct sockaddr_in *our_sin, + char *dest) #endif -char *dest; { unsigned rmt_port; unsigned our_port; diff --git a/contrib/tcp_wrappers/safe_finger.c b/contrib/tcp_wrappers/safe_finger.c index 7b8f3cd638a8..dba8f1bf023d 100644 --- a/contrib/tcp_wrappers/safe_finger.c +++ b/contrib/tcp_wrappers/safe_finger.c @@ -49,9 +49,7 @@ int sig; exit(0); } -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { int c; int line_length = 0; @@ -135,8 +133,7 @@ char **argv; /* perror_exit - report system error text and terminate */ -void perror_exit(text) -char *text; +void perror_exit(char *text) { perror(text); exit(1); @@ -144,8 +141,7 @@ char *text; /* pipe_stdin - pipe stdin through program (from my ANSI to OLD C converter) */ -int pipe_stdin(argv) -char **argv; +int pipe_stdin(char **argv) { int pipefds[2]; int pid; diff --git a/contrib/tcp_wrappers/scaffold.c b/contrib/tcp_wrappers/scaffold.c index 325f702a53d4..cb4211fc98ac 100644 --- a/contrib/tcp_wrappers/scaffold.c +++ b/contrib/tcp_wrappers/scaffold.c @@ -43,8 +43,7 @@ int deny_severity = LOG_WARNING; #ifndef INET6 /* dup_hostent - create hostent in one memory block */ -static struct hostent *dup_hostent(hp) -struct hostent *hp; +static struct hostent *dup_hostent(struct hostent *hp) { struct hostent_block { struct hostent host; @@ -80,8 +79,7 @@ struct hostent *hp; /* find_inet_addr - find all addresses for this host, result to free() */ #ifdef INET6 -struct addrinfo *find_inet_addr(host) -char *host; +struct addrinfo *find_inet_addr(char *host) { struct addrinfo hints, *res; @@ -115,8 +113,7 @@ char *host; return (res); } #else -struct hostent *find_inet_addr(host) -char *host; +struct hostent *find_inet_addr(char *host) { struct in_addr addr; struct hostent *hp; @@ -161,8 +158,7 @@ char *host; /* check_dns - give each address thorough workout, return address count */ -int check_dns(host) -char *host; +int check_dns(char *host) { struct request_info request; #ifdef INET6 @@ -215,8 +211,7 @@ char *host; /* ARGSUSED */ -void shell_cmd(command) -char *command; +void shell_cmd(char *command) { if (hosts_access_verbose) printf("command: %s", command); @@ -226,17 +221,14 @@ char *command; /* ARGSUSED */ -void clean_exit(request) -struct request_info *request; +void clean_exit(struct request_info *request) { exit(0); } /* check_path - examine accessibility */ -int check_path(path, st) -char *path; -struct stat *st; +int check_path(char *path, struct stat *st) { struct stat stbuf; char buf[BUFSIZ]; diff --git a/contrib/tcp_wrappers/setenv.c b/contrib/tcp_wrappers/setenv.c index 03c706280c64..6f5720d3a849 100644 --- a/contrib/tcp_wrappers/setenv.c +++ b/contrib/tcp_wrappers/setenv.c @@ -16,10 +16,7 @@ static char sccsid[] = "@(#) setenv.c 1.1 93/03/07 22:47:58"; *** 514 LINES SKIPPED *** From nobody Tue Mar 21 14:20:12 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pgtzh2vQhz40MxJ; Tue, 21 Mar 2023 14:20:16 +0000 (UTC) (envelope-from corvink@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 4Pgtzh2F2fz3HTv; Tue, 21 Mar 2023 14:20:16 +0000 (UTC) (envelope-from corvink@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679408416; 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=F6SheedRSnRdbhBxj09q68F1g4xeJX4+4okWkfmk47Y=; b=fKMzUr3NnFWb83dt+Agc34VBDfOhg0jjbCmz5L/pByxZFe6YPw1tWgWWkH6bl/WI0RbeoP df+SxNMNqw60D5uIjOMwTU/RPVNB/IHJJK3f4Q6vTJh7mTFrNLPXUrHdvVyYrtqXE+L0sW Hed15PvM5gX7P2CaKZPEQTJg9YSXqz3nVj2FwKJLpRO2oYgE3vBNuMonKj4HheLxIBZn26 sZeh6m04/D8xSsBMwSKwsPns4ewGPU+C6cDXHRe6DbIwZlZyE/TpqXK2ELJaAZc4TcEHQY d1iryEPcWuRDAK/j78wg16nVe8Q+G4RIl9Sh6RNG9Tt/DDINnuxj9//RyFZ4rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679408416; 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=F6SheedRSnRdbhBxj09q68F1g4xeJX4+4okWkfmk47Y=; b=jlxUanegsdlr71JmUYm1TpqvFeXa83Hcnq69HBAsBI4G8Sa4yVUpqbj8sIHMMkNGQmg9dY 1YM1s30sN2z7TaNqtF2BxtwbcNM5NNiuzpEi6uqkO/OViIKjs70CB5JxSbBFMrizqtRDvf GPQUSgTCiEins4CWcxk3LeKa5CIEjjZ0vraQr/Xzg6tcNMbX99qkdP2VTHQ/6VAVF4OgpM NlvTLqr6O13+A/LBO+6eCf3F8gUEvhlID4fxAsh10+V82GZSpqeHbRYZGLK+TyV5f0IjBc xtTdA7bT2a8hUSBejXpCDsDAvKqVfoUHI0NIQH2UluJHr2A5FKloP3CC1w44kQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679408416; a=rsa-sha256; cv=none; b=Vxgd3vboA6yiwCxcNnrWPjSohv0ixTIeIYCSLJuCNfNGSytNxriIajF5r+KzrTr5ZSTXoO JsZGOXubBnktHOoIN70lhDWwQ9nxsgqT3eyfirGcD+uLd8HGWxXcniSQ7lKjCnNRosJpcH aX0kiwAABtB8q4TuA+FMoepLcyl96rwuCeItdvLdgS8IWWeFOVb15ZHZqzZIpBznoWX28O 2r31n/wjBdG95rlAmXSTt+iE9y7NiIRSjjDyxIRDpeF7AGtZXPvjouabL9ut0KRQxZpAYn m3kGXR1a+417s532kzdzJAbadq/4f/yAS3GCmv1YZGZqD+9V1w7Drv0M43ltSQ== Received: from [192.168.9.16] (p578013d9.dip0.t-ipconnect.de [87.128.19.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: corvink) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Pgtzg2QyWzcM1; Tue, 21 Mar 2023 14:20:15 +0000 (UTC) (envelope-from corvink@FreeBSD.org) Message-ID: <5d5698b1fdd6699d27a158c87cab868d0ea8046a.camel@FreeBSD.org> Subject: Re: git: d780c6a6abb5 - main - x86/pci_early_quirks: Support Intel 11th+ gen From: Corvin =?ISO-8859-1?Q?K=F6hne?= To: Konstantin Belousov , =?ISO-8859-1?Q?Jean-S=E9bastien_P=E9dron?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Date: Tue, 21 Mar 2023 15:20:12 +0100 In-Reply-To: References: <202303202047.32KKlrbx083372@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-S6/V0E4mTSdKG9YaCwN8" User-Agent: Evolution 3.46.4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N --=-S6/V0E4mTSdKG9YaCwN8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2023-03-21 at 16:02 +0200, Konstantin Belousov wrote: > On Mon, Mar 20, 2023 at 08:47:53PM +0000, Jean-S=C3=A9bastien P=C3=A9dron > wrote: > > The branch main has been updated by dumbbell: > >=20 > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3Dd780c6a6abb5275c8c7219539553d= 51ac94a023e > >=20 > > commit d780c6a6abb5275c8c7219539553d51ac94a023e > > Author:=C2=A0=C2=A0=C2=A0=C2=A0 Jean-S=C3=A9bastien P=C3=A9dron > > AuthorDate: 2023-03-13 14:28:22 +0000 > > Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Jean-S=C3=A9bastien P=C3=A9dron > > CommitDate: 2023-03-20 20:47:36 +0000 > >=20 > > =C2=A0=C2=A0=C2=A0 x86/pci_early_quirks: Support Intel 11th+ gen > > =C2=A0=C2=A0=C2=A0=20 > > =C2=A0=C2=A0=C2=A0 Newer Intel CPUs/iGPUs use a new method to determine= the base > > address of > > =C2=A0=C2=A0=C2=A0 the stolen memory. This code was ported from Linux. > > =C2=A0=C2=A0=C2=A0=20 > > =C2=A0=C2=A0=C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0 manu > > =C2=A0=C2=A0=C2=A0 Approved by:=C2=A0=C2=A0=C2=A0 manu > > =C2=A0=C2=A0=C2=A0 Differential Revision:=C2=A0 https://reviews.freebsd= .org/D39057 > > --- > > =C2=A0sys/x86/pci/pci_early_quirks.c | 26 ++++++++++++ > > =C2=A0sys/x86/pci/pci_early_quirks.h | 95 > > ++++++++++++++++++++++++++++++++++++++++++ > > =C2=A02 files changed, 121 insertions(+) > Is this stuff still needed or useful?=C2=A0 When it was added, the claim > was that > it would be soon used to reserve regions of physical memory that > buggy BIOSes > did not.=C2=A0 That never happen. >=20 > If the only current consumer of the stolen memory calculations are in > drm > kmods, wouldn't it be better to move the code there? I'm going to make use of intel_graphics_stolen_base and intel_graphics_stolen_size for GPU passthrough of bhyve vms. See https://reviews.freebsd.org/D26209 --=20 Kind regards, Corvin --=-S6/V0E4mTSdKG9YaCwN8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgvRSla3m2t/H2U9G2FTaVjFeAmoFAmQZvRwACgkQ2FTaVjFe AmqGzw/5ARYA6wcjtrUxY4uFmz49wYYS5X3N7zXqab4fUBzi7dO75E4AA6pEjPt1 JlZ/aF4Qu9pblLAgBt+qkoPlJv1OTi6Ui2Qtjdj6jvQRzH6EmGl1g7PfW/gHppUN ethJtuZslaiWK8pAxpclHgsPmzWHVe0f5qxUwS6ZT3Pu0CyB5jNSLy5/zBipzg+c 74Oc+JJX+zomXrVI/iV9XtqVBkiV+ZKBEFtLv3SsBlu7Af9kk4peKVBfA/O/sHL7 GCIWSN39oOlRHruwOkc/WZ4H/404cgBS8nYiIPByQX/Bhmeaotn0jpExtTL/y23t /q+C/x7FCnlLBxoYjohI0sNufA23Mu1Aws3vcyb1qTtlsWm5bfiF1MJ2mk1FxXpN ZqPGoeCn/rMh61pOisCljoKUGgvGmCiE3Xw2GvnJcdkPGdaqXnDURxmMvG1q0BQf HOe8QyjEuhgdY37WpWmLqfX0fWVwQsH2h6bWdsAppPMRqwAasNmo1HAyyXSleXwx KBZSZ7rXK0CRtQpGZF2fwKhwyfzzSrgMTdUDC7xwFVHhseIhQsEo6xSKxw9Q3aGe FcSb4f36MTaohmeK1FBHX5xov8LLOfFo3SkMJp4k6WLXELtD9Y3FIWeyei2uyznx Du0MLPgmGDY0cdbuBrpkwYNBzieaMvQs4ycyw3e3zSPb+HhYxLQ= =jkaB -----END PGP SIGNATURE----- --=-S6/V0E4mTSdKG9YaCwN8-- From nobody Tue Mar 21 14:34:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgvJQ1gCKz40NqW; Tue, 21 Mar 2023 14:34: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 4PgvJQ1B0Yz3Krg; Tue, 21 Mar 2023 14:34:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679409286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9SmPYwyY3UjHeyRpZNAjsJ5J/7QKK0Vq2h4osC4FlDo=; b=pPwcjDlBz1Pyw3E/M4a0PFJCU1rbnkzEb+XJ5zZfnmNCN5RLpiHyBIGg1mq/qRaJmnNPtj 2QivKUaFt781WB8F6nCF4S1fCtCP1j4MPIet7uDEB0s3KtVy7JCQTnAd0ACMqYloH8LoTb MrasKt2WPHyPJ6uOPZeQijusmEkW6exZXesHKSz/9EYvELRDmnQKzyRtS0icE/JcP+u+9Z 0ByJfjQanSUZs7wpMIkohoZcR7E80uHmovmS3UdpkbbwWaXy/zGdMxCw1iUNboZcMsFzAT BynRiUn880O2tZp2Wvaa7lWKmo0IVKfNC3YfJj2yxLrpPjHVkjq1JnIa0PHhKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679409286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9SmPYwyY3UjHeyRpZNAjsJ5J/7QKK0Vq2h4osC4FlDo=; b=fZ5nAYK+s+5BDg0QZrLbVpHYFE9O/OEZXaS3hHti8OcnXOXHHljEDvd3sr2M6xUpFF2W11 2dFge2bFUnccO0Cm2ibevc2T+WrCBZ/bvewhgX4rfOBnwYrKugAwinqUpaw0xix7NDrCQI AaHk/scSF8g/v3pqnykROvv+cEcGZnTpr8vX3FuPlwEekCQYIbiaFIFG7pbpjVph5nWM4W 37Qcsvk4KC9yetJFtbjpUGvZ8uD1aTHr9202flC5l5zdrrhpQc5GJzFChcqUd49dIGbBP+ /dOpi3ZahWrjrTKG6LF++5O/2WQdxRLfHDgt6vMDGuwHE25Yxm+1FN2wqkr3+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679409286; a=rsa-sha256; cv=none; b=b5F2vK4SLzGs/dqgZ9QUEnFEVDsQnxXF0sdxaCoV+sEO5iH3fLD7SB3mBvqgzXUxka7ng5 YwlMpO0l9NHY1Gr3yYZn56olaBPwKgOj4mCpKh/gQmWGXXRb6uixhGmiDGgkMGHo9PuJlp Wy0ygH7aolu/E9I7u/Jj8jQ6AGC+sLaFdDveAdFwPN5kEwduxZnAf9a3oI/EMWWZb941OC f3RunQt2mB3yL4qs6HRG2JXZ2JDj18TlWHmjdIBlNHI8EajtHvhIUaWovEtDHrtYvbuKkg 1NQbQExv93IK304+fJTefYTxA53CFumfkOaw1wyX1ll5U9IyNHXpcFlJpr1OMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgvJQ0FQjzGCY; Tue, 21 Mar 2023 14:34: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 32LEYj1d043340; Tue, 21 Mar 2023 14:34:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LEYjTr043339; Tue, 21 Mar 2023 14:34:45 GMT (envelope-from git) Date: Tue, 21 Mar 2023 14:34:45 GMT Message-Id: <202303211434.32LEYjTr043339@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: e9f8723c30fc - main - ldd: clarify format options List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9f8723c30fc390f1282f5286d57c090ed9e5925 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e9f8723c30fc390f1282f5286d57c090ed9e5925 commit e9f8723c30fc390f1282f5286d57c090ed9e5925 Author: Ed Maste AuthorDate: 2023-03-21 14:14:03 +0000 Commit: Ed Maste CommitDate: 2023-03-21 14:14:03 +0000 ldd: clarify format options -f may be specified zero, one, or two times. Make this clear in the usage. Reviewed by: markj, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34733 --- usr.bin/ldd/ldd.1 | 4 ++-- usr.bin/ldd/ldd.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1 index 47a7fff9f778..1e4ccf441c53 100644 --- a/usr.bin/ldd/ldd.1 +++ b/usr.bin/ldd/ldd.1 @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd August 28, 2021 +.Dd March 21, 2023 .Dt LDD 1 .Os .Sh NAME @@ -9,7 +9,7 @@ .Sh SYNOPSIS .Nm .Op Fl a -.Op Fl f Ar format +.Op Fl f Ar format Op Fl f Ar format .Ar program ... .Sh DESCRIPTION The diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 2cd2a4c72324..4f5555e34610 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -260,7 +260,8 @@ static void usage(void) { - fprintf(stderr, "usage: ldd [-a] [-f format] program ...\n"); + fprintf(stderr, + "usage: ldd [-a] [-f format [-f format]] program ...\n"); exit(1); } From nobody Tue Mar 21 15:08:24 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pgw3P1jWMz40QQ2; Tue, 21 Mar 2023 15:08:33 +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 4Pgw3N6cx7z3NSJ; Tue, 21 Mar 2023 15:08:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.17.1/8.17.1) with ESMTPS id 32LF8PcM028715 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 21 Mar 2023 17:08:28 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 32LF8PcM028715 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 32LF8OWS028705; Tue, 21 Mar 2023 17:08:24 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Mar 2023 17:08:24 +0200 From: Konstantin Belousov To: Corvin =?utf-8?B?S8O2aG5l?= Cc: =?utf-8?Q?Jean-S=C3=A9bastien_P=C3=A9dron?= , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d780c6a6abb5 - main - x86/pci_early_quirks: Support Intel 11th+ gen Message-ID: References: <202303202047.32KKlrbx083372@gitrepo.freebsd.org> <5d5698b1fdd6699d27a158c87cab868d0ea8046a.camel@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5d5698b1fdd6699d27a158c87cab868d0ea8046a.camel@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4Pgw3N6cx7z3NSJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Tue, Mar 21, 2023 at 03:20:12PM +0100, Corvin Köhne wrote: > On Tue, 2023-03-21 at 16:02 +0200, Konstantin Belousov wrote: > > On Mon, Mar 20, 2023 at 08:47:53PM +0000, Jean-Sébastien Pédron > > wrote: > > > The branch main has been updated by dumbbell: > > > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=d780c6a6abb5275c8c7219539553d51ac94a023e > > > > > > commit d780c6a6abb5275c8c7219539553d51ac94a023e > > > Author:     Jean-Sébastien Pédron > > > AuthorDate: 2023-03-13 14:28:22 +0000 > > > Commit:     Jean-Sébastien Pédron > > > CommitDate: 2023-03-20 20:47:36 +0000 > > > > > >     x86/pci_early_quirks: Support Intel 11th+ gen > > >     > > >     Newer Intel CPUs/iGPUs use a new method to determine the base > > > address of > > >     the stolen memory. This code was ported from Linux. > > >     > > >     Reviewed by:    manu > > >     Approved by:    manu > > >     Differential Revision:  https://reviews.freebsd.org/D39057 > > > --- > > >  sys/x86/pci/pci_early_quirks.c | 26 ++++++++++++ > > >  sys/x86/pci/pci_early_quirks.h | 95 > > > ++++++++++++++++++++++++++++++++++++++++++ > > >  2 files changed, 121 insertions(+) > > Is this stuff still needed or useful?  When it was added, the claim > > was that > > it would be soon used to reserve regions of physical memory that > > buggy BIOSes > > did not.  That never happen. > > > > If the only current consumer of the stolen memory calculations are in > > drm > > kmods, wouldn't it be better to move the code there? > > I'm going to make use of intel_graphics_stolen_base and > intel_graphics_stolen_size for GPU passthrough of bhyve vms. See > https://reviews.freebsd.org/D26209 Then perhaps the quirks should be moved to separate module. Both your stuff and drm could depend on it. From nobody Tue Mar 21 15:22:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgwLw4Fcvz40R3c; Tue, 21 Mar 2023 15:22: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 4PgwLw3pkGz3QGh; Tue, 21 Mar 2023 15:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679412120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RYJxv4DyGQ6R0ikQovHXkdinr0j4itzE5xhH0WC8VXI=; b=wqKP2vsbrI0DgUUCAVwHE5ESgT/pb+NsXFkFngKBwP18JuVD9+BzRejqf30uEEcc57WUv2 YayIaCKvR+4n3Vd4AO07VA/6h+pcYZFwdCLdncUOTw7vH9uAt7dD5mX+jtg6Tys/ijb0Yq j4r4pgG3XgEjtKhGU6Y5QkkwvfWE7Mn12fJv8XnNr9JRQbd+F0FonIL4LGygXBQF1UaWr+ ccT1iKVQnnJCwr/WZG+4US/BipgK/qfDifaE4E8MCjmP4nxbJMIv03tKXzvOFB3s6UctFI qC2Z/lpupc5+h+00tXeQ44L4dHzi+aNkPdhcg/aVUIsftS8WiYGhDkJwmWbFtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679412120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RYJxv4DyGQ6R0ikQovHXkdinr0j4itzE5xhH0WC8VXI=; b=UhUBSVlcMfnMuwh9QW05RKTPTyl6K5T22gTegxc7+lhadJRGSWRFOg6zfPMuYzvkU30YjM YeXLDX5avfvF5HNp+dvGZT4C6DGG2VW/pP6KygPLpLxtsGvra3QNmVxrskKNGHn6eENjpj 2+AYa/tztwHAdkODAwNZN2ozSobbUysOySxfVgQDs9tequGGiiASWZny9s5oTign/73Px3 lsL8jacP4Z30SXIO5MamcnK++37A9CAisn0QFWtq0EcU/QatFCXHHltoTH/+FUg+wWQsI1 cC/31qasi4nJD+ieDwaEkLRAp9HniOvZ0w0yaePCbkQSV7wHaVlYc7goqg5LRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679412120; a=rsa-sha256; cv=none; b=bcQ+hc3ewSZ/L+nuX3kuIOHA+jYlholTgdAVNIhHvfsDm7BssZIrYlZ7Wt/bUbZvS5RHo0 rwHqkvBLBPX2DejYourrcLbvJhrHeqDe5tr2pLrFuL5kI5Qt4V+Qko/NJFxAaeSqWD8f3o XNZyCUXGwN3igAwSaxjpFp93eWtWonaSb5rnb08IZ9W2jezqbMiWJ9HQRx7tEQMuEFjEpA F8dFtEN4S7j1r849Tx93MbbhjhIEAozYiegdW+WAoG87XA4NYAUn1SsY+RYOXe5ZbSAxRp Ad+DPfihY1QhUtDPhDM11hFTqDvoSX6bi2s6hvqSB+Kek/ZSP1O/0c+VFyJTtw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgwLw2ttFzHH2; Tue, 21 Mar 2023 15:22: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 32LFM0JH021774; Tue, 21 Mar 2023 15:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LFM0pA021773; Tue, 21 Mar 2023 15:22:00 GMT (envelope-from git) Date: Tue, 21 Mar 2023 15:22:00 GMT Message-Id: <202303211522.32LFM0pA021773@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: 68a930d8ee35 - main - lorder: add deprecation notice List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68a930d8ee35dd6ecc16254667a07e5be0a6f841 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=68a930d8ee35dd6ecc16254667a07e5be0a6f841 commit 68a930d8ee35dd6ecc16254667a07e5be0a6f841 Author: Ed Maste AuthorDate: 2023-03-21 14:20:42 +0000 Commit: Ed Maste CommitDate: 2023-03-21 14:20:42 +0000 lorder: add deprecation notice lorder has not been used by the base system since 0e1e341b486c and hasn't really been necessary for a very long time. PR: 259254 [exp-run] Reviewed by: arichardson (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30080 --- usr.bin/lorder/lorder.1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.bin/lorder/lorder.1 b/usr.bin/lorder/lorder.1 index de03b626fc5f..061e2ed75b20 100644 --- a/usr.bin/lorder/lorder.1 +++ b/usr.bin/lorder/lorder.1 @@ -28,12 +28,17 @@ .\" @(#)lorder.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd December 20, 2021 +.Dd March 21, 2023 .Dt LORDER 1 .Os .Sh NAME .Nm lorder .Nd list dependencies for object files +.Sh DEPRECATION NOTICE +.Nm +is obsolete and may not be present in +.Fx 14 +and later. .Sh SYNOPSIS .Nm .Ar From nobody Tue Mar 21 18:55:48 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph15d06VNz40dmr; Tue, 21 Mar 2023 18:55: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 4Ph15c6csWz43p1; Tue, 21 Mar 2023 18:55:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679424948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+l1ovhT9LQ83KqXWuoc4p2oTCqoR+3XZnmNzo7bVlI4=; b=bBgIZ8PofefcQwq3KddiQ/u3SKEIfWhmwlR6hNFrx6cBg67xNaJlng5r90RwHUwqYZPl6C CETHJYaUf+wChwCHTEq6Qg6pmbrENdaRBCU9p3GnWani5J89W8llSyuccOUbYJUOf92UOV oA7Ke0XK2oGptPnY38eRivwQ8dR4sQVglXic3aoPx0QApNRqUjzgHXYsdijrrExXAkAX7D lp9P4NgzNhAshGmknhZFabenYJdswIFPv4a3U5AQU2uQMEMABadQR1spewsW7pZSV/zfRY yf47KFd9ywEvjyODhaBx5PPyc1chHeAWhgYYocZONFblv1Q/mRnwkC1ktnv4QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679424948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+l1ovhT9LQ83KqXWuoc4p2oTCqoR+3XZnmNzo7bVlI4=; b=ozW2+KFmGYBenHr3NOxtvNArKhmCIseAFwi+tZIhK2EQUhusiYvU+CutITq5NfpDCQl72X BHtQKg9f5+ViJiKuzrwIAAhSdEfcf4W0QEEreTvX+wiMhFER0e/U1F89fdoIC6BVSCnqfD qkjEg/Jddq4vwiPn39pzOevHSq3jH9LraSDZJBLpjndV8p4MBAWJ7sdq9whPTEXV2JjXOI iUxlH8RC4GQjkGW3lOjw3NWU9qCtPWkxzgYN8NFK5nvy200iT6gjAspX5BAr302zv/OjV1 MQcNCwSyVCo/ngkxgObhRgFHzgZTYkWUqyjdfhqSZ8TiXYxGIjZnQLQgvqD/zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679424948; a=rsa-sha256; cv=none; b=I1iF5Rkz+goregDbfZbUucP8xryHwVARDp5DtPZbIXRoDWfxVCHSX3G8t/d++7UkiRHwS0 sY6eew3F25aqvWiAvjhocW+8ulZqJGazqFMEoTXzeqTHbgxdksKAasSn6gpsE8I0xa80LU pU20RQ4+0Mn0v3QovDgxfKtFrUbU27duY1FZ10vITVgCqhn4DmEy+wtWTVVBMWmDT38TZG Ab/FJI8hsLNCT9PqUhRgogeDxc7ifWeDdjFIj5STr+gJTLVKKT2UmPPiFx3GSi/3x+kP39 4MjGRkefQ9W5+qYMddE/LSB8Xny7CptjNje3obNd8khP0duOdTmtMEeJOWC2rQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph15c5ftDzNRQ; Tue, 21 Mar 2023 18:55: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 32LItmAf071329; Tue, 21 Mar 2023 18:55:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LItmSp071328; Tue, 21 Mar 2023 18:55:48 GMT (envelope-from git) Date: Tue, 21 Mar 2023 18:55:48 GMT Message-Id: <202303211855.32LItmSp071328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: a74998f38a2e - main - netlink: reduce the default debugging levels List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a74998f38a2e1d1c943087e2c9cf104a4f037a45 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a74998f38a2e1d1c943087e2c9cf104a4f037a45 commit a74998f38a2e1d1c943087e2c9cf104a4f037a45 Author: Alexander V. Chernikov AuthorDate: 2023-03-21 18:55:00 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-03-21 18:55:00 +0000 netlink: reduce the default debugging levels Reported by: kp MFC after: 2 weeks --- sys/netlink/netlink_generic.c | 2 +- sys/netlink/route/nexthop.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netlink/netlink_generic.c b/sys/netlink/netlink_generic.c index a16fdc312daa..d4022c2c2a75 100644 --- a/sys/netlink/netlink_generic.c +++ b/sys/netlink/netlink_generic.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #define DEBUG_MOD_NAME nl_generic #define DEBUG_MAX_LEVEL LOG_DEBUG3 #include -_DECLARE_DEBUG(LOG_DEBUG3); +_DECLARE_DEBUG(LOG_DEBUG); #define MAX_FAMILIES 20 #define MAX_GROUPS 64 diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index 63e491687249..b435a9afb3e7 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #define DEBUG_MOD_NAME nl_nhop #define DEBUG_MAX_LEVEL LOG_DEBUG3 #include -_DECLARE_DEBUG(LOG_DEBUG3); +_DECLARE_DEBUG(LOG_DEBUG); /* * This file contains the logic to maintain kernel nexthops and From nobody Tue Mar 21 19:05:03 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph1JJ1hyvz40f63; Tue, 21 Mar 2023 19:05: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 4Ph1JJ15lgz44Bb; Tue, 21 Mar 2023 19:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679425504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0qXNmWUmk440m6pq492vEVzfE/veoEqH9/7H9kmLQh8=; b=X2h+KZnJTPqqbfxsm51rlDIE6oMNlce0lPIDh9XbjTKVXfNq7JevGDkiQLS3T5CUnV7V35 Gs1Z7sJDN3xbGk4m6L/kPrFTNaY1WrISNrwUvR5cpHO6I9W5IAggTY+YpmH6KDfmHAxbiS MNVP0WRy6rrwo6FvRj/7Yh7mT9vHqsSadRUbo1FzM9R+R7LqScICBkM6cpMK5RqGIfov5a PZopera9bxEdREBOZ5Ge/lm6OG6jz0OSdrwfDiaHJQa35onzfPb0TeZj0RvUGgm4aqX42A 7Rf/qJR7RH80bQvGsBxalEr7jlie8rVof7u9pC7GUtgpRyeyJ/YNDdNWK4RlYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679425504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0qXNmWUmk440m6pq492vEVzfE/veoEqH9/7H9kmLQh8=; b=pJtpENlqOECFmQ9FfOSbTZXMhoPF+kMO8hJmIIL5sDidSCxhF7ykS6fFFl0bF+IpLdA/yK t0OM82+GnntelOW/G7kyIczMlGgI+P7RcVpbiu6dUjrOAlekZeVdVjAOcyvqXxcqNG26QZ 6fq8g2zhVxjjmdfzr8pdy/bHt0Ut55423h9kAXqRvUEG+1Ky4GGFm8DVBPgoLdJebXREaV e5SSRwuOYbUGgK2juIPTnd3MxRwT/zBWVYuCLpz8DSesoYTGXPt990ic4PHVNKhwcBeyn5 F9K5mLg8R4cngGhrgVttjmCT91Xf0/+nljIk5ARgO8dNXHA1SCCfIT4gR790vQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679425504; a=rsa-sha256; cv=none; b=eGqyHfJrQzya2yVHsDCabdVmIB9JQWD4duRag9528vklGgHeg1aE0BQCYFyMFe9Zh0ioVP LG1x+n84dsXj4pFD3BgE/PQCgeuTqaDDSVCv/525Q9eazGmy87AKo1cTxLV5wyeXwpvjeP TuHB5Ej0tPk7UGqpNepGacgzSHoCyVhGs5lvXaIwN2CQ/kBxvCaBL6Dd+KeV5BCp4pXtuP azhzq7goRYysKsNfP17oS1a2UvxHzjlFi8dWC8zmj3/i8kcyQXMyGgLBNQqEyjdJx1XVR4 UBZ9kve6/BGcJ7C+jylvk4Aqq1SR6YcZpgmOMXaTKFJhfwlENVXTcoqMLNzepA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph1JJ03ZJzNry; Tue, 21 Mar 2023 19:05: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 32LJ534w088584; Tue, 21 Mar 2023 19:05:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LJ53fV088583; Tue, 21 Mar 2023 19:05:03 GMT (envelope-from git) Date: Tue, 21 Mar 2023 19:05:03 GMT Message-Id: <202303211905.32LJ53fV088583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Kornel=20Dul=C4=99ba?= Subject: git: 19a4869d66f5 - main - OpenSSL: aes/asm/bsaes-armv7.pl: Replace adrl with add List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19a4869d66f59bf37cf42f657dcfad7c431784bf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kd: URL: https://cgit.FreeBSD.org/src/commit/?id=19a4869d66f59bf37cf42f657dcfad7c431784bf commit 19a4869d66f59bf37cf42f657dcfad7c431784bf Author: Kornel DulÄ™ba AuthorDate: 2023-03-21 17:18:59 +0000 Commit: Kornel DulÄ™ba CommitDate: 2023-03-21 19:04:04 +0000 OpenSSL: aes/asm/bsaes-armv7.pl: Replace adrl with add "adrl" is a pseudo-instruction used to calculate an address relative to PC. It's not recognized by clang resulting in a compilation error. I've stumbled upon it when trying to integrate the bsaes-armv7 assmebly logic into FreeBSD kernel, which uses clang as it's default compiler. Note that this affect the build only if BSAES_ASM_EXTENDED_KEY is defined, which is not the default option in OpenSSL. The solution here is to replace it with an add instruction. This mimics what has already been done in !BSAES_ASM_EXTENDED_KEY logic. Because of that I've marked this as trivial CLA. No objections from: jkim Obtained from: OpenSSL commit 27093ba73372935fe4ef91d0a45ce6ea90a1ac8e Differential Revision: https://reviews.freebsd.org/D39091 --- crypto/openssl/crypto/aes/asm/bsaes-armv7.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssl/crypto/aes/asm/bsaes-armv7.pl b/crypto/openssl/crypto/aes/asm/bsaes-armv7.pl index 2b9f241ce8b0..e2a84b380940 100755 --- a/crypto/openssl/crypto/aes/asm/bsaes-armv7.pl +++ b/crypto/openssl/crypto/aes/asm/bsaes-armv7.pl @@ -1444,7 +1444,7 @@ bsaes_ctr32_encrypt_blocks: .align 2 0: add r12, $key, #248 vld1.8 {@XMM[0]}, [$ctr] @ load counter - adrl $ctr, .LREVM0SR @ borrow $ctr + add $ctr, $const, #.LREVM0SR-.LM0 @ borrow $ctr vldmia r12, {@XMM[4]} @ load round0 key sub sp, #0x10 @ place for adjusted round0 key #endif From nobody Tue Mar 21 19:17:58 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph1bC0RPmz40g2d; Tue, 21 Mar 2023 19:17: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 4Ph1bB6pVrz45hq; Tue, 21 Mar 2023 19:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679426279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NIjeA6/fs8pZhD4F0y6YoMdVogmZCd8wvsZMYXth87I=; b=nEgIm307ysSlg7FdWlPvrwPd0QP++3osKzVtfS1UAnvwi08jAzVyJA08W3JdHUzlt2Bddy MnKwwpJ7xB3TN8u5i5S6l7iKqVgoK3G63j9dyMEvkJoBACgAdCqKTR1F3xaUMFygROQK4J j92+ZPxrCxq7tkIHY/kKC08K3P3f+eC54hbZEV9deX0svm/D9o3ye+CfTINgcipkGFXRwh dBIknO0M2LsnrEanaKw7NthX3oaDWkd64ql/JEn5CGW7Ju6VIaY6bBG1CLPlnp0ohtPfMp D0XP+lffaNjOXKUPX1caq/laCGD+xiTGKNTgcB+RROF58g5aHDEn8firdOi6eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679426279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NIjeA6/fs8pZhD4F0y6YoMdVogmZCd8wvsZMYXth87I=; b=lS11XSCO4CHAYeeU9tlBCI08x/Xtftw+bx5qhIoVwqQH5W+qMfGil2kOWlKKHg+bnvWzvS 5kCGXWjfyq17pP/WtPy5inf07avHzOKRb0x5cmVkwEmWY7iuQbes8acOyUMU9Tp2LUroEk KL8uouU1uVkAkI8zlcGZUFoXix7cRTcQSkSXvkkiw9PyuOdoIeOS9xZLv5BCgTN1qYV/oz oh1DxnYIpoZGIQFsJed3YjvCOfyYy4YeJhzuXKhpknRA1j8QncDlW2z2ZYekVTIaRHOqUJ 5mJSr5ilSdQdwJZ5v2vGnd8Dsus8g701Gewr31ivb0MCzjy1NKyEclVw7YU24Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679426279; a=rsa-sha256; cv=none; b=EFKGgZrooI7niLcu6EtaWgFbXvP96nqC9TnDGLg37oUuFDLckCLpBVvSTvhig1135X12L+ Q4pfbUPJiVkRDGNmTBaFYoVqiiOEaVTeOdnSr3grvhycpcYyMzLXluzmnuNlDPPPxPCEYo LvFS9tOwamcrXuh8BKwf31Jx98V6cfyRFE030swNVaNZM3t5CNFxQm7VNKgKL1Gd54+B34 1zhu5G2/4mDQm3DpzBNtttc3I9Pc//u1vVCnyHcafmzGBH+Aj1v7isMWpsZ8yeu8NK5mxR YwS4vxi7mBhQwrXWZxbsPaDKMyqmWDnCEgQUlnHeKmJNafa6dxdwFXVG0j0RtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph1bB5qcwzP2C; Tue, 21 Mar 2023 19:17: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 32LJHwgm005420; Tue, 21 Mar 2023 19:17:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LJHwhj005419; Tue, 21 Mar 2023 19:17:58 GMT (envelope-from git) Date: Tue, 21 Mar 2023 19:17:58 GMT Message-Id: <202303211917.32LJHwhj005419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: e415d255a63c - main - OpenSSL: Regen an assembly file for arm List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e415d255a63c26cbc5ae1dfc3c1e0ef099ff77e7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=e415d255a63c26cbc5ae1dfc3c1e0ef099ff77e7 commit e415d255a63c26cbc5ae1dfc3c1e0ef099ff77e7 Author: Jung-uk Kim AuthorDate: 2023-03-21 19:13:51 +0000 Commit: Jung-uk Kim CommitDate: 2023-03-21 19:13:51 +0000 OpenSSL: Regen an assembly file for arm X-MFC with: af19988f6cd3 --- sys/crypto/openssl/arm/bsaes-armv7.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/crypto/openssl/arm/bsaes-armv7.S b/sys/crypto/openssl/arm/bsaes-armv7.S index 8fe75aaf81ca..2e452f75a643 100644 --- a/sys/crypto/openssl/arm/bsaes-armv7.S +++ b/sys/crypto/openssl/arm/bsaes-armv7.S @@ -1392,7 +1392,7 @@ bsaes_ctr32_encrypt_blocks: .align 2 add r12, r3, #248 vld1.8 {q0}, [r8] @ load counter - adrl r8, .LREVM0SR @ borrow r8 + add r8, r6, #.LREVM0SR-.LM0 @ borrow r8 vldmia r12, {q4} @ load round0 key sub sp, #0x10 @ place for adjusted round0 key #endif From nobody Tue Mar 21 19:22:37 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph1hZ4P7cz40gb2; Tue, 21 Mar 2023 19:22:38 +0000 (UTC) (envelope-from jkim@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 4Ph1hZ2CPzz47nZ; Tue, 21 Mar 2023 19:22:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679426558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UKrevCIZBFI5a98dNhDOvqATcwwnD2CSyCBBBd9BA/0=; b=EkoLR/BSbhWKemn5HPZtH2z5S7YTQpWdmbMJgs+rymHqPX0Cl5IQnTUqtzFsGFbBcNoktZ 9bu46QrMPmlbGd6b5DkWMkwiv8fYrSBVKe4gf/vs6/TcyMs2QW1l9Yp9rsVHQhC58KJRF4 dgg1a+pzVNAjyzzoNTJCeHUrP3epD99yQ9TsCGnVj0qCaKDjjr/cqZFAyPy98EeacdxZlT rytnxoSA7KJ04kz1y2eMjkFYVQBN74gmVUJE/KW7dhIAXKnqlI51t1KV2wqy4GLdeE4z+P 9q82y7aL6FiTFrhdaFezaNfKBcK30xaX7wLJ8NftP/3mSGAro7qRVvDzt1mpRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679426558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UKrevCIZBFI5a98dNhDOvqATcwwnD2CSyCBBBd9BA/0=; b=BMjibd5TiFyCTEP7EiAwrr9s41i4bY6vyCEYU4HU1mXWA/V/RzvnPCN/uKXjp2R6SDBdrH sFl0qbdoZJhNS7h6mfEfrXrn+5yONlUzUbc9PJxBmvV6AmM0dXOqvP3TDpRqqLk7XfHtr0 okM8QblR7gwjF5GCuJgit9FvAaEp3inlPHL+io8kQJ4+b96J2gFzXSyYg4kxnktMAlXayr 5/KtcRH6hGRhyXCulNkTCpvtSIZJ71g8DwtMg04G69gyrMtQteUqcimaRdMoTyV3Tjcmjy fRC7GN7t2mKLbZu1fj0tygFF9JbdZBOIxUmMcwnfKGUT1Vrb1uZC4vNoVcFixQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679426558; a=rsa-sha256; cv=none; b=kkPxySWxKj7EhodhG36ryGjnYJp++nGnnjdh3d0tRTXSSU3nYWQPuPCdmALEZzvLw0L4/T K1E/2SqKUIOAgFNBUIMVOaktiuwUAFA0MQzi9ARB1zeXVegxyfJB8QzDr09d5SsEBsEpii /5UtUAu6jPd1Se8RHSDfOzxD4FgiPZ/DvGpsVetLN7+41TfjV8tPClx5YNbrumM8QjNIZg npSAXVZ1kwk0v0UgslzJxaxiWjgHjqRbXTmMlHzOmw89yYDxpiINVe9w2crxTtxP4deWMl GuG9J6PrD3xlNVU15a3eTThMxD29tbc3TBQ4sSeASjYaLTtXDG7SND0exIQohw== Received: from freefall.freebsd.org (pool-100-8-164-92.nwrknj.fios.verizon.net [100.8.164.92]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Ph1hZ0pJ3zk7P; Tue, 21 Mar 2023 19:22:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <041c23a9-cf47-b521-707e-825dd4f4b9db@FreeBSD.org> Date: Tue, 21 Mar 2023 15:22:37 -0400 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: git: e415d255a63c - main - OpenSSL: Regen an assembly file for arm Content-Language: en-US From: Jung-uk Kim To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202303211917.32LJHwhj005419@gitrepo.freebsd.org> Organization: FreeBSD.org In-Reply-To: <202303211917.32LJHwhj005419@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------Kmd0fjwO0gBKhLW2DT0L4fmU" X-ThisMailContainsUnwantedMimeParts: N This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------Kmd0fjwO0gBKhLW2DT0L4fmU Content-Type: multipart/mixed; boundary="------------nnv0t8JLIPWvOCQ0oYJMncvg"; protected-headers="v1" From: Jung-uk Kim To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <041c23a9-cf47-b521-707e-825dd4f4b9db@FreeBSD.org> Subject: Re: git: e415d255a63c - main - OpenSSL: Regen an assembly file for arm References: <202303211917.32LJHwhj005419@gitrepo.freebsd.org> In-Reply-To: <202303211917.32LJHwhj005419@gitrepo.freebsd.org> --------------nnv0t8JLIPWvOCQ0oYJMncvg Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 T24gMjMuIDMuIDIxLiwgSnVuZy11ayBLaW0gd3JvdGU6DQo+IFRoZSBicmFuY2ggbWFpbiBo YXMgYmVlbiB1cGRhdGVkIGJ5IGpraW06DQo+IA0KPiBVUkw6IGh0dHBzOi8vY2dpdC5GcmVl QlNELm9yZy9zcmMvY29tbWl0Lz9pZD1lNDE1ZDI1NWE2M2MyNmNiYzVhZTFkZmMzYzFlMGVm MDk5ZmY3N2U3DQo+IA0KPiBjb21taXQgZTQxNWQyNTVhNjNjMjZjYmM1YWUxZGZjM2MxZTBl ZjA5OWZmNzdlNw0KPiBBdXRob3I6ICAgICBKdW5nLXVrIEtpbSA8amtpbUBGcmVlQlNELm9y Zz4NCj4gQXV0aG9yRGF0ZTogMjAyMy0wMy0yMSAxOToxMzo1MSArMDAwMA0KPiBDb21taXQ6 ICAgICBKdW5nLXVrIEtpbSA8amtpbUBGcmVlQlNELm9yZz4NCj4gQ29tbWl0RGF0ZTogMjAy My0wMy0yMSAxOToxMzo1MSArMDAwMA0KPiANCj4gICAgICBPcGVuU1NMOiBSZWdlbiBhbiBh c3NlbWJseSBmaWxlIGZvciBhcm0NCj4gICAgICANCj4gICAgICBYLU1GQyB3aXRoOiAgICAg YWYxOTk4OGY2Y2QzDQoNClgtTUZDIHdpdGg6CTE5YTQ4NjlkNjZmNQ0KDQpTb3JyeSBmb3Ig dGhlIHR5cG8uDQoNCkp1bmctdWsgS2ltDQoNCj4gLS0tDQo+ICAgc3lzL2NyeXB0by9vcGVu c3NsL2FybS9ic2Flcy1hcm12Ny5TIHwgMiArLQ0KPiAgIDEgZmlsZSBjaGFuZ2VkLCAxIGlu c2VydGlvbigrKSwgMSBkZWxldGlvbigtKQ0KPiANCj4gZGlmZiAtLWdpdCBhL3N5cy9jcnlw dG8vb3BlbnNzbC9hcm0vYnNhZXMtYXJtdjcuUyBiL3N5cy9jcnlwdG8vb3BlbnNzbC9hcm0v YnNhZXMtYXJtdjcuUw0KPiBpbmRleCA4ZmU3NWFhZjgxY2EuLjJlNDUyZjc1YTY0MyAxMDA2 NDQNCj4gLS0tIGEvc3lzL2NyeXB0by9vcGVuc3NsL2FybS9ic2Flcy1hcm12Ny5TDQo+ICsr KyBiL3N5cy9jcnlwdG8vb3BlbnNzbC9hcm0vYnNhZXMtYXJtdjcuUw0KPiBAQCAtMTM5Miw3 ICsxMzkyLDcgQEAgYnNhZXNfY3RyMzJfZW5jcnlwdF9ibG9ja3M6DQo+ICAgLmFsaWduCTIN Cj4gICAJYWRkCXIxMiwgcjMsICMyNDgNCj4gICAJdmxkMS44CXtxMH0sIFtyOF0JCUAgbG9h ZCBjb3VudGVyDQo+IC0JYWRybAlyOCwgLkxSRVZNMFNSCQkJQCBib3Jyb3cgcjgNCj4gKwlh ZGQJcjgsIHI2LCAjLkxSRVZNMFNSLS5MTTAJQCBib3Jyb3cgcjgNCj4gICAJdmxkbWlhCXIx Miwge3E0fQkJCUAgbG9hZCByb3VuZDAga2V5DQo+ICAgCXN1YglzcCwgIzB4MTAJCQlAIHBs YWNlIGZvciBhZGp1c3RlZCByb3VuZDAga2V5DQo+ICAgI2VuZGlmDQoNCg== --------------nnv0t8JLIPWvOCQ0oYJMncvg-- --------------Kmd0fjwO0gBKhLW2DT0L4fmU Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAmQaA/0FAwAAAAAACgkQfJ+WJvzb8Ua9 Mwf/e/WNekHejDcEG6UWu0PgJNeMQ/vA+LibdQCJlUXsjYtOcI6HCk7DeqDEU4ZrhcB0qvnodlOu Zt9wbaDF9zKCofbdp3Sn/JxToL1kvYDfyryPvuAZWavkHC5WKefcvao7Awn3YBD+XWRJyiCvOalw W4/g6HTjEQTRHU15rxr+pWgHq9wnSWW7E7t2yMQ4LMs5aO7br6sqzR7Z/5Mv7QrGe7Tn82E2Ftga MNB50k6CtwJYUuwHkwE3iijUsK65SFJYme9KD+xLEzHRudaW/QXr4H6Zo8JIOLXWqNhILDtdIcAo sDejEdksXvY19K/+0c1jadFBL9wGeGGaY8hbG03IIQ== =BdVY -----END PGP SIGNATURE----- --------------Kmd0fjwO0gBKhLW2DT0L4fmU-- From nobody Tue Mar 21 20:04:31 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph2cv3c3kz40mTM; Tue, 21 Mar 2023 20: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 4Ph2cv32t9z41jy; Tue, 21 Mar 2023 20:04:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679429071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QHNJ+EOMHxEmzsjStRCppD0ASSx8Tvr5j435dDuYmNs=; b=HKvCNt7RAxYo3ybNJ97xLRqmQq7HbsJBd3FV7WEQ631P8lIYTrTa0p5oC2DQtPohO1rjcU hDTr3HY4bKJzHYNgwdNFjIbOnQsuAlhr9c8SebXCbICw4DYE1ix1IDfTvoR0h2xk2wB/pK LPbFhI7S9SCyIxe4BJ7OcUDWDALjJNYKVT+wYxcKAWT33IX+DZGR1pg7KxJEwDWBjs+Zfo vPBWoCiAR83UTUaQeNftMDe+E5L+H9WnOSZtFPRh7WXj1K83S2KeiB5X6oTCaWrBNZPblD /dZmmVKngD6jMt9aLTTTN9OISJfF8dYqVTWjSJHiGF59/TmVPXoZ72P8+85f/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679429071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QHNJ+EOMHxEmzsjStRCppD0ASSx8Tvr5j435dDuYmNs=; b=i7f6x6iGCO7OQE4qU3zxjH86J/8IInES3/8pB5fgP5p0OjytYZoKb8gUBi1LS0Kj2NtrlX 4/4F16jwsDnk0sleKzMymDbHgTH6AAzxCU7Ff7YvcUyEloSqD+CxgcyemRmgTxKxCcQUKz 7eK0NLxwlqs9GWepB/m76ZSLi+qhdeMLvY06yZ0jliV6ajMMMou9+NsCx8kWAnV3IYLYs/ WkRSTqtP5r9dnZA01/sc0MuGZcbTYer6jK99jGLVTqFovo1m5eOwxG5dcNQyi8F76ESjR8 t1iJipTUMMSdC0mZMv76tGhuojrtZDwdJaxlN8VdND0e55cFkJMbJGecXspCwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679429071; a=rsa-sha256; cv=none; b=llpSbcf5I9I9VwPpdGgjNOFcP2sVlTWsYwhQBIyXZiuh88Gev3bviHe8nEuU67MwaNSFml 7FOHRURlOtvLRrgSi76CRzcIPjhyWe9s2eReNkj3HlVVyUEHWLzprgJq6pgykJjoqekxtB KekqQazVZXx3F9iltGBgz0y5iutD9aDhmzM6QLeQL7YMtMYSbRQ2k9KcsYZK+NGciCvLxk Kw/+hyT/NsMqgINFMRpLXhatMlC1okZqcJoVzdovf0QsY7ats9dF56Z5ubfjx/NAKcQ32j /HNAelkpZP5OFFSQ3y3Jmx8KyzwFemAA4kgw8CwNY+dxRVjB2BTSU7Je80JIbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph2cv25ptzQM8; Tue, 21 Mar 2023 20:04: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 32LK4V28007956; Tue, 21 Mar 2023 20:04:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LK4VEx007955; Tue, 21 Mar 2023 20:04:31 GMT (envelope-from git) Date: Tue, 21 Mar 2023 20:04:31 GMT Message-Id: <202303212004.32LK4VEx007955@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: b4b33821fa3d - main - ktls: Fix interlocking between ktls_enable_rx() and listen(2) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4b33821fa3d970121d886467d10126679876905 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b4b33821fa3d970121d886467d10126679876905 commit b4b33821fa3d970121d886467d10126679876905 Author: Mark Johnston AuthorDate: 2023-03-21 19:51:24 +0000 Commit: Mark Johnston CommitDate: 2023-03-21 20:04:00 +0000 ktls: Fix interlocking between ktls_enable_rx() and listen(2) The TCP_TXTLS_ENABLE and TCP_RXTLS_ENABLE socket option handlers check whether the socket is listening socket and fail if so, but this check is racy. Since we have to lock the socket buffer later anyway, defer the check to that point. ktls_enable_tx() locks the send buffer's I/O lock, which will fail if the socket is a listening socket, so no explicit checks are needed. In ktls_enable_rx(), which does not acquire the I/O lock (see the review for some discussion on this), use an explicit SOLISTENING() check after locking the recv socket buffer. Otherwise, a concurrent solisten_proto() call can trigger crashes and memory leaks by wiping out socket buffers as ktls_enable_*() is modifying them. Also make sure that a KTLS-enabled socket can't be converted to a listening socket, and use SOCK_(SEND|RECV)BUF_LOCK macros instead of the old ones while here. Add some simple regression tests involving listen(2). Reported by: syzkaller MFC after: 2 weeks Reviewed by: gallatin, glebius, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38504 --- sys/kern/uipc_ktls.c | 21 +++++++++++++-------- sys/kern/uipc_socket.c | 23 +++++++++++++++++------ tests/sys/kern/ktls_test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 14 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 5b41cd3f829f..c82864f379b8 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1223,8 +1223,6 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) if (!ktls_offload_enable) return (ENOTSUP); - if (SOLISTENING(so)) - return (EINVAL); counter_u64_add(ktls_offload_enable_calls, 1); @@ -1256,7 +1254,12 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) } /* Mark the socket as using TLS offload. */ - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); + if (SOLISTENING(so)) { + SOCK_RECVBUF_UNLOCK(so); + ktls_free(tls); + return (EINVAL); + } so->so_rcv.sb_tls_seqno = be64dec(en->rec_seq); so->so_rcv.sb_tls_info = tls; so->so_rcv.sb_flags |= SB_TLS_RX; @@ -1264,7 +1267,7 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) /* Mark existing data as not ready until it can be decrypted. */ sb_mark_notready(&so->so_rcv); ktls_check_rx(&so->so_rcv); - SOCKBUF_UNLOCK(&so->so_rcv); + SOCK_RECVBUF_UNLOCK(so); /* Prefer TOE -> ifnet TLS -> software TLS. */ #ifdef TCP_OFFLOAD @@ -1290,8 +1293,6 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) if (!ktls_offload_enable) return (ENOTSUP); - if (SOLISTENING(so)) - return (EINVAL); counter_u64_add(ktls_offload_enable_calls, 1); @@ -1334,6 +1335,10 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) return (error); } + /* + * Serialize with sosend_generic() and make sure that we're not + * operating on a listening socket. + */ error = SOCK_IO_SEND_LOCK(so, SBL_WAIT); if (error) { ktls_free(tls); @@ -1347,7 +1352,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) */ inp = so->so_pcb; INP_WLOCK(inp); - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); so->so_snd.sb_tls_seqno = be64dec(en->rec_seq); so->so_snd.sb_tls_info = tls; if (tls->mode != TCP_TLS_MODE_SW) { @@ -1357,7 +1362,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) if (tp->t_fb->tfb_hwtls_change != NULL) (*tp->t_fb->tfb_hwtls_change)(tp, 1); } - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); INP_WUNLOCK(inp); SOCK_IO_SEND_UNLOCK(so); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1d2b06311c8c..f529f885d17c 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -987,13 +987,24 @@ solisten_proto_check(struct socket *so) mtx_lock(&so->so_snd_mtx); mtx_lock(&so->so_rcv_mtx); - /* Interlock with soo_aio_queue(). */ - if (!SOLISTENING(so) && - ((so->so_snd.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0 || - (so->so_rcv.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0)) { - solisten_proto_abort(so); - return (EINVAL); + /* Interlock with soo_aio_queue() and KTLS. */ + if (!SOLISTENING(so)) { + bool ktls; + +#ifdef KERN_TLS + ktls = so->so_snd.sb_tls_info != NULL || + so->so_rcv.sb_tls_info != NULL; +#else + ktls = false; +#endif + if (ktls || + (so->so_snd.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0 || + (so->so_rcv.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0) { + solisten_proto_abort(so); + return (EINVAL); + } } + return (0); } diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c index 60f2218ae5f2..e925dbe32e52 100644 --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -2767,6 +2767,51 @@ ATF_TC_BODY(ktls_sendto_baddst, tc) ATF_REQUIRE(close(s) == 0); } +/* + * Make sure that listen(2) returns an error for KTLS-enabled sockets, and + * verify that an attempt to enable KTLS on a listening socket fails. + */ +ATF_TC_WITHOUT_HEAD(ktls_listening_socket); +ATF_TC_BODY(ktls_listening_socket, tc) +{ + struct tls_enable en; + struct sockaddr_in sin; + int s; + + ATF_REQUIRE_KTLS(); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ATF_REQUIRE(s >= 0); + build_tls_enable(tc, CRYPTO_AES_NIST_GCM_16, 128 / 8, 0, + TLS_MINOR_VER_THREE, (uint64_t)random(), &en); + ATF_REQUIRE(setsockopt(s, IPPROTO_TCP, TCP_TXTLS_ENABLE, &en, + sizeof(en)) == 0); + ATF_REQUIRE_ERRNO(EINVAL, listen(s, 1) == -1); + ATF_REQUIRE(close(s) == 0); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ATF_REQUIRE(s >= 0); + build_tls_enable(tc, CRYPTO_AES_NIST_GCM_16, 128 / 8, 0, + TLS_MINOR_VER_THREE, (uint64_t)random(), &en); + ATF_REQUIRE(setsockopt(s, IPPROTO_TCP, TCP_RXTLS_ENABLE, &en, + sizeof(en)) == 0); + ATF_REQUIRE_ERRNO(EINVAL, listen(s, 1) == -1); + ATF_REQUIRE(close(s) == 0); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ATF_REQUIRE(s >= 0); + memset(&sin, 0, sizeof(sin)); + ATF_REQUIRE(bind(s, (struct sockaddr *)&sin, sizeof(sin)) == 0); + ATF_REQUIRE(listen(s, 1) == 0); + build_tls_enable(tc, CRYPTO_AES_NIST_GCM_16, 128 / 8, 0, + TLS_MINOR_VER_THREE, (uint64_t)random(), &en); + ATF_REQUIRE_ERRNO(ENOTCONN, + setsockopt(s, IPPROTO_TCP, TCP_TXTLS_ENABLE, &en, sizeof(en)) != 0); + ATF_REQUIRE_ERRNO(EINVAL, + setsockopt(s, IPPROTO_TCP, TCP_RXTLS_ENABLE, &en, sizeof(en)) != 0); + ATF_REQUIRE(close(s) == 0); +} + ATF_TP_ADD_TCS(tp) { /* Transmit tests */ @@ -2792,6 +2837,7 @@ ATF_TP_ADD_TCS(tp) /* Miscellaneous */ ATF_TP_ADD_TC(tp, ktls_sendto_baddst); + ATF_TP_ADD_TC(tp, ktls_listening_socket); return (atf_no_error()); } From nobody Tue Mar 21 20:09:33 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph2kk0xJ3z40mtG; Tue, 21 Mar 2023 20:09: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 4Ph2kk0Rn1z42KK; Tue, 21 Mar 2023 20:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679429374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VUw3b2xt57JSS4MbAUnunWkY7H1yhylMTHUsnN3EJqw=; b=hWIDdLsmawN4izVTHazHOd+JVhNki/SP549+ADx+mgyCiNPcaXQsfFpbi2ThHDjaNW2FOA hrSaFN1paj/VFWqGdQkLKdhzSZTlb1DGhw7+etw8tZWuLNVIHvMmlsu+xSo2eKY7wBXtIP EssnrGnQXNiIJ2mbZg/brEl7SOUaiz8mDj2eYKv0Evwk8CCWq9DuVtYFjodpkpFLwLmWWY W594rWoE+Gkw4jV+DnaFLg5625H84q8Z+MJLyQGKEIA85QZJIoPIb3sNFjxtm67AmNdDNF 1cVPCHgFUBEWxrOwiN54AAaMN1Ci6e6ptoRlVU3yU3OqqJaFmcANi7Ox3cCLqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679429374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VUw3b2xt57JSS4MbAUnunWkY7H1yhylMTHUsnN3EJqw=; b=Q4sWR0qjtkILO1lqZzsoKQXBEcQtfgNttQXWuYMzLkAu51lJUWLnbf/xW+kgRpWn1sWfGn d7glaWarZW2uphaigmW40avzLYhROPfu/Go/OYb/hrWQK/dQQspQaf4v9f8fbH1+Em4ceE Ou5njjYlReXdJYL/Bf4TZrn/gXT+1lsjiemw+ioLyry4Ar8a/eI5eiZwAGRcUoo8Rjgl84 0bc1ZQexPVB3s4Ky41mAEQDlwjLvBE0obEPfdCV4d4ZQdP2S0uGorA0k2sUz74fDW6dTVz TMIeRPe56fZAJKuTj54t6rVOBEEg8hjDgt5vs1Be7YrmfpVIXJt9XUR66ruXqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679429374; a=rsa-sha256; cv=none; b=or8DMbM21gs0fnaalaMaTgh0o/toSZeoHx0ml2ixOaPfrjwCghIvuMZ5nvlNZ7SAZ041e4 WGwr/vUf5e2wXP8pezMRMgxuB0dJsb4rZzqOvvVKs+RDrFyIthkY+w8+IzpdTqw1zA4ysk 260EM7RA/jHHg+ro5jx+Rd8pkQqrfo1+IZtmGuLwLIEVeCWzNxpC8jTKrb9I7+VAnDqLaB G/K5Xwt3cm8Vz/1gIGkcLeqBMfpyu0102x+ceZu1ASzKO+ei9T7ClVW8tcZd6+yrf9I0hT yttBkPJafF+XTvDAIvPKL9xn41xO2/zKzeM/gLwfMs2m2nfRhoTMyMk5d7+Z6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph2kj6bLmzQML; Tue, 21 Mar 2023 20: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 32LK9XTB008676; Tue, 21 Mar 2023 20: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 32LK9XW8008675; Tue, 21 Mar 2023 20:09:33 GMT (envelope-from git) Date: Tue, 21 Mar 2023 20:09:33 GMT Message-Id: <202303212009.32LK9XW8008675@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: 899becbfcbf7 - main - tcp_wrappers: Use ANSI (c89) definitions for one more function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 899becbfcbf75008c560bae5e5fce0c205a5bc82 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=899becbfcbf75008c560bae5e5fce0c205a5bc82 commit 899becbfcbf75008c560bae5e5fce0c205a5bc82 Author: Ed Maste AuthorDate: 2023-03-21 20:05:57 +0000 Commit: Ed Maste CommitDate: 2023-03-21 20:09:13 +0000 tcp_wrappers: Use ANSI (c89) definitions for one more function Fixes: 14f102eacc84 ("tcp_wrappers: Use ANSI (c89) function definit...") Sponsored by: The FreeBSD Foundation --- contrib/tcp_wrappers/tli.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/tcp_wrappers/tli.c b/contrib/tcp_wrappers/tli.c index f362004f9f58..8ac967bb4e52 100644 --- a/contrib/tcp_wrappers/tli.c +++ b/contrib/tcp_wrappers/tli.c @@ -182,8 +182,7 @@ static void tli_endpoints(struct request_info *request) /* tli_transport - find out TLI transport type */ -static struct netconfig *tli_transport(fd) -int fd; +static struct netconfig *tli_transport(int fd) { struct stat from_client; struct stat from_config; From nobody Tue Mar 21 22:40:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph64J6203z40vyr; Tue, 21 Mar 2023 22:40: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 4Ph64J5HMsz4G3P; Tue, 21 Mar 2023 22:40:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679438400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zbE1GSx/p0G+LzjBQMJuoHcUz/XNkFM5kFfGtlqQ0Nw=; b=sxhr0pKuGEDaH/IQFjZggjH90nvG2ZJgGf1Yf0hSTG5E/fZ/T+Rzscb38Yh4OGBArwNyFb epSWn0i7atGhRwHI2T3PYL82kYyYoluRLpAtGlaUjZw1+zyWqfOSG84YzvSHYPrP2qfwNr 7qW7PwMLS1syvPP0EPTxOuAVoAlb0+lzLmmYkHZ9OYQ4xO+tu5Y1bP15Xpkvis4jSPAMNm +1N2ZFjN5xVuC7ciYDvMK7c960sKupK4ZNtU8Lqy8i4g3bA+NrFgKQTaEcVeKpbXltdgIb 8an4KsN138gl6HeZiTCjFBm1mTBNkI9pO1sKklaHNHQOsaRAAXGWH4sJRTSKDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679438400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zbE1GSx/p0G+LzjBQMJuoHcUz/XNkFM5kFfGtlqQ0Nw=; b=KCqatPlC4YtRwYfcJOPclK78Vi2mWpVRsGVwY5b6fd0p4DNKRWcJh5tYtUnX++LQHwUcaZ KRsHGGpC4OxsPVMaoMwBER3a+yA3qTO1SvK8/tgR0FEgrb35xzYEfITs2jJagPMhJqtSR5 yg3SWPbvtuQyeeFJSXNgGh02Pj0JRbfZ0TEHQmxusnTcJKYNiSWcRQJdu0s9xWkitpgX7r 71qpViyWhHfLZ8Y4gUfM/5Nv0XJvwq4gdUN65mBVb91FGP+r55YrQtn46Gm4TkQedTfr37 YyrgO/xiIyCmptHLrPtmLHyAxnfPbBue0QajqnZB0G7ltM5pMIferz+3I9TTGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679438400; a=rsa-sha256; cv=none; b=MZon/b+DLiP6sSN46iNElmf7uAw18C9v89aC9PlEhjNtZfKVCO9fEHDC6ReUumYhIaZ9Rx VtcBkfenzBaMH1ddyGOwFQKfY+aq2OAKjjf3cvULC/o/At1+0oKOEip1YFK14FPVrzP/0k QD971DhYgZw+EH2j9bA/A2/tfZzmLd8HbllNFq6368UwZ8Uh7y3nJ8hp2QRv9E4xqB30GM z8q9amj3HT8IkS7oju39nryiiXiPiS3s10G5+VJ8XpiN8OiZiPTOvvVsQoH0Hd9w10FOym S1zEq8a2st+s4kqx2/D95UAYvc8xOCwRr68QmLlHq3zs5NSMhqgCDA1hkqyLSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph64J4LTlzVQt; Tue, 21 Mar 2023 22: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 32LMe0g3054935; Tue, 21 Mar 2023 22: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 32LMe0Sv054914; Tue, 21 Mar 2023 22:40:00 GMT (envelope-from git) Date: Tue, 21 Mar 2023 22:40:00 GMT Message-Id: <202303212240.32LMe0Sv054914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 83df72e5fb25 - main - linuxkpi: Define `pat_enabled()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83df72e5fb253a8842693ae8135e42d0c2403540 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=83df72e5fb253a8842693ae8135e42d0c2403540 commit 83df72e5fb253a8842693ae8135e42d0c2403540 Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:45:24 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-21 22:36:40 +0000 linuxkpi: Define `pat_enabled()` This new header is included from because that's how it is included in Linux too. DRM drivers depend on this. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39052 --- sys/compat/linuxkpi/common/include/asm/memtype.h | 18 ++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/pci.h | 1 + 2 files changed, 19 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/memtype.h b/sys/compat/linuxkpi/common/include/asm/memtype.h new file mode 100644 index 000000000000..c433e54fd7bf --- /dev/null +++ b/sys/compat/linuxkpi/common/include/asm/memtype.h @@ -0,0 +1,18 @@ +/* Public domain. */ + +#ifndef _LINUXKPI_ASM_MEMTYPE_H_ +#define _LINUXKPI_ASM_MEMTYPE_H_ + +#if defined(__amd64__) || defined(__i386__) + +#include + +static inline bool +pat_enabled(void) +{ + return (boot_cpu_has(X86_FEATURE_PAT)); +} + +#endif + +#endif /* _LINUXKPI_ASM_MEMTYPE_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 2c222bf1cdbe..8077a75c4dd9 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include From nobody Tue Mar 21 23:27:36 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ph77D72H5z40ybx; Tue, 21 Mar 2023 23:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ph77D6W6Kz4KgN; Tue, 21 Mar 2023 23:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679441256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GtAeb+v5SromRsFY9B0eidETGtBsrJ54UPxilJvNwrs=; b=EAWLYhheP+ZWWDPqdDDJ+FvOgW43wl590gSk5aqd+qHV2zy1BR5CTC4bR2zHgBhf+guceE ECcahXbl1bGi8lTvViQlfF0RvXyrUDWKG6MR8cv5adNLBB2tMkxLOOolooWMISfi2Uqs9Z PRLtbtFvVV3jQek5WXIunA6DNz7SCUc1ViujlwCGDTdJv6iqywuXnluxa9LyBoUu7fn9Uj pMQqOQcCtP/Vwcyi3ZtuyNy84lXtYe4SXno60UWmX/mamzycuxQ3UgJiHzsSYJtvzbSzoF udUN/R7QTR+JMQYL4HmkCJApfC9znaD5YlMnTdg6zhzIRdsumo5kyB/aNepZLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679441256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GtAeb+v5SromRsFY9B0eidETGtBsrJ54UPxilJvNwrs=; b=bRJN8XE0sjgXStekF7fW3+EFVxwLu2CGwmArpzPDWSccEOtJkdKAISDPENeuBz3F0LbICP EbAmwFefIpqf+Xlnmv0ZPuE1bnolnJEzautPxDKDMo1BwXngJTtaA91FOurLLWXXN4tPVG I91xnggp6/ZlLT7WZ7fviw1wr5jLq5dl6TFq8YvcvPf3jm5n28373SDPIpuqRcrNrs+yEV i7mBTBvw+Zb55JxbPEtTrB2SvxKdHufL+JpkvbApU3WZVvkOu+FV+WptTaMuQpdRPE3rHe GVZWRg77OBIcFoBoTi3VS/+8DwHlfNQQ6sGnZQMNIjaqMXH1ybGFMcr1jNiQbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679441256; a=rsa-sha256; cv=none; b=OB8cMdXjnvrIN9UjyV2mRH1zKFyrTwWEgoRjx82+/VTc65YslqMn0fEqcFd5HHzyIk+UfJ LIGCq7xyzbIva4uSIY+h1ahC0jQlDsZIjPInq0IyGDWx/SQO5Lf0Qt6eNH4H347rXH4aY7 p34kPQw8tyhivyBcYloTNmnRjzSgN/0noc3KV/HMBkY2E0mrqeze2kjR0cjfKRQD5TtpOZ SEOaGbHmz42L7O9k8ahWZTmMLuyqdHdQ7JeD6Aw+8ypIgkbKZtYJAQBHHo+pt4Eqek45k6 gXz6ruvu6g3Zw31IJ0X7AKcpcV0LpJHgb9kb4w+ZDJcmjQRXLGgTZF9MWGcXJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ph77D5Z4czWpC; Tue, 21 Mar 2023 23:27: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 32LNRand035314; Tue, 21 Mar 2023 23:27:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32LNRa2N035313; Tue, 21 Mar 2023 23:27:36 GMT (envelope-from git) Date: Tue, 21 Mar 2023 23:27:36 GMT Message-Id: <202303212327.32LNRa2N035313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: e2a431a0ffb6 - main - netmap: fix copyin/copyout of nmreq options list List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2a431a0ffb6894220bdf5d8fc2ca2d0ca316e85 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=e2a431a0ffb6894220bdf5d8fc2ca2d0ca316e85 commit e2a431a0ffb6894220bdf5d8fc2ca2d0ca316e85 Author: Vincenzo Maffione AuthorDate: 2023-03-21 23:23:18 +0000 Commit: Vincenzo Maffione CommitDate: 2023-03-21 23:23:18 +0000 netmap: fix copyin/copyout of nmreq options list The previous code unsuccesfully attempted to report a precise error for each option in the user list. Moreover, commit 253b2ec199b broke some ctrl-api-test (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260547). With this patch we bail out as soon as an unrecoverable error is detected and we properly check for copy boundaries. EOPNOTSUPP no longer immediately returns an error, so that any other option in the list may be examined by the caller code and a precise report of the (un)supported options can be returned to the user. With this patch, all ctrl-api-test unit tests pass again. PR: 260547 Submitted by: giuseppe.lettieri@unipi.it Reviewed by: vmaffione MFC after: 14 days --- sys/dev/netmap/netmap.c | 69 ++++++++++++++++++++++++---------------- tests/sys/netmap/ctrl-api-test.c | 23 ++++++++++++-- 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index acc05513fbb2..392c00502699 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -3369,7 +3369,7 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) size_t rqsz, optsz, bufsz; int error = 0; char *ker = NULL, *p; - struct nmreq_option **next, *src, **opt_tab; + struct nmreq_option **next, *src, **opt_tab, *opt; uint64_t *ptrs; if (hdr->nr_reserved) { @@ -3420,24 +3420,36 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) *ptrs++ = hdr->nr_body; *ptrs++ = hdr->nr_options; p = (char *)ptrs; + /* overwrite the user pointer with the in-kernel one */ + hdr->nr_body = (uintptr_t)p; + /* prepare the options-list pointers and temporarily terminate + * the in-kernel list, in case we have to jump to out_restore + */ + next = (struct nmreq_option **)&hdr->nr_options; + src = *next; + hdr->nr_options = 0; /* copy the body */ - error = copyin((void *)(uintptr_t)hdr->nr_body, p, rqsz); + error = copyin(*(void **)ker, p, rqsz); if (error) goto out_restore; - /* overwrite the user pointer with the in-kernel one */ - hdr->nr_body = (uintptr_t)p; p += rqsz; /* start of the options table */ opt_tab = (struct nmreq_option **)p; p += sizeof(opt_tab) * NETMAP_REQ_OPT_MAX; /* copy the options */ - next = (struct nmreq_option **)&hdr->nr_options; - src = *next; while (src) { - struct nmreq_option *opt; + struct nmreq_option *nsrc; + if (p - ker + sizeof(uint64_t*) + sizeof(*src) > bufsz) { + error = EMSGSIZE; + /* there might be a loop in the list: don't try to + * copyout the options + */ + hdr->nr_options = 0; + goto out_restore; + } /* copy the option header */ ptrs = (uint64_t *)p; opt = (struct nmreq_option *)(ptrs + 1); @@ -3445,15 +3457,19 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) if (error) goto out_restore; rqsz += sizeof(*src); + p = (char *)(opt + 1); + /* make a copy of the user next pointer */ *ptrs = opt->nro_next; - /* overwrite the user pointer with the in-kernel one */ + /* append the option to the in-kernel list */ *next = opt; - - /* initialize the option as not supported. - * Recognized options will update this field. + /* temporarily teminate the in-kernel list, in case we have to + * jump to out_restore */ - opt->nro_status = EOPNOTSUPP; + nsrc = (struct nmreq_option *)opt->nro_next; + opt->nro_next = 0; + + opt->nro_status = 0; /* check for invalid types */ if (opt->nro_reqtype < 1) { @@ -3461,12 +3477,11 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) nm_prinf("invalid option type: %u", opt->nro_reqtype); opt->nro_status = EINVAL; error = EINVAL; - goto next; + goto out_restore; } if (opt->nro_reqtype >= NETMAP_REQ_OPT_MAX) { - /* opt->nro_status is already EOPNOTSUPP */ - error = EOPNOTSUPP; + /* opt->nro_status will be set to EOPNOTSUPP */ goto next; } @@ -3479,12 +3494,10 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) opt->nro_status = EINVAL; opt_tab[opt->nro_reqtype]->nro_status = EINVAL; error = EINVAL; - goto next; + goto out_restore; } opt_tab[opt->nro_reqtype] = opt; - p = (char *)(opt + 1); - /* copy the option body */ optsz = nmreq_opt_size_by_type(opt->nro_reqtype, opt->nro_size); @@ -3507,18 +3520,20 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) next: /* move to next option */ next = (struct nmreq_option **)&opt->nro_next; - src = *next; + src = nsrc; } - if (error) - nmreq_copyout(hdr, error); - return error; + + /* initialize all the options as not supported. Recognized options + * will update their field. + */ + for (src = (struct nmreq_option *)hdr->nr_options; src; + src = (struct nmreq_option *)src->nro_next) { + src->nro_status = EOPNOTSUPP; + } + return 0; out_restore: - ptrs = (uint64_t *)ker; - hdr->nr_body = *ptrs++; - hdr->nr_options = *ptrs++; - hdr->nr_reserved = 0; - nm_os_free(ker); + nmreq_copyout(hdr, error); out_err: return error; } diff --git a/tests/sys/netmap/ctrl-api-test.c b/tests/sys/netmap/ctrl-api-test.c index 8c87760217c3..c143d14ae3ab 100644 --- a/tests/sys/netmap/ctrl-api-test.c +++ b/tests/sys/netmap/ctrl-api-test.c @@ -1012,9 +1012,10 @@ infinite_options(struct TestContext *ctx) { struct nmreq_option opt; - printf("Testing infinite list of options on %s\n", ctx->ifname_ext); + printf("Testing infinite list of options on %s (invalid options)\n", ctx->ifname_ext); - opt.nro_reqtype = 1234; + memset(&opt, 0, sizeof(opt)); + opt.nro_reqtype = NETMAP_REQ_OPT_MAX + 1; push_option(&opt, ctx); opt.nro_next = (uintptr_t)&opt; if (port_register_hwall(ctx) >= 0) @@ -1023,6 +1024,23 @@ infinite_options(struct TestContext *ctx) return (errno == EMSGSIZE ? 0 : -1); } +static int +infinite_options2(struct TestContext *ctx) +{ + struct nmreq_option opt; + + printf("Testing infinite list of options on %s (valid options)\n", ctx->ifname_ext); + + memset(&opt, 0, sizeof(opt)); + opt.nro_reqtype = NETMAP_REQ_OPT_OFFSETS; + push_option(&opt, ctx); + opt.nro_next = (uintptr_t)&opt; + if (port_register_hwall(ctx) >= 0) + return -1; + clear_options(ctx); + return (errno == EINVAL ? 0 : -1); +} + #ifdef CONFIG_NETMAP_EXTMEM int change_param(const char *pname, unsigned long newv, unsigned long *poldv) @@ -2049,6 +2067,7 @@ static struct mytest tests[] = { decltest(vale_polling_enable_disable), decltest(unsupported_option), decltest(infinite_options), + decltest(infinite_options2), #ifdef CONFIG_NETMAP_EXTMEM decltest(extmem_option), decltest(bad_extmem_option), From nobody Wed Mar 22 02:07:02 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhBgB3HsQz417pV; Wed, 22 Mar 2023 02: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 4PhBgB2T0pz3Ltj; Wed, 22 Mar 2023 02:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679450822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dh8uKN1YQ6yqbh1NRFlnll9/j8fl4JjHcBlXnlIhF/g=; b=oncd4NG+dIq/Ois3JvJIxxnhS5Wr0WYT4P4lTTpOPaL6kYhKxcsOj0OhFksU35WYBHAd43 SoIFMNFUmVW+eNhVOlY3+m1ug4U5XzVOKyBcGRdJA5mqD+C7HuLE/vs5KGKSCXVMJmQr5C Rsesa7WvYfeqC1vhljpbBUBQkaKnUQlksrWYUYwyQgT0wXZDLvEeRNsitkYrjtFwysbalo 3LYqDIKGGJB7fc6hdyCySoW9ko3HpsQNBIweLEEtlWx9TPax9/YFFSbQ6zHgvPEM6jaRIQ m66ufeeUhfY2TLyL5Tm5MLLGR8tVJ6mpLNvjUxrWa505is9dRteNSg/ekK2jWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679450822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dh8uKN1YQ6yqbh1NRFlnll9/j8fl4JjHcBlXnlIhF/g=; b=mkpnTwIyuzUSEaD89KU1kVGYUrNKv439B7LPEKYfl1QeGrK8AVyAbEoTpPB+SxNNY6d/Hd u4CgzsEh8+AotTan9bFpedqPE/EC8M3XEFXKhk6GtO53EtdJHoPcKQ7NfzXu2gqAFdAOJo nZES5W1bWSg//aqdZdw+bwLxspT5WIGRPYehyonU4OEGWyzOcygqoCbqVSq+Fg6hLp05Nr sG3I1YzOisvheKKmKYwKTXRc6Krl0cf5uFir7l/pFNg1ydc07ABfJm6z6a2MUQHvivqDKW 0NDn6dF0glwS426muUymd0kRTdCFrcsGdeaRy/TomVTGZ7DMeX2B6PQ3bpXQ3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679450822; a=rsa-sha256; cv=none; b=dZ6cSwH8Kenz+gWL/oUxgY8RWXCSH/lNPskQlY72QKaTqojUcBYq8nfDnne9taHQpg0YbJ ePAdz0a6jE/6PZnTRVOENfaBs8BXldPhPEJ0q5sNNGAT3DEw/bCgMlw7cYZJX5Z7xamQ6x uVxS8c0DSHbn2TTPn+L1lC9CjRDN1FT9sY8L1vndNRY99xJlBek6kUbiQj1m4HmTvJaymc nMq9RNo6UE34s36fWXmbTTyKKZTjXkRaByPb0Wo2ZEodRRKFCe+6pDDy8BDjAUPl90KvL2 d8aG9wUAqF7aRFzLwN61IgxKElUV2PFVZBknH89Wc87MQfEgDIKTuQYYcEYTlA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhBgB1Y1RzbY5; Wed, 22 Mar 2023 02: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 32M272jn097299; Wed, 22 Mar 2023 02: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 32M272WZ097298; Wed, 22 Mar 2023 02:07:02 GMT (envelope-from git) Date: Wed, 22 Mar 2023 02:07:02 GMT Message-Id: <202303220207.32M272WZ097298@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: 1ad3cafcd34e - main - Remove /usr/lib/dtrace/ipfw.d for WITHOUT_DTRACE. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ad3cafcd34eaf65f002c0c5242374a61d4a9b54 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad3cafcd34eaf65f002c0c5242374a61d4a9b54 commit 1ad3cafcd34eaf65f002c0c5242374a61d4a9b54 Author: John Baldwin AuthorDate: 2023-03-22 02:06:40 +0000 Commit: John Baldwin CommitDate: 2023-03-22 02:06:40 +0000 Remove /usr/lib/dtrace/ipfw.d for WITHOUT_DTRACE. Reviewed by: brooks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D39099 --- tools/build/mk/OptionalObsoleteFiles.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 49a01a156eec..3fff008422a1 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -883,6 +883,7 @@ OLD_FILES+=usr/lib/dtrace/drti.o OLD_FILES+=usr/lib/dtrace/errno.d OLD_FILES+=usr/lib/dtrace/io.d OLD_FILES+=usr/lib/dtrace/ip.d +OLD_FILES+=usr/lib/dtrace/ipfw.d OLD_FILES+=usr/lib/dtrace/mbuf.d OLD_FILES+=usr/lib/dtrace/psinfo.d .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" From nobody Wed Mar 22 02:26:21 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhC5T4xBMz418pV; Wed, 22 Mar 2023 02:26: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 4PhC5T4S7cz3P5q; Wed, 22 Mar 2023 02:26:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679451981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oHtcqtMOC/LSCt5ocDsvhDs6Kt5ODdkCg4FrjkUZWi8=; b=KCzzloBSJ1PpQcY/JVZaUZhZRjZ9aXpaExZdWoTUA3LqhK+mCoQT+7hqLzHkZCUmUT7WBj lZwUmpwogEZNXYr+UqRVhrWHDsDXyj3iHXstNGkQIpRd9ks/yGSqbqZ6W15K1dIgw/u5dq algAF+zipP4cc1ctpOVgRHOmVqws5EtfXsAmVXeQopZsg4wFf0mcq/kSL2CAzidUaYgncu rg5liQg9PYCZShD5XCPQxJgb6cPWnDh4N3qLqbqg+GjI8o/cFEdMqfOcGKO94fxtfsQCZr SZ6AE2XVz0fFPN6jaA4tjjbiOeI0DHECyg3cqDvw59eNDHEyN3cwL+EHMZ3t0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679451981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oHtcqtMOC/LSCt5ocDsvhDs6Kt5ODdkCg4FrjkUZWi8=; b=RhwsXghWntXE92AF5mEUYiEbkDyRZxG0H+GP9pPE0GhADp81FIlBn+tY3qjS+5lXJ3H0dV Kn9HBT73+hJ6ilQHQc8nm2v1LLBSczXJM9hn95FgcWuVZjkjxNNVN/AfqbgV2V4KN5TCeL IqJnFiOEQZEy+MQiivj0ow+ntDJqkN/TkIruw0Jh+H5i3JKfUvfD5oVTk1XCiqNt/QwD/X ygg66NB9kBORqTmMyVvDdP+ZVxiaXALzbCeSfE8SntdfcSsJbLj9MHrR1qe6zSZRPtq8g4 aqyEDJZ6d/xW0K5rm6eSQUexIHZidKZEOtOFMoNs9z+v7f2LTJMj3vnLs/6vLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679451981; a=rsa-sha256; cv=none; b=GlCL0xJ4Ji2Y1gLB7fkXHKDsc8GOyrmHjfiFGooEcZMHm24M1MkcmxC6j7gaR21RMkboB5 QPAmiXPcs6Zaic3/X4cSoCxMn7fTVa+X0fk+uaHvzpQBAViBx3b4l9WL5jbPeQKSUQ6YZV DhdVd66lHm9+8rqgEqmTGloAsQdaNC7ixSudYqim27pRGnyuCysFN32HeNsReD7baUULPJ LtCIH9oK69qm5xJkBPBUN8gIRIQCPQUVPmbwGC8FgbbkuKOJm+Xvkunf89sSWjDET5G4sI vx2bemGoXKJDi2u8IXsuL8/i9O3NoQN+5+EryVmXnpnyZ8ytw4v1JiSgysh84Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhC5T3Vh3zc1q; Wed, 22 Mar 2023 02:26: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 32M2QLlB029464; Wed, 22 Mar 2023 02:26:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32M2QLoe029463; Wed, 22 Mar 2023 02:26:21 GMT (envelope-from git) Date: Wed, 22 Mar 2023 02:26:21 GMT Message-Id: <202303220226.32M2QLoe029463@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: ed52baf51bd1 - main - _endian.h: Include sys/ctypes.h for visibility macros List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed52baf51bd142b5e32701842346452a7ebe37a5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ed52baf51bd142b5e32701842346452a7ebe37a5 commit ed52baf51bd142b5e32701842346452a7ebe37a5 Author: Warner Losh AuthorDate: 2023-03-22 02:25:58 +0000 Commit: Warner Losh CommitDate: 2023-03-22 02:25:58 +0000 _endian.h: Include sys/ctypes.h for visibility macros BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the forthcoming POSIX Issue 8. In addition, they are provided in the BSD compilation environments. However, depending on the order includes happend, sys/cdefs.h may or may not be included when endian.h is included. Include it here so we can safely test __BSD_VISIBLE. Add visibility when we're compiling in the future for issue 8, but since the date number for issue 8 hasn't been fixed, use strictly greater than the issue 7 date.of 200809. This had the side effect of sometimes (in the traditional BSD compliation environment) #if BYTE_ORDER == LITTLE_ENDIAN and #if BYTE_ORDER == BIG_ENDIAN both being true because none of these were defined. This fixes that. It also fixes including it after but not before. PR: 269249 MFC After: 1d (build related) Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D39176 Sponsored by: Netflix --- sys/sys/_endian.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h index 7ac39386e2e1..3b4460472eb6 100644 --- a/sys/sys/_endian.h +++ b/sys/sys/_endian.h @@ -36,6 +36,8 @@ #error "sys/_endian.h should not be included directly" #endif +#include /* visibility macros */ + /* BSD Compatiblity */ #define _BYTE_ORDER __BYTE_ORDER__ @@ -66,10 +68,11 @@ #endif /* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. + * POSIX Issue 8 will require these for endian.h. Define them there and in the + * traditional BSD compilation environment. Since issue 8 doesn't yet have an + * assigned date, use strictly greater than issue 7's date. */ -#if __BSD_VISIBLE +#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 #define LITTLE_ENDIAN _LITTLE_ENDIAN #define BIG_ENDIAN _BIG_ENDIAN #define PDP_ENDIAN _PDP_ENDIAN From nobody Wed Mar 22 03:07:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhD1c1D3Cz41Bm6 for ; Wed, 22 Mar 2023 03:08:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 4PhD1b651vz3Qqc for ; Wed, 22 Mar 2023 03:08:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x529.google.com with SMTP id r11so67522487edd.5 for ; Tue, 21 Mar 2023 20:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1679454482; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aSB1B+zstIiS2gxLqI3xS8smd4Xg1v8RWZ13492cpiw=; b=e5N7dc5+cTtTMTq7tYeeRUJ47iBg0C/AsdU9gjJXg8QoFj5JqEao7RzixJtppALz22 6SDELCEXh0l68eVOjrHvoNx+d16i6ZLLSLisbfl9lScddccZi468sSsKiVoZKoO7pAMD lWP92iZ3Lf8NOhFjmFtey5H+NI2aOd+jKkId0AvLBZVljX+wgZA8xiEcLOVwB5YNea0Y 4tCisK/MRipGhP0tjfhzPa1XdAW5+8keemhqyjzHk9w78PGx0pJNvVpj1L/+OFzXv8XG 6A2qqKnEKwle1aqBax/94bPvjya+lgkSci3pZumtzWkFOrqinniysYmA9opjMw6ieB6s DgyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679454482; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aSB1B+zstIiS2gxLqI3xS8smd4Xg1v8RWZ13492cpiw=; b=ZhFxQdEZs1+1JG7EIFJDG+gdL8ZPZvpKmCaKh+n8XiOalPY7vx/8x7J+tm8+0EUfq9 MXsFVfP4C/y4xv0STvyCMI42skJgDDSE7Em8CW/HpijVNx/dmEcN9PDyPuUq5/7Elmy6 EHnvQNrXkaFX4xC46Ww4xAkTI8+Syo+f+IvnXHrCL7uiGMJacOTjOgkFpYxySQwg8ftF MIFQxhHIw4LmnnvLSzHbz2mgXyEsT1dXN7nfx9pDHnRpwD8/FjAs/jUi4aw1v067vPc+ faRlW2Zat4oU4gydJAtSoraaUKWHLEfH3OmUKLP3ntCbzZPGxXdi41ZE1XKDBiIu3htP RmVA== X-Gm-Message-State: AO0yUKWc+95e0yBwBtses8yOmiuTQiw+hNbovYrUlhRy3z7E+ImPu3ov OA7ZbNUsv0RSTRA06ckwjobeT4pG2L4ev6CZhmgdU3WWnLbmXDbrCAQ= X-Google-Smtp-Source: AK7set84Z4G8Hx+98lwy/7kDljdbWNbSKCjjij0inylYON69gkTBez/eXrQ7YwhRCq/VBmXdSdmum/0/ML1wYhGHzHc= X-Received: by 2002:a17:906:c413:b0:92f:7c42:863d with SMTP id u19-20020a170906c41300b0092f7c42863dmr2332973ejz.2.1679454481938; Tue, 21 Mar 2023 20:08:01 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> In-Reply-To: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> From: Warner Losh Date: Wed, 22 Mar 2023 04:07:50 +0100 Message-ID: Subject: Re: git: ed52baf51bd1 - main - _endian.h: Include sys/ctypes.h for visibility macros To: Warner Losh Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000d00d4605f7747732" X-Rspamd-Queue-Id: 4PhD1b651vz3Qqc X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --000000000000d00d4605f7747732 Content-Type: text/plain; charset="UTF-8" Doh. Should have changed ctypes.h to cdefs.h, but rushed a bit and forgot. Warner On Wed, Mar 22, 2023, 3:26 AM Warner Losh wrote: > The branch main has been updated by imp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=ed52baf51bd142b5e32701842346452a7ebe37a5 > > commit ed52baf51bd142b5e32701842346452a7ebe37a5 > Author: Warner Losh > AuthorDate: 2023-03-22 02:25:58 +0000 > Commit: Warner Losh > CommitDate: 2023-03-22 02:25:58 +0000 > > _endian.h: Include sys/ctypes.h for visibility macros > > BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the > forthcoming POSIX Issue 8. In addition, they are provided in the BSD > compilation environments. However, depending on the order includes > happend, sys/cdefs.h may or may not be included when endian.h is > included. Include it here so we can safely test __BSD_VISIBLE. Add > visibility when we're compiling in the future for issue 8, but since > the > date number for issue 8 hasn't been fixed, use strictly greater than > the > issue 7 date.of 200809. > > This had the side effect of sometimes (in the traditional BSD > compliation environment) > #if BYTE_ORDER == LITTLE_ENDIAN > and > #if BYTE_ORDER == BIG_ENDIAN > both being true because none of these were defined. This fixes > that. It also fixes including it after but not before. > > PR: 269249 > MFC After: 1d (build related) > Reviewed by: kib, emaste > Differential Revision: https://reviews.freebsd.org/D39176 > > Sponsored by: Netflix > --- > sys/sys/_endian.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h > index 7ac39386e2e1..3b4460472eb6 100644 > --- a/sys/sys/_endian.h > +++ b/sys/sys/_endian.h > @@ -36,6 +36,8 @@ > #error "sys/_endian.h should not be included directly" > #endif > > +#include /* visibility macros */ > + > /* BSD Compatiblity */ > #define _BYTE_ORDER __BYTE_ORDER__ > > @@ -66,10 +68,11 @@ > #endif > > /* > - * Deprecated variants that don't have enough underscores to be useful in > more > - * strict namespaces. > + * POSIX Issue 8 will require these for endian.h. Define them there and > in the > + * traditional BSD compilation environment. Since issue 8 doesn't yet > have an > + * assigned date, use strictly greater than issue 7's date. > */ > -#if __BSD_VISIBLE > +#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 > #define LITTLE_ENDIAN _LITTLE_ENDIAN > #define BIG_ENDIAN _BIG_ENDIAN > #define PDP_ENDIAN _PDP_ENDIAN > --000000000000d00d4605f7747732 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Doh. Should have changed ctypes.h to cdefs.h, but rushed = a bit and forgot.

Warner=C2=A0=

On Wed, Mar 22, 2023, 3:26 AM Warner Losh <imp@freebsd.org> wrote:
The branch main has been updated by imp:

URL: ht= tps://cgit.FreeBSD.org/src/commit/?id=3Ded52baf51bd142b5e32701842346452a7eb= e37a5

commit ed52baf51bd142b5e32701842346452a7ebe37a5
Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-03-22 02:25:58 +0000
Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-03-22 02:25:58 +0000

=C2=A0 =C2=A0 _endian.h: Include sys/ctypes.h for visibility macros

=C2=A0 =C2=A0 BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by = the
=C2=A0 =C2=A0 forthcoming POSIX Issue 8. In addition, they are provided in = the BSD
=C2=A0 =C2=A0 compilation environments. However, depending on the order inc= ludes
=C2=A0 =C2=A0 happend, sys/cdefs.h may or may not be included when endian.h= is
=C2=A0 =C2=A0 included. Include it here so we can safely test __BSD_VISIBLE= .=C2=A0 Add
=C2=A0 =C2=A0 visibility when we're compiling in the future for issue 8= , but since the
=C2=A0 =C2=A0 date number for issue 8 hasn't been fixed, use strictly g= reater than the
=C2=A0 =C2=A0 issue 7 date.of 200809.

=C2=A0 =C2=A0 This had the side effect of sometimes (in the traditional BSD=
=C2=A0 =C2=A0 compliation environment)
=C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D LITTLE_ENDIAN
=C2=A0 =C2=A0 and
=C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D BIG_ENDIAN
=C2=A0 =C2=A0 both being true because none of these were defined. This fixe= s
=C2=A0 =C2=A0 that. It also fixes including it after <stdio.h> but no= t before.

=C2=A0 =C2=A0 PR:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0269249
=C2=A0 =C2=A0 MFC After:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1d= (build related)
=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kib, em= aste
=C2=A0 =C2=A0 Differential Revision:=C2=A0 https://revi= ews.freebsd.org/D39176

=C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Netflix=
---
=C2=A0sys/sys/_endian.h | 9 ++++++---
=C2=A01 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h
index 7ac39386e2e1..3b4460472eb6 100644
--- a/sys/sys/_endian.h
+++ b/sys/sys/_endian.h
@@ -36,6 +36,8 @@
=C2=A0#error "sys/_endian.h should not be included directly"
=C2=A0#endif

+#include <sys/cdefs.h>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* visibility macros */
+
=C2=A0/* BSD Compatiblity */
=C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _BYTE_ORDER=C2=A0 =C2=A0 =C2=A0__B= YTE_ORDER__

@@ -66,10 +68,11 @@
=C2=A0#endif

=C2=A0/*
- * Deprecated variants that don't have enough underscores to be useful= in more
- * strict namespaces.
+ * POSIX Issue 8 will require these for endian.h. Define them there and in= the
+ * traditional BSD compilation environment. Since issue 8 doesn't yet = have an
+ * assigned date, use strictly greater than issue 7's date.
=C2=A0 */
-#if __BSD_VISIBLE
+#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809
=C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 LITTLE_ENDIAN=C2=A0 =C2=A0_LITTLE_= ENDIAN
=C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 BIG_ENDIAN=C2=A0 =C2=A0 =C2=A0 _BI= G_ENDIAN
=C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 PDP_ENDIAN=C2=A0 =C2=A0 =C2=A0 _PD= P_ENDIAN
--000000000000d00d4605f7747732-- From nobody Wed Mar 22 09:06:19 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhMyz4fW0z40KsQ; Wed, 22 Mar 2023 09:06: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 4PhMyz496hz4Dfw; Wed, 22 Mar 2023 09:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679475979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0l2jZ8ps0bQmLWhd4qOHgapi37EMoi8lZ1iQz29AwZQ=; b=c/jqnk8N3s8ic3rTPwH6xmzKXHCx/yZxMp0p5dyliLPI+/wJ5als/iOxVlRJQDTnogrrW5 DEeBjWaHc/2Z4+2u/qw4KspiIKm5HzpJzIZbGFYIp28ispM4Vl9/aF2nlGB5oTFVYVzpWC m0sJlZ+ryA5R82wvvbS3xmfnz82brpcK6I8GLXUDfLpGGIMrK3dPKmtTb8HtswjqA26q9L hMP1DEFg4S1fIpNdt9TmINVq/gNxFRKRqUyvuVnFcU/Pk0n0HubhDHQ/vIZIMaUs+iDODR dV33+ZGlhzpexCqiL0QTXKneqAaVcFW8MwYm0v+VU/x/QfohWLEc1qQMCzWDxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679475979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0l2jZ8ps0bQmLWhd4qOHgapi37EMoi8lZ1iQz29AwZQ=; b=a2AyQuKyiSgY4L3ooaDZNfn5ClaDMhir/O0mQPSbwC/VeMInHhe1d5zZk7JMiaCKuq9CCT n80WkZBnXCRmcew43JiqRvOhddoRRJKJluPajOtE2rkhAsXlPMYcr5PrAIU3Hsiyxrn7gu F8pJopdc0nhJ18XrvJ6Gn5+g3w6Hfsd9snfZE2iu4VPmnNf1e+P/8ZeCunCTjVhchKf1bc 8TL5mgBVSVpjqNDn3B6K//y31mshoSwCkHSEzMb5VMIjWn64Z3CI6tUqkMPDkeBEU6mIZE j4tQxjNXvjszRsmuZ6e1lN8cGlo3w/HZ90n2XnlcSDQYge2VAjVY0YyJznuYFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679475979; a=rsa-sha256; cv=none; b=NL+1Tu0MT4wD0Q/ynQh7ZMaqzYwucXo/3fIOSVt0kEjaHvWdS692kUFzGrMQq6zB6zzxAF ViAwtQLyB1cCFgdO/Ytd+i0QtpRwPtQvEwjncDNhMREuXHOvzNKRY6JBWNcsmqgE7I3BdD KoIT/2LC50SsDk4O61Q83A1z8FkOjoWchFxmJDTAnGytWeU20vV89Pa712P21rFVNyI077 ZnPZxpHXtqsG/TBq3ccV045A2TSbmPRy33Now3jGtf+H8g6EYYDD8rRDFvWZ9tUierab8j 6cx4ESmw9Fx1HEcHowmqpK0eIWSvC292Eb+/Cae+dPUV4GJlyXBsQ8kUrGpV4g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhMyz3CP3znw5; Wed, 22 Mar 2023 09:06: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 32M96Jek086653; Wed, 22 Mar 2023 09:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32M96Jcm086652; Wed, 22 Mar 2023 09:06:19 GMT (envelope-from git) Date: Wed, 22 Mar 2023 09:06:19 GMT Message-Id: <202303220906.32M96Jcm086652@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: e689e7facd8d - main - stress2: Fix compiler warning List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e689e7facd8daac745a7954f4b405e680229de7d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=e689e7facd8daac745a7954f4b405e680229de7d commit e689e7facd8daac745a7954f4b405e680229de7d Author: Peter Holm AuthorDate: 2023-03-22 09:05:04 +0000 Commit: Peter Holm CommitDate: 2023-03-22 09:05:04 +0000 stress2: Fix compiler warning --- tools/test/stress2/misc/syscall4.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/stress2/misc/syscall4.sh b/tools/test/stress2/misc/syscall4.sh index ce7e99dcde54..3937d45c0303 100755 --- a/tools/test/stress2/misc/syscall4.sh +++ b/tools/test/stress2/misc/syscall4.sh @@ -260,7 +260,7 @@ static void * calls(void *arg __unused) { time_t start; - int i, j, num; + int i __unused, j, num; unsigned long arg1, arg2, arg3, arg4, arg5, arg6, arg7; #ifdef __NP__ From nobody Wed Mar 22 09:06:20 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhMz05MhBz40KWY; Wed, 22 Mar 2023 09:06: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 4PhMz04xG9z4Dpb; Wed, 22 Mar 2023 09:06:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679475980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z086XwGgDIOY8TnMUcLjr31Gl7Y3aTQw9A/TqN6rQ8c=; b=f7eBkmiZ4ndDds8ICyJjvHgwsTgkAjmvPm7CAtznAH3Z0VZRFRVA/hOwFd1GJ1RyowW7ni m1Ew95y11P83KE6fmfqytNMRYM6R0rYJ/05eZhYBmEPnp0WZ+enExxB4A0CfMVgGxtZzBR f/V99F3VpXoID6gAiR6b7Uf61jYolqXGuChHDI5zqR9pw1+HxlhMdLWjVauMkxz1NwcOhR GyY37nIjKQ9+HJqSJNBkEapFtHVP66+UGSrj/ndiAw91eiW0ghHDR8bhlx83Z36Hy5fhr/ /6oUwl4/BC1Cr7z1/GPCbJM4D+4mbF5pyhPznRgmRdIr46MrnA1JrokhnIkRUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679475980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z086XwGgDIOY8TnMUcLjr31Gl7Y3aTQw9A/TqN6rQ8c=; b=K58DFAqpAjbLzCUEN+MEo6lavfsHRcVj4ln7l70esq/HVJbE3AuMaHrbpcqmxlWLZWdihq wsAlklwO7g/XcsElr1pm9Dx8AciDEgrsOye2MISHenZQAFpqJ/zroZrm5NxsWJe98afo/c qgPYa8f7qgw38EyEkj12xg6ZvULwCACIquYK7rYAVwNqxuVT7RpWylWGoldAPgP3tmsjoz PnsdLlHfzA59HSqQAr/vJ/jg37tTbqo8ynxTZ5/jZBcfKwy3tNoZv3lfebTNdAPdKDcIIq q1mCVvmiFFnreA5eHlhpaDhL4EkKOQSHqEOR8axWLCW5/tTmiRK1dYRA8d5Nxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679475980; a=rsa-sha256; cv=none; b=vM9OzchgVNjlBYV6DmRCsLgc1boZ69mrcSXEhaRb2SVMkj//VMVjL2PqqsY+Ab8mQM/t5o fJoXZoSAP/Zt2Keuvp5JdvMlniblTmwFJXBiwhLV7In0KNkjob6UyNvn6LvZJQDhw2F8PW AViL0J1UvueJtBAEynyN3I9Of3Y46cEf3p0iHEvlPpyZF80VqGX7vblsDLtNlJ1ULvjs0u vQ1zczS2XVt4jLjXAEArbwHPphxJ15LCvSfuz37v1Ac9aAJgeTiBTdxCL072uGXIrHJVn1 0Xo9fwN5cpQABNKO5waGofPuMTL6kYuAHFnwGtRKX9GG9hx/iPpqHrVN8xUHqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhMz043N2znJd; Wed, 22 Mar 2023 09:06: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 32M96Kk1086672; Wed, 22 Mar 2023 09:06:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32M96K3G086671; Wed, 22 Mar 2023 09:06:20 GMT (envelope-from git) Date: Wed, 22 Mar 2023 09:06:20 GMT Message-Id: <202303220906.32M96K3G086671@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: bb1f64b200b5 - main - stress2: Fix syntax error. Remove redundant backup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: bb1f64b200b59672059088c0ed369b3225f2632e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=bb1f64b200b59672059088c0ed369b3225f2632e commit bb1f64b200b59672059088c0ed369b3225f2632e Author: Peter Holm AuthorDate: 2023-03-22 09:05:46 +0000 Commit: Peter Holm CommitDate: 2023-03-22 09:05:46 +0000 stress2: Fix syntax error. Remove redundant backup --- tools/test/stress2/misc/fsck11.sh | 4 ++-- tools/test/stress2/misc/fsck12.sh | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/test/stress2/misc/fsck11.sh b/tools/test/stress2/misc/fsck11.sh index cb5d1d256be6..8019cc1f2656 100755 --- a/tools/test/stress2/misc/fsck11.sh +++ b/tools/test/stress2/misc/fsck11.sh @@ -56,7 +56,7 @@ reruns=0 newfs_flags=$(echo "" "-U" "-O1" | awk -v N=`jot -r 1 1 3` '{print $N}') [ $# -eq 1 ] && newfs_flags="$1" # or use script argument max=$((2 * 1024 * 1024)) -[ "$newfs_flags" == "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file +[ "$newfs_flags" = "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 [ -c /dev/md$u1 ] && mdconfig -d -u $u1 @@ -135,7 +135,7 @@ while [ $((`date +%s` - start)) -lt 300 ]; do fsync $backup sync; sleep 1 - [ $newfs_flags == "-j" ] && + [ "$newfs_flags" = "-j" ] && fsck -fy $diskimage > $log 2>&1 # process the journal file for i in `jot 5`; do [ $i -gt 2 ] && echo "fsck run #$i" diff --git a/tools/test/stress2/misc/fsck12.sh b/tools/test/stress2/misc/fsck12.sh index d2787e962927..da4629991705 100755 --- a/tools/test/stress2/misc/fsck12.sh +++ b/tools/test/stress2/misc/fsck12.sh @@ -60,7 +60,7 @@ mount /dev/md$u1 $mp1 newfs_flags='-j' [ $# -eq 1 ] && newfs_flags="$1" # or use script argument max=$((2 * 1024 * 1024)) -[ "$newfs_flags" == "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file +[ "$newfs_flags" = "-j" ] && max=$((20 * 1024 * 1024)) # Make room for the journal file [ -c /dev/md$u2 ] && mdconfig -d -u $u2 dd if=/dev/zero of=$diskimage bs=$max count=1 status=none @@ -141,7 +141,7 @@ while [ $((`date +%s` - start)) -lt 300 ]; do fsync $backup sync; sleep 1 - [ $newfs_flags == "-j" ] && + [ $newfs_flags = "-j" ] && fsck -fy $diskimage > $log 2>&1 # process the journal file for i in `jot 5`; do [ $i -gt 2 ] && echo "fsck run #$i" @@ -150,9 +150,7 @@ while [ $((`date +%s` - start)) -lt 300 ]; do grep -q "MODIFIED" $log && continue # For now, do not trust CLEAN [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } if [ -f fsck_ffs.core ]; then - tstamp=`date +%Y%m%dT%H%M%S` - gzip < $backup > /tmp/fsck_ffs.core.diskimage.$tstamp.gz - gzip < fsck_ffs.core > /tmp/fsck_ffs.core.$tstamp.gz + s=1 break 2 fi done From nobody Wed Mar 22 13:12:56 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhTRX3G2zz40ps5; Wed, 22 Mar 2023 13:12: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 4PhTRX2dcsz4V06; Wed, 22 Mar 2023 13:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679490776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLsV8N84YKa9u19MccWEBEZ2Ba6p9AtPJwPhhgHHvP8=; b=pOZTxMgQrxz6QCNmDIWuPPTdOwGCr+RUjSWsvJ7m5JJ353wdG2zFjyjschsQuYi7wCEa0w rLrG/nkK/G+yrQp6nh+wleAbhgD49CTzg4Mqni1etJmjcU1dMtX4GdXspDy5ivMdB1E1E6 jDU97cQ633r6uoTBnU0pLs+d4E38dYVipExMbuoLkrZbOoQUJiCrJwpP4Uxt1/yj+rRK7K 2zWc/uMZlhGt6s+mx6AaQ7hYLl6n6Stm7blLQyp5qJnD1TxTcryIajNnBNlnLMPTozr38U thmEIkc0uCvhIt2Q3xDXZp1XUx0b/kCBlJMRfB3Ll9TjzZpXQvyARS3U9eu1Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679490776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLsV8N84YKa9u19MccWEBEZ2Ba6p9AtPJwPhhgHHvP8=; b=gE7f+f9s5zxoSXfU/VbXica+0kPLjfsyXHl2GEVmGI9eSnbRp6DjQdFGlwV8Hmfz4uBTMJ NDJ7W5RX4POqo+0mN4kpTktjvW7UIgkFxvVCnDBmEcmzKhZsphdLoZnR6aMe2ydfxGRFAk raj8ZB1eMUiTXxBpKcKpG8vBs6DQnHTfeCvbGwNg0ODLsFh27jWf8R7YeNyN4udN6UEhvo DBsJUaIRhHZxQlAkmXx8DyqDE6M2naywuAjBU7LgtR54oShtIjbLtSVrS9oj5AcME99Jgp X0q0a90D10KmSW+O0JMfOKntVGzKBH1ajSR/+dGuudgtJmzBeao/6ad5CE0uZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679490776; a=rsa-sha256; cv=none; b=Qhe5V5P2OfWvRFdZc5SZovCz9gPIHeFKv0Hfo6ZVy1SZ707qQLw6dnBd8PrIrh0am8sfvC ZisydJ3R1AD0dFFnq1qxNBNPPISC+I57qM2i4+TUXi0coQ/2QHWUuty9xa2OgHOM1WC+sF EZ2jlPTl4js7cvFcfYuNUp3H1nwtAoP2aTe90FyuCj0JpPQVgJi3pnkik0rncH1ALT+Gnu yl8jpyif+S+ACri5OFp2DYU7xRxU4+2LiCe/wlGKrz3RxY2XPOgZKFFcwvrOqIHMNjKdvT DFh7No1vjhqySJ/A27TjVUN4KlktbyzdkVO2uTYAIVuZfsENCBZwjv5BkIc35w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhTRX1j59zvSC; Wed, 22 Mar 2023 13:12: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 32MDCuWX095673; Wed, 22 Mar 2023 13:12:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MDCuiE095672; Wed, 22 Mar 2023 13:12:56 GMT (envelope-from git) Date: Wed, 22 Mar 2023 13:12:56 GMT Message-Id: <202303221312.32MDCuiE095672@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: ddf77ec39271 - main - etdump: exit on error if section header or entry offset is OOB List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddf77ec392717e7eaf278c0f201b561afac97b87 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ddf77ec392717e7eaf278c0f201b561afac97b87 commit ddf77ec392717e7eaf278c0f201b561afac97b87 Author: Ed Maste AuthorDate: 2022-05-03 20:13:37 +0000 Commit: Ed Maste CommitDate: 2023-03-22 13:12:45 +0000 etdump: exit on error if section header or entry offset is OOB PR: 263663 Reported by: Robert Morris Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35868 --- usr.bin/etdump/etdump.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.bin/etdump/etdump.c b/usr.bin/etdump/etdump.c index e536aa5e51cb..b234fc9d7ff8 100644 --- a/usr.bin/etdump/etdump.c +++ b/usr.bin/etdump/etdump.c @@ -116,8 +116,8 @@ boot_catalog_valid(char *entry) } static int -dump_section(char *buffer, size_t offset, FILE *outfile, const char *filename, - struct outputter *outputter) +dump_section(char *buffer, size_t bufsize, size_t offset, FILE *outfile, + const char *filename, struct outputter *outputter) { boot_catalog_section_header *sh; u_char platform_id; @@ -125,6 +125,8 @@ dump_section(char *buffer, size_t offset, FILE *outfile, const char *filename, size_t entry_offset; boot_catalog_section_entry *entry; + if (offset + sizeof(boot_catalog_section_header) > bufsize) + errx(1, "%s: section header out of bounds", filename); sh = (boot_catalog_section_header *)&buffer[offset]; if (outputter->output_section != NULL) { outputter->output_section(outfile, filename, sh); @@ -135,6 +137,10 @@ dump_section(char *buffer, size_t offset, FILE *outfile, const char *filename, if (outputter->output_entry != NULL) { for (i = 1; i <= (int)sh->num_section_entries[0]; i++) { entry_offset = offset + i * ET_BOOT_ENTRY_SIZE; + if (entry_offset + sizeof(boot_catalog_section_entry) > + bufsize) + errx(1, "%s: section entry out of bounds", + filename); entry = (boot_catalog_section_entry *)&buffer[entry_offset]; outputter->output_entry(outfile, filename, entry, @@ -195,8 +201,8 @@ dump_eltorito(FILE *iso, const char *filename, FILE *outfile, (uint8_t)entry[0] != ET_SECTION_HEADER_LAST) break; - entry_count = dump_section(buffer, offset, outfile, filename, - outputter); + entry_count = dump_section(buffer, sizeof(buffer), offset, + outfile, filename, outputter); offset += entry_count * ET_BOOT_ENTRY_SIZE; } From nobody Wed Mar 22 13:19:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhTbB6Mm9z40qRq; Wed, 22 Mar 2023 13:19: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 4PhTbB5sTjz4W4k; Wed, 22 Mar 2023 13:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LuaJ3zVbmUrnmis40u0CpBnHJxLRqJxncvUuBwDBdT0=; b=lST7eCxQXcWkfz2PZhpHvk6HLj1XB9pw0/VLROrMeQlshNVtMKyIQ7r8Rs5fCF9UR/QyzJ ik61QcUWxfauHa/HDbxmA2wlFgxwuWn9e9q3ww94qckDgpNxIz9OTynH28ET/YJEJGl9Ww +7gcsT8uw+16XZacSvS2YSFClknbuMXoA0bASD8ApgZ9jjdpdfEuVf/GhCgOateVshIqjQ 8bFK1i3Erlgdzxj82wt6AVBIU+I1ZPMqQuyH/ECs16/dKm8/0hWAsRbPeCbDeFcub7n3CX N1gjyUFvcUzhoIt1DykOoWYJNhd2F6aVgMehy9j0u/ngcmZ3gFhpwmZ1d+vuNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LuaJ3zVbmUrnmis40u0CpBnHJxLRqJxncvUuBwDBdT0=; b=tNyBcogszraxmFuhmsVEg3uCl5mPMzvC0hUnXXCPjXK4mBHjHOrsaPXDOXgx8SfRBU4G17 T1yZVHsyQvngeZ/gAwhdo05F/J+8gH2sjPz7+Ne499OfSaVrW13OjXodMHoPmySruvp2Nb vJdvAXS/GV5ykiKYFX2YBa/GYP0dK5n6nDaNK0RAb6v5Zb0dJePgN3UCJl6onaEgPKhqqK dixfPpjvRCl0mbvLXpe1HJ08oktR0cvrTpmz6h0+wuaRX48HWs4ZWUnFedpNDfbgODgrRv ae6xCnmlFKQpVFqicx1LQ0TzizP9RmwZsgnZ5eSQMoyj0p/VLsKFFdfD7KUygg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679491174; a=rsa-sha256; cv=none; b=gErrJwfCzBuYKiXjmHR3edjVk1Q3m2gF/TgIRREqi/JXbJHNnuRMyPl22OsafOqw6o6hrF MHnNRNSsBHDGeJdxrafTOVd/SMgf52Esbr3oRIayVNYwXAnfPWteH4EKVh/Pl9aVB20H4G uvOFrO0MmKcb8ZbaT67OKtlTmtzmEfkiTKfGCDeDQ31gzD7zC0Z/hfhAviGv7pnrJTOvP5 vFB2UnoBt/5C28dmwZyJQfUWeVjrTkKGBCpHLKMQBSFs+4l5H0UcWKuHKly4td+Wejs3ti zhKI3Cxfsnhj3U3t+Gh0ThDu6IQZtRYCa4QEBe0/y0RMcwUOLDJYwB14krpBIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhTbB4wn2zvbF; Wed, 22 Mar 2023 13:19: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 32MDJYqV097013; Wed, 22 Mar 2023 13:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MDJYL3097012; Wed, 22 Mar 2023 13:19:34 GMT (envelope-from git) Date: Wed, 22 Mar 2023 13:19:34 GMT Message-Id: <202303221319.32MDJYL3097012@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: e5e1d9c7b781 - main - path_test: Add a test case for openat(O_EMPTY_PATH) in capability mode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5e1d9c7b781470b2eb31d80f40927481e0053b8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e5e1d9c7b781470b2eb31d80f40927481e0053b8 commit e5e1d9c7b781470b2eb31d80f40927481e0053b8 Author: Mark Johnston AuthorDate: 2023-03-22 12:51:58 +0000 Commit: Mark Johnston CommitDate: 2023-03-22 13:19:27 +0000 path_test: Add a test case for openat(O_EMPTY_PATH) in capability mode MFC after: 1 week --- tests/sys/file/path_test.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index a212325c7db6..130acababb21 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -208,6 +208,80 @@ ATF_TC_BODY(path_capsicum, tc) waitchild(child, 4); } +/* + * Check that a pathfd can be converted to a regular fd using openat() in + * capability mode, but that rights on the pathfd are respected. + */ +ATF_TC_WITHOUT_HEAD(path_capsicum_empty); +ATF_TC_BODY(path_capsicum_empty, tc) +{ + char path[PATH_MAX]; + cap_rights_t rights; + int dfd, fd, pathfd, pathdfd; + + mktfile(path, "path_capsicum.XXXXXX"); + + pathdfd = open(".", O_PATH); + ATF_REQUIRE_MSG(pathdfd >= 0, FMT_ERR("open")); + pathfd = open(path, O_PATH); + ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open")); + + ATF_REQUIRE(cap_enter() == 0); + + dfd = openat(pathdfd, "", O_DIRECTORY | O_EMPTY_PATH); + ATF_REQUIRE(dfd >= 0); + CHECKED_CLOSE(dfd); + + /* + * CAP_READ and CAP_LOOKUP should be sufficient to open a directory. + */ + cap_rights_init(&rights, CAP_READ | CAP_LOOKUP); + ATF_REQUIRE(cap_rights_limit(pathdfd, &rights) == 0); + dfd = openat(pathdfd, "", O_DIRECTORY | O_EMPTY_PATH); + ATF_REQUIRE(dfd >= 0); + CHECKED_CLOSE(dfd); + + /* + * ... CAP_READ on its own is not. + */ + cap_rights_init(&rights, CAP_READ); + ATF_REQUIRE(cap_rights_limit(pathdfd, &rights) == 0); + dfd = openat(pathdfd, "", O_DIRECTORY | O_EMPTY_PATH); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, dfd == -1); + + /* + * Now try with a regular file. + */ + fd = openat(pathfd, "", O_RDWR | O_EMPTY_PATH); + ATF_REQUIRE(fd >= 0); + CHECKED_CLOSE(fd); + + cap_rights_init(&rights, CAP_READ | CAP_LOOKUP | CAP_WRITE); + ATF_REQUIRE(cap_rights_limit(pathfd, &rights) == 0); + fd = openat(pathfd, "", O_RDWR | O_EMPTY_PATH | O_APPEND); + ATF_REQUIRE(fd >= 0); + CHECKED_CLOSE(fd); + + /* + * CAP_SEEK is needed to open a file for writing without O_APPEND. + */ + cap_rights_init(&rights, CAP_READ | CAP_LOOKUP | CAP_WRITE); + ATF_REQUIRE(cap_rights_limit(pathfd, &rights) == 0); + fd = openat(pathfd, "", O_RDWR | O_EMPTY_PATH); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, fd == -1); + + /* + * CAP_LOOKUP isn't sufficient to open a file for reading. + */ + cap_rights_init(&rights, CAP_LOOKUP); + ATF_REQUIRE(cap_rights_limit(pathfd, &rights) == 0); + fd = openat(pathfd, "", O_RDONLY | O_EMPTY_PATH); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, fd == -1); + + CHECKED_CLOSE(pathfd); + CHECKED_CLOSE(pathdfd); +} + /* Make sure that ptrace(PT_COREDUMP) cannot be used to write to a path fd. */ ATF_TC_WITHOUT_HEAD(path_coredump); ATF_TC_BODY(path_coredump, tc) @@ -937,6 +1011,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, path_access); ATF_TP_ADD_TC(tp, path_aio); ATF_TP_ADD_TC(tp, path_capsicum); + ATF_TP_ADD_TC(tp, path_capsicum_empty); ATF_TP_ADD_TC(tp, path_coredump); ATF_TP_ADD_TC(tp, path_directory); ATF_TP_ADD_TC(tp, path_directory_not_root); From nobody Wed Mar 22 13:19:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhTbD0RQbz40qc5; Wed, 22 Mar 2023 13:19: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 4PhTbC6cyDz4WP8; Wed, 22 Mar 2023 13:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lf3Kq0nP9YrkRwwEd030FWp6I4Z9hqzB44WK9iZC4xw=; b=mXUNJyOszlVLNSalJFAtSe5i9rcpNADv1HH4HmVbaK8juEmnkuHkosYacF2JFbGLGBL1FM KhsL6wJLY4epm9S9xnVVTPCjeCwlt+RqodcxHByomQ0WMwjiAFo3h1fhmMhVF54p5bE01h /HuGHQfjafO45KFxZECShh9oeUssosjFRkarWN5tL4KDTrw3HVc0Ex4HbmriBSVvD0OkGX 8j62Pn0xulU6YFqG7buPa5C0ZRt3U6IPdFdDCb+i9ad+S9q69c1JQ2j/gB4/haS/I/iAM0 x0ksebaGqqyMgnDw+9eGylayFHxSZ4qY60GMq32XCubLKbR/KY4lX8egRhqBWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lf3Kq0nP9YrkRwwEd030FWp6I4Z9hqzB44WK9iZC4xw=; b=aVbiFGPQcM7I76YeUxko2Bko3YVvLBVZAZVD3FuDiEYdsoXt9yiloYt27xSaDpaDXD5XZa k4q7EN2XYRKaYY1ZzyVNCHF/qbQpEUIv2QHA2T5d6EDuAAMDThPw3ccA6fYSGgdb9/ihwK 9CoAzxFqCvuMjxJ7KivUEv+pZjkJOc8fUK8k9ss8wd3zm8VknActQVk7lE2PiN+CGrbaU3 pl1HCjzxgUQL1xiDwi1SuNUh5ItD+RUNjrtZMwY1+1EO/h+DojSJbcqU76L+ULm634NB6Y 7ObipoxI4AeRLskPzj0EWrWKLk0hFZGptuS5I0tTZBhdFZd0QuOP3bVDBKh7TQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679491175; a=rsa-sha256; cv=none; b=KNTmDaVPRHYaK73hizDLcEsTiyQHnqdVnO96LrFEQhyKMzyB0tq3ThCQc/txNd9nqBhU8T FBJlcboA3XpN9N1tXmQOphg3GwsaX/4Mrtsh4kF5VGMcC4BknWav4Np2gRVQM+lpuEpMxz muLg1j/XJ9S5/WAVJhuGNA1r+URMGvmr7Bd1Ztj6PksUf18TI33NWwvDMG9c0yiXBkkAXG i+RhGAeFVN+qWOYhjUc38XKj//m/TKvgGUdFAd+7z8v4SXOj9CMcjbS9g5Xi4dsHM0s9au wM0xIiuOeL7dRJ4Fxy7zIjAWLhl57OvfXxIAn04Qb9IY7J0YjQrjIBFz+359+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhTbC5fDMzvTv; Wed, 22 Mar 2023 13:19: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 32MDJZ0C097045; Wed, 22 Mar 2023 13:19:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MDJZ7T097041; Wed, 22 Mar 2023 13:19:35 GMT (envelope-from git) Date: Wed, 22 Mar 2023 13:19:35 GMT Message-Id: <202303221319.32MDJZ7T097041@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: 0f5b6f9a041e - main - fdescfs: Fix a file ref leak List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f5b6f9a041e9cca3b376f6ec909374938887a3b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0f5b6f9a041e9cca3b376f6ec909374938887a3b commit 0f5b6f9a041e9cca3b376f6ec909374938887a3b Author: Mark Johnston AuthorDate: 2023-03-22 12:52:57 +0000 Commit: Mark Johnston CommitDate: 2023-03-22 13:19:27 +0000 fdescfs: Fix a file ref leak In fdesc_lookup(), vn_vget_ino_gen() may fail without invoking the callback, in which case the ref on fp is leaked. This happens if the fdescfs mount is being concurrently unmounted. Moreover, we cannot safely drop the ref while the dvp is locked. So: - Use a flag variable to indicate whether the ref is dropped. - Reorganize things to handle the leak. Reported by: C Turt Reviewed by: mjg, kib Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39189 --- sys/fs/fdescfs/fdesc_vnops.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 0949dcc7eb29..d3c7951672cf 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -246,6 +246,7 @@ struct fdesc_get_ino_args { int ix; struct file *fp; struct thread *td; + bool fdropped; }; static int @@ -268,6 +269,7 @@ fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags, error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp); } fdrop(a->fp, a->td); + a->fdropped = true; return (error); } @@ -288,6 +290,7 @@ fdesc_lookup(struct vop_lookup_args *ap) int nlen = cnp->cn_namelen; u_int fd, fd1; int error; + bool fdropped; struct vnode *fvp; if ((cnp->cn_flags & ISLASTCN) && @@ -331,24 +334,10 @@ fdesc_lookup(struct vop_lookup_args *ap) */ if ((error = fget(td, fd, &cap_no_rights, &fp)) != 0) goto bad; + fdropped = false; - /* Check if we're looking up ourselves. */ - if (VTOFDESC(dvp)->fd_ix == FD_DESC + fd) { - /* - * In case we're holding the last reference to the file, the dvp - * will be re-acquired. - */ - vhold(dvp); - VOP_UNLOCK(dvp); - fdrop(fp, td); - - /* Re-aquire the lock afterwards. */ - vn_lock(dvp, LK_RETRY | LK_EXCLUSIVE); - vdrop(dvp); - fvp = dvp; - if (VN_IS_DOOMED(dvp)) - error = ENOENT; - } else { + /* Make sure we're not looking up the dvp itself. */ + if (VTOFDESC(dvp)->fd_ix != FD_DESC + fd) { /* * Unlock our root node (dvp) when doing this, since we might * deadlock since the vnode might be locked by another thread @@ -362,8 +351,27 @@ fdesc_lookup(struct vop_lookup_args *ap) arg.ix = FD_DESC + fd; arg.fp = fp; arg.td = td; + arg.fdropped = fdropped; error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, LK_EXCLUSIVE, &fvp); + fdropped = arg.fdropped; + } + + if (!fdropped) { + /* + * In case we're holding the last reference to the file, the dvp + * will be re-acquired. + */ + vhold(dvp); + VOP_UNLOCK(dvp); + fdrop(fp, td); + fdropped = true; + + vn_lock(dvp, LK_RETRY | LK_EXCLUSIVE); + vdrop(dvp); + fvp = dvp; + if (error == 0 && VN_IS_DOOMED(dvp)) + error = ENOENT; } if (error) From nobody Wed Mar 22 13:19:36 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhTbF0dqHz40qL8; Wed, 22 Mar 2023 13:19: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 4PhTbF04ccz4WS7; Wed, 22 Mar 2023 13:19:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RGfrkAZ8C11of76PM48M8qj0//vCX8TgbFFxaK2icl0=; b=eHD91YDE+kjd3tDKOwHhP+VlXMOrZNTyT27LdxWfsS25YGX35erJE3T5ujENQG8AIjkJUl F+JKKDd1ymcO5Of47ycsIEcXU/RB5JJSQPVLSddi+rC3u4AL+UVwvRhSsYIRIGQ2BwESv+ jIGNztsiD+Af8aEsehUcYrnNdyyD2kx2/TwMWFxPPW/Xju0EK7u3Nmp3xwHb0nx5rbPONB yAAFEEBKOwjlN9Sjzib6goxmlmLuMbkLaliAyTyrcUJuv767rjAQq7mrgjVENoRqJEeiUs PvSKHtigp+d2ljIVUJaSpxCKhSaY/lqC3xaYX6MqFwym+Sd7m/KrYbwIQ2vvNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679491177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RGfrkAZ8C11of76PM48M8qj0//vCX8TgbFFxaK2icl0=; b=Tc6mZ2DhRZ4AjZ2MZy9YqmL2xmMqtbT5/AxJ5E2+MUs9wD9omLdh0W/jAIq/lsexQUM844 4+psQBCgVfm18R5v9HmaFpAujzm5nWOFZVczfa503heFvtJtX4k2UJzDZqyYWIGojCKQkt 7PjY+tgQ6iYbfziF9jc9e8PNgszlqufFQkhsc1Sy4CsVGhH6T7HY/aGqBEsH+968f7DR1a N9/O8klSbJdHaEdhxz2jeSXyAKbwYuAbvVZLFprIbpgrZ3DaIqxZlh5Laq/48jn/kN+5Pv L7f+Ws5YT+VNFLnt8qFSc6e7x/6EPihS4OsQcnswW8KryajpEmQqpd8gXr/LQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679491177; a=rsa-sha256; cv=none; b=J87z+3cqVKBsfQeLAhf/q7Z6Y7MaE5N4MlzdaZ2ozsOhD7sDFCC6M0Cgc/XTt/Ps7AzHBj pIuO6xnob6cKxlp7wVkPO4KZ+603g0IwEGKB5LYeBjT5IWZ2NqAWP73IVpjgrVPrNyDa2F rnnvkPt0tBFpGSjx2wwNTlfqcBPzWw/7vWI0PAlcdyjEFVc2Jgz2UgHocUAoteVHBAQCJy 5k9JPTo1iaXS1TQT8qy6EQty2JLW17z3Nl6Pcs9FC8R0UtPEoJhxjeCUkemMjdiWbacvHW PllDCi+z7U6hxt5+7or03YlxHvH8qtkfAOlNpRzY67UesVQ1FP35SLed6kAPKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhTbD6Htjzvdk; Wed, 22 Mar 2023 13:19: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 32MDJaBk097064; Wed, 22 Mar 2023 13:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MDJal8097063; Wed, 22 Mar 2023 13:19:36 GMT (envelope-from git) Date: Wed, 22 Mar 2023 13:19:36 GMT Message-Id: <202303221319.32MDJal8097063@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: ef0ac973dbc8 - main - bhyve: Sleep briefly in the VMEXIT_DEBUG handler List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef0ac973dbc8c54214ac8c61891abd832cd5b700 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ef0ac973dbc8c54214ac8c61891abd832cd5b700 commit ef0ac973dbc8c54214ac8c61891abd832cd5b700 Author: Mark Johnston AuthorDate: 2023-03-22 13:02:54 +0000 Commit: Mark Johnston CommitDate: 2023-03-22 13:19:27 +0000 bhyve: Sleep briefly in the VMEXIT_DEBUG handler As of commit 0bda8d3e9f7a ("vmm: permit some IPIs to be handled by userspace") and commit 9cc9abf409cc ("bhyve: create all vcpus on startup"), we have a misbehaviour where AP vCPU threads spin until they receive a SIPI. In particular, since they are "suspended", they simply call the VMEXIT_DEBUG handler in a loop, but the handler is a no-op by default. This is tricky to fix since the gdb stub isn't aware of whether a given vCPU is supposed to be running. For 13.2's sake, introduce a simple workaround wherein the VMEXIT_DEBUG handler sleeps for a short period. This ensures that host CPU usage remains sane when VMs are starting without penalizing users of VMEXIT_DEBUG too much. Reviewed by: corvink, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39174 --- usr.sbin/bhyve/bhyverun.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 665fec73e48c..dd30eb4405ef 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -911,6 +911,11 @@ vmexit_debug(struct vmctx *ctx __unused, struct vm_exit *vme __unused, #ifdef BHYVE_SNAPSHOT checkpoint_cpu_resume(*pvcpu); #endif + /* + * XXX-MJ sleep for a short period to avoid chewing up the CPU in the + * window between activation of the vCPU thread and the STARTUP IPI. + */ + usleep(1000); return (VMEXIT_CONTINUE); } From nobody Wed Mar 22 15:05:43 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhWxg4rqJz40x38; Wed, 22 Mar 2023 15:05: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 4PhWxg4QLHz3C0n; Wed, 22 Mar 2023 15:05:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679497543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m0sJvvq7mBcDiYd+1o6DB1+CutXuglDrKX6/adFompg=; b=mfNEM2ooXVF6j70iEUoWMeSXFcn3ZlCO1oRrxjENOaPOyeRJfNa/uFTrAaU22FPN8COJmr mwRLyK5k/LT+FxSp9YqlXH3vOISLlRl25uYHZs+A0JO11XMdfcLijruiTVEwRAnm9ZE6tt XXN9jLajrZM9iw9H1EQY/avqA1ung3qdR4lc/2qM4Wmt0TEG0yCPBzGVtgAaZXfsbeThyb EpTISkjKZ0YFwE0qGpNRI4w1IKDAM3JNeTWNygfYyzZN7a55mt5RT1zGXjVFif3lF94Erk Ul6WFnavwqhkkBZwI5gikei5zNKDhjFnZxhm3sJkOGCSLh/6DMeqme6/aJeJAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679497543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m0sJvvq7mBcDiYd+1o6DB1+CutXuglDrKX6/adFompg=; b=sXV063Pf6yHt5PP5WrAyY+oqhIgCWv6gLaP3NnhhR+NO1OnxuXutMZUZ3Bug1Hw7/yGNpI tgcpBHyidRNSJK+QHyhL7/Kfe5pC6xKuF4I/JXA2BmnLzZXF/KPLdHkqqqCEkUs0hlHQUO Kpeqo6ODxfgkO+3wRRaVQVVf1L7qynXctZJhlhSiai6N91JOk5L0eyZe5DI0NgDdOKSLcB zm1j8oLU/n0cLN1/Bq3DOtzIGbN91j1tH1oGpR4ND2MpFJZhaU1V5CwE99QnEa0yaKl5xp Dm89eMIi+8Eb70i5+zZrMNqGoTiY0BH8TYkiYG7FkBATkq923WnUMoWmcyX5zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679497543; a=rsa-sha256; cv=none; b=h/kIgMauWL59oPPBARLROdBWrz80RwI6E2MC3G0En5bolGtuXjedxr9g4g8g8unHD6hSTb vIfzpw6vPwbwZpc3l8VZxKmTZDjvIthZr3dW3oW8UeKnSdri6U9Gr5qB+zHpjzoApvtrsT tF1vovj/vz80dN7dqLV8qNNm+JFyee12LWkw9TSqWk2uv52pTk6ki9O9+DlF1bdgMfIukD Gr+Xp0znhEs9dQnpLbUepEL8Zq9sKMnQsSKNb8Nj9q7pQ7wiu5jM6ToJPhENrgbChnTyvr OAODsIWKUsdZOiLefzJP9KEaVqgxXAcYxJ32MxQWe7ELQSDE8Yc1onnzVJCBsQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhWxg3B6Kzy8r; Wed, 22 Mar 2023 15:05: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 32MF5hC4076823; Wed, 22 Mar 2023 15:05:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MF5hLr076822; Wed, 22 Mar 2023 15:05:43 GMT (envelope-from git) Date: Wed, 22 Mar 2023 15:05:43 GMT Message-Id: <202303221505.32MF5hLr076822@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: 69c72a57af84 - main - sftp: avoid leaking path arg in calls to make_absolute_pwd_glob List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69c72a57af843267b220f8367c4cc7162a12d696 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=69c72a57af843267b220f8367c4cc7162a12d696 commit 69c72a57af843267b220f8367c4cc7162a12d696 Author: Ed Maste AuthorDate: 2022-11-03 17:17:40 +0000 Commit: Ed Maste CommitDate: 2023-03-22 14:54:35 +0000 sftp: avoid leaking path arg in calls to make_absolute_pwd_glob As Coverity reports: Overwriting tmp in tmp = make_absolute_pwd_glob(tmp, remote_path) leaks the storage that tmp points to. Consume the first arg in make_absolute_pwd_glob, and add xstrdup() to the one case which did not assign to the same variable that was passed in. With this change make_absolute() and make_absolute_pwd_glob() have the same semantics with respect to freeing the input string. This change was reported to OpenSSH in https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-November/040497.html but was not acted on. It appears that OpenBSD subsequently received a Coverity report for the same issue (their Coverity ID 405196) but fixed only the specific instance reported by Coverity. This change reverts OpenBSD's sftp.c 1.228 / OpenSSH-portable commit 36c6c3eff5e4. Reported by: Coverity Scan CID: 1500409 Reviewed by: markj MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37253 --- crypto/openssh/sftp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crypto/openssh/sftp.c b/crypto/openssh/sftp.c index 29081db3d434..ce7ab7f8f2fe 100644 --- a/crypto/openssh/sftp.c +++ b/crypto/openssh/sftp.c @@ -617,14 +617,14 @@ escape_glob(const char *s) } static char * -make_absolute_pwd_glob(const char *p, const char *pwd) +make_absolute_pwd_glob(char *p, const char *pwd) { char *ret, *escpwd; escpwd = escape_glob(pwd); if (p == NULL) return escpwd; - ret = make_absolute(xstrdup(p), escpwd); + ret = make_absolute(p, escpwd); free(escpwd); return ret; } @@ -637,7 +637,7 @@ process_get(struct sftp_conn *conn, const char *src, const char *dst, glob_t g; int i, r, err = 0; - abs_src = make_absolute_pwd_glob(src, pwd); + abs_src = make_absolute_pwd_glob(xstrdup(src), pwd); memset(&g, 0, sizeof(g)); debug3("Looking up %s", abs_src); @@ -1997,9 +1997,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path, memset(&g, 0, sizeof(g)); if (remote != LOCAL) { - tmp2 = make_absolute_pwd_glob(tmp, remote_path); - free(tmp); - tmp = tmp2; + tmp = make_absolute_pwd_glob(tmp, remote_path); remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); } else glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); From nobody Wed Mar 22 15:05:44 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhWxh6QPJz40xJ4; Wed, 22 Mar 2023 15:05: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 4PhWxh5QYfz3CJs; Wed, 22 Mar 2023 15:05:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679497544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=um7EQNGvb50nGjkoW6X7K8RUTbhPyL3XnJe0fXwQAj8=; b=tPogD2bQ/J4AAmXdw6IzepUho8FejwG2dBbdqHLzGP1vOrSYYIb2sBs8p0PZ2311d1/v+V 1D/aFGJs0kyTPw0AwDhKUrY/iMeJYS56kkZrL6IImjob/na1JvlLhbWs6qIotx1dZIxF6J sPMQRRwP4XQRFChDm5+3JNtmrYClL2PowJxp/yM68KYWN5wlnQCTYL+1gp1o6cntNXarTh D/13pWvgFORutsZSPGwPCFO21NRe+eUsDTMT+F8hpEZ7BYs5q4vjTNyyA8GSGOHX6etpmt wpn6NjAdV+mrQ1JN5b/wlj6Y/oJ891hZJDr6gDbWpVgHw8M1kQaE75PtBM5hrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679497544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=um7EQNGvb50nGjkoW6X7K8RUTbhPyL3XnJe0fXwQAj8=; b=WeYwvf8TsmwWjzdLJm4pW4YGikWNxK+nmhCDGFaWMhCXWRkta437ZawIaPr5EuhIU06TA4 FeuLgmTCzLV9Oy/vXyPJrB195D57d/n2iFnloD/Rmq/qL4ku9R9ybM1P1Fjg/dV5XSVAlF 26yX6n03BjfMRHxjTXnsMpeotHR7OxPoG7/cBIJp2Zi9KWjG28YRuPN2x8w6AapYWHd1f3 VU4C1uXQGnxkX3qG27diylrWy4rFJYolni6I0CeEKJF7ZslfIYXtkTq8JevX4qSPDbvSDO IMn+DJ1B6KiyDjcUpcQGzXz8kY1aNrin2YMCP7tO5W4UC26rBYzfuH0bTE67fA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679497544; a=rsa-sha256; cv=none; b=tb+atvjmSN5leAikdp+7Ay9oEkgraNhcVTILX5jk/gKaYrduRT3wwPMY3ExppMrzu0k9Cf u8Hna3BcT4lTCexTKh3swfskbhQSUKydFYP3CZlyto+cAD3EpHEs+bi4buA7ww0+lPLotj 8Msya0JXd/82/SYJLZgfAe04M3ocdjWtMrBpD15sWOJ1GPOccjuT8m9j2NG6O5hBFpg1kZ /TRz0GIsNgFqO67OtrWYpVe3E6Rexos/7lnA2/1CJrUq6AGNSg40XdmzrCVaU2nfkW3hZN /cRhgpYDao4bozLJWC+/cz8gApFHja3t4QYzaOoReuQ2geMHy7B+ZHrzwzfvmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhWxh4Ph7zy5l; Wed, 22 Mar 2023 15:05: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 32MF5iHS076842; Wed, 22 Mar 2023 15:05:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MF5itH076841; Wed, 22 Mar 2023 15:05:44 GMT (envelope-from git) Date: Wed, 22 Mar 2023 15:05:44 GMT Message-Id: <202303221505.32MF5itH076841@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: c888b3b22864 - main - sftp: add description of memory leak fix List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c888b3b22864db305fba32839477352c2a756baa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c888b3b22864db305fba32839477352c2a756baa commit c888b3b22864db305fba32839477352c2a756baa Author: Ed Maste AuthorDate: 2023-03-21 19:25:01 +0000 Commit: Ed Maste CommitDate: 2023-03-22 15:04:29 +0000 sftp: add description of memory leak fix --- crypto/openssh/FREEBSD-upgrade | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/FREEBSD-upgrade b/crypto/openssh/FREEBSD-upgrade index 86f4676504fc..78cca746fb77 100644 --- a/crypto/openssh/FREEBSD-upgrade +++ b/crypto/openssh/FREEBSD-upgrade @@ -171,7 +171,16 @@ A number of paths are changed to match FreeBSD's configuration (e.g., using /usr/local/ instead of /uxr/X11R6/). -10) Retired patches +10) Memory leaks + + Coverity reported a memory leak for which we proposed a fix in + https://reviews.freebsd.org/D37253 and sent to the upstream mailing list at + https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-November/040497.html + + Upstream subsequently fixed only one of the related leaks, so we reverted + the partial fix and applied our change. + +11) Retired patches We no longer have HPN patches (adaptive buffer size for increased throughput on high-BxD links) or client-side VersionAddendum, but we From nobody Wed Mar 22 15:30:30 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhXVH2XMCz40yGv; Wed, 22 Mar 2023 15:30: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 4PhXVH1wNYz3Dxq; Wed, 22 Mar 2023 15:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FbEiBZfvKBt0lpnew1+sG30Z3pqBnvFVtYjxDUxdN14=; b=AiT0jXtUzGuVgFwSWyuyD3Xn+DDcIUglugobxr3LuyEv5CPQnuu7nLp/hEhNU+crDXAGCO oD6boxq7OCGaMs1hY1AzuUJ47zTwuD78PPlrUL+h6VAQfWwV80gwtB062GkQbf55H/w93h r63bzf9zqnjbxGfvXOhD2jtV2+sbHeo03CFW4WjTxPZunGYQByFyVWJ51C+bfTPionEqw6 Uzx/CUWM+B8jVHHzXXVvMssDY5H6tNv0UVpKkAz+N0yira9RjWoBCAQ+NMpCbWZ/GFqzgg NIJY7CNO1GSS8x7M/Ey101wOIfTs0HblOQWXNBtHU37nrGm2xqUTERQNkZJBdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FbEiBZfvKBt0lpnew1+sG30Z3pqBnvFVtYjxDUxdN14=; b=EvUt+il4k/d9dbE4KXC38JAYuByTkfCCidJI6HVdPj/h1T9f8c/CURexkR98tPdWwfrUG9 YOW+p5dXHtJFh+R1NODUHG+lOIJ4U5r0oNdw6lDCGgy0qffuOk7iEs9Gk1Ue4pgp5+4+oM /ixCKcszWTXzvb0EBuV98BhWYc463dd/Ik44rYCu+Vv7y/QfySJIsO0pN3reNh3BmHVmPc F9WtQFpiNDcdJOl8XexHsCRnQWIEsXwuMnUf6oe+RG1bygtcxF5czQn6J113JnMAY2FWXH nrpD6kW4tWrAnPsBS7U+QVvl8nZzEVpwviE9/94iC7cD1+5DNPTi9vgci42Tow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679499031; a=rsa-sha256; cv=none; b=RJyuzW646/JQzy6ynNS/w9FsJciaXXxJc6tez+oZ4WpZdtAkrEHZzPbCZCjlhXnuC/R+kl iEmzeRun/HqbMcs1J7ymyKcXgTYVHVuLwrO74p6rWtC/nYxFNNk5hvf17x1w4q1bVmh4Sa pKDwDaJRIwZ1VzSakJ0DHP31Pbu6n66vwLacqTmjowWAFwWHrxWZc14o/6nLFwk3Ocpc/7 2ua7+ezHyAPvMP/S7hUtt8DdkUOrWU96I3bLMAmr+ZWHTnSr9I8eTGCQ8v7/Owov0tm/jz 2+iLOWdKZffSt2484oIX4rSFdrlvHU//sOOsyfFYC/+1/uEvTDb0VPw+ucyORg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhXVH0vS5zyqn; Wed, 22 Mar 2023 15:30: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 32MFUUHj018053; Wed, 22 Mar 2023 15:30:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MFUU7i018052; Wed, 22 Mar 2023 15:30:30 GMT (envelope-from git) Date: Wed, 22 Mar 2023 15:30:30 GMT Message-Id: <202303221530.32MFUU7i018052@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: 1c33a94ab06b - main - Add macros for arm64 pcb register offsets List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 1c33a94ab06bb8274c8a50257a8b94e209a2e2ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1c33a94ab06bb8274c8a50257a8b94e209a2e2ee commit 1c33a94ab06bb8274c8a50257a8b94e209a2e2ee Author: Andrew Turner AuthorDate: 2023-03-22 12:18:41 +0000 Commit: Andrew Turner CommitDate: 2023-03-22 15:08:03 +0000 Add macros for arm64 pcb register offsets Add macros for offsets of macros we set in the arm64 pcb pcb_x array. This will simplift reducing the size of this array in a later change. Sponsored by: Arm Ltd --- sys/arm64/arm64/db_trace.c | 2 +- sys/arm64/arm64/stack_machdep.c | 2 +- sys/arm64/arm64/vm_machdep.c | 12 ++++++------ sys/arm64/include/pcb.h | 4 ++++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 4d68cd513bce..2b47ae2a89c7 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -144,7 +144,7 @@ db_trace_thread(struct thread *thr, int count) if (thr != curthread) { ctx = kdb_thr_ctx(thr); - frame.fp = (uintptr_t)ctx->pcb_x[29]; + frame.fp = (uintptr_t)ctx->pcb_x[PCB_FP]; frame.pc = (uintptr_t)ctx->pcb_lr; db_stack_trace_cmd(thr, &frame); } else diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c index 706beb05761c..8a3e8ce7dbc7 100644 --- a/sys/arm64/arm64/stack_machdep.c +++ b/sys/arm64/arm64/stack_machdep.c @@ -68,7 +68,7 @@ stack_save_td(struct stack *st, struct thread *td) if (TD_IS_RUNNING(td)) return (EOPNOTSUPP); - frame.fp = td->td_pcb->pcb_x[29]; + frame.fp = td->td_pcb->pcb_x[PCB_FP]; frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_lr); stack_capture(td, st, &frame); diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 006bf5127d25..dee42a8b568d 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -105,8 +105,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) td2->td_frame = tf; /* Set the return value registers for fork() */ - td2->td_pcb->pcb_x[19] = (uintptr_t)fork_return; - td2->td_pcb->pcb_x[20] = (uintptr_t)td2; + td2->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return; + td2->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td2; td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; @@ -183,8 +183,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0) bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb)); - td->td_pcb->pcb_x[19] = (uintptr_t)fork_return; - td->td_pcb->pcb_x[20] = (uintptr_t)td; + td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return; + td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td; td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; @@ -287,8 +287,8 @@ void cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) { - td->td_pcb->pcb_x[19] = (uintptr_t)func; - td->td_pcb->pcb_x[20] = (uintptr_t)arg; + td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)func; + td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)arg; } void diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h index a7416d65b344..8767a9e4dba3 100644 --- a/sys/arm64/include/pcb.h +++ b/sys/arm64/include/pcb.h @@ -36,6 +36,10 @@ struct trapframe; +#define PCB_X19 19 +#define PCB_X20 20 +#define PCB_FP 29 + struct pcb { uint64_t pcb_x[30]; uint64_t pcb_lr; From nobody Wed Mar 22 15:30:32 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhXVJ6jKwz40yL6; Wed, 22 Mar 2023 15:30: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 4PhXVJ2dhZz3F2x; Wed, 22 Mar 2023 15:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/3k1OEjtlWhQSBh+5Z/KJtfhpdQxWwRcykpt09wgZeo=; b=WbSH3CBcaR/lzguHUyB/7gb2GKDXzXgVrHd7FJv0WbWVm6TmjGK3QYJ9GZo0povIcIO9G5 ykp+t9HXTzIQE6Ir9BxQmEQPP+T/e+N4mrUWzNcnhiqxcjWKfJtSDnHcbUg19ducucyVkP W/8iyYHJBxi6EJAkgcOSf/HFW6NV/9mEDlt0E/HQKMPaCa6bOAEUCtvDnt1Dnl5BH3SiDE PEW869HXIwvaNrTlbjCAzf+kKab/R9gHHeIcLlfi1YoUXrovgFHa737dhToyx8IvalSdEU G37arpknH8LnQCPRKLU6FGvwM9hdVIpR7s4Fwg3AWJY63ShvonAhGNXRNqWtig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/3k1OEjtlWhQSBh+5Z/KJtfhpdQxWwRcykpt09wgZeo=; b=t4drtZYMX2su8gdQWHU5b78KP1dnqZUdMeVTBjPqOweAa4FheNrvA/dP7Sa5IiAeMbzhRL 3Js5q95hwiVw5Nd57oSOtGqBYWeFtuVuFGhZNN+L32H0qvbTKQoEZK2bb5CUkl8csssqnL Y4TdO3Nip3QmGsUdqPdz4ukVT0IEy0R45qi+N3/x6hIh41eLJMUZTIbM0Ynpvdamx6Qubl B64aVtiVP7EWlje/0280YLMixRYwQnKVePLCyPtAmlT2B3LZ0ROpqA/26q+HP4iBxUHSeJ 98DfzeqR7onVFmkno58OIJlQPRvYdlI6SJAVKqgneVDJAnktW+l4XktVwbKz2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679499032; a=rsa-sha256; cv=none; b=SqG78ZixCv/sfh196Q9Ni+Aq2zZ/9+LDIi2bPiirbH01I5ERClbRse9x/y88Na10zsSTls WzUemoX5CiE/xqReD8fXsjnqjjsX/0BzN1gAUqdEHfgZ6RJsPze0PG+f1bMhWI2qhB3B29 Hn0MUL9qo4NaLWZSuYApTp+xvVnjcG72CUa3jCNdd85lrCL3AzAnXtvLYTqH1a2BmRN8/5 KN07JTjAZ+Z+0UnyjVPb6lUFABlnnkIcJic265nHN/V4iO4vJPNenIcv+KHvB6yIUW2Mde Ylq+QKJGjuhdS8TADnN4PgjMGkQ3yAcHZ+596ajpzl50mnJ7I13oMKZEIsbSjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhXVJ1ZHxzymy; Wed, 22 Mar 2023 15:30: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 32MFUW8U018074; Wed, 22 Mar 2023 15:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MFUWk7018073; Wed, 22 Mar 2023 15:30:32 GMT (envelope-from git) Date: Wed, 22 Mar 2023 15:30:32 GMT Message-Id: <202303221530.32MFUWk7018073@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: 787bf3bcd6ee - main - arm64: Use the new PCB macros in swtch.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=787bf3bcd6ee0fe36b331b9342a0dd14e915a270 commit 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 Author: Andrew Turner AuthorDate: 2023-03-22 13:42:00 +0000 Commit: Andrew Turner CommitDate: 2023-03-22 15:08:03 +0000 arm64: Use the new PCB macros in swtch.S Rather than hard coding the location of these registers in the array use the new macros to find the correct offset. Sponsored by: Arm Ltd --- sys/arm64/arm64/genassym.c | 1 + sys/arm64/arm64/swtch.S | 48 +++++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index e444d0166360..3d88835c0f8e 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -56,6 +56,7 @@ ASSYM(PC_SSBD, offsetof(struct pcpu, pc_ssbd)); ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); +ASSYM(PCB_X19, PCB_X19); ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index e7114746f03b..538235d7b3e8 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -102,12 +102,12 @@ ENTRY(cpu_throw) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] ret END(cpu_throw) @@ -127,12 +127,12 @@ ENTRY(cpu_switch) ldr x4, [x0, #TD_PCB] /* Store the callee-saved registers */ - stp x19, x20, [x4, #PCB_REGS + 19 * 8] - stp x21, x22, [x4, #PCB_REGS + 21 * 8] - stp x23, x24, [x4, #PCB_REGS + 23 * 8] - stp x25, x26, [x4, #PCB_REGS + 25 * 8] - stp x27, x28, [x4, #PCB_REGS + 27 * 8] - stp x29, lr, [x4, #PCB_REGS + 29 * 8] + stp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 @@ -196,12 +196,12 @@ ENTRY(cpu_switch) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] str xzr, [x4, #PCB_REGS + 18 * 8] ret @@ -258,12 +258,12 @@ END(fork_trampoline) ENTRY(savectx) /* Store the callee-saved registers */ - stp x19, x20, [x0, #PCB_REGS + 19 * 8] - stp x21, x22, [x0, #PCB_REGS + 21 * 8] - stp x23, x24, [x0, #PCB_REGS + 23 * 8] - stp x25, x26, [x0, #PCB_REGS + 25 * 8] - stp x27, x28, [x0, #PCB_REGS + 27 * 8] - stp x29, lr, [x0, #PCB_REGS + 29 * 8] + stp x19, x20, [x0, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x0, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x0, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x0, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x0, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x0, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 From nobody Wed Mar 22 16:24:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhYhg43g2z411yP; Wed, 22 Mar 2023 16:24: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 4PhYhg3Bsgz3Mvr; Wed, 22 Mar 2023 16:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a7ZA27MmqHBThMt2uWDIq4igiFRzdlFn2uWGK6r9b0Y=; b=Bo8Y0Lkc6onyYb+1kOVDNJE9QwgfZXGXl4R4RSQOtoEMwFeapdZCI5wyiFvdAq4sXheEzx SFaDMi9R7mMYSHYOem8p9EzPxGzZg0KN4b/YbkNot9KkBkwr8wjDEX6O3+shUCbUma8uWr 3B0ngmS0D6158EOLasAa42RvSfaKgItsMy+WeUVvNq8rLEghfn1U5zkms/sCijRY4e2uR5 cY1rWg5LWCDeTrYucUZIlAVlFk7fU9kpOqoH4S+tdnU9zu0AY0PX05sHBZBU5xxpCqTLR1 6FXFvV02uBDoKJEzlmf2BGZIY2TkkGjrdpZPCRGdFqAAoZ3EUUyBUND3ldhkkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a7ZA27MmqHBThMt2uWDIq4igiFRzdlFn2uWGK6r9b0Y=; b=R39CCTKkotWziKTcw8ZOC/R2gWzntofUXUi0hVnH2Eb2TgNasscx1ItLSeFnI8UWifPpu1 l3szBhnl+xTg3m02t76PjbV8ST1ZkeRvHIADWQ9PIJx2rhseqWCs4YET2BSGGsWZBJeZL+ 2gsBq6jnvkxdjaL1yasit1VGNXO5dhkJcSn84TcJ63dqG/+ms17RzqomNhn6lr0VyHQCAY XyesWxXIrnRsDPl4XCpzF9enYksIQHMum+HEeljJcNLD3ibWfZNdgO1tXZeKVuEOQtlgec ssV/qwc9UBOTa6IKpRhZqaLcHPAs2orLSsALb7w0VTXmEMsphO7FsZOn/fsXNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679502275; a=rsa-sha256; cv=none; b=kPOIK5SNmdjzDE715Ez+eSMao3jOdkiP8TmvqkcmbzTerzOiqIVGhryrY/omRfkDXDEfAT Uok5oN1boIR1bt1xK5vHiB0Qo9x31tsVxSK0kpgPTwglV8pnhOYGV7tMeSVhCsD7QApZwJ c2g9T4UMc80sZ6byZ16sYINHspHApw3V9Y2q/dnVzrlVqCZILrIC0lmyZpn6KsAOD1QwjK leQ28pp+8xSb0BYmH8q2PLEE1A/pIAV/bQaPhgjnAJuUSnQUG3yMv0BoPaMz4nJ595OKl3 Qgccm7KyDjshYy8gdhc02OqwAIK4OxX96b6Eeeo+DSmA5INSHL+7ye5BUmpmhQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhYhg2DBDz11Cn; Wed, 22 Mar 2023 16:24: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 32MGOZcl007643; Wed, 22 Mar 2023 16:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MGOZIm007642; Wed, 22 Mar 2023 16:24:35 GMT (envelope-from git) Date: Wed, 22 Mar 2023 16:24:35 GMT Message-Id: <202303221624.32MGOZIm007642@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 3d2837f3bd04 - main - arm64: Fix sig_atomic_t limit definitions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d2837f3bd044d879d652e64ced79cd890e690c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2837f3bd044d879d652e64ced79cd890e690c5 commit 3d2837f3bd044d879d652e64ced79cd890e690c5 Author: Brooks Davis AuthorDate: 2023-03-22 16:22:21 +0000 Commit: Brooks Davis CommitDate: 2023-03-22 16:22:21 +0000 arm64: Fix sig_atomic_t limit definitions sig_atomic_t is defined as a long and thus is 64-bit on arm64. For some reason its limit was incorrectly specified as a 32-bit number. This had the unfortunate side effect of causing gnulib to override most of the definitions in stdint.h. On CheriBSD this breaks all software that uses gnulib in annoying and hard to debug ways. Technically updating the limits might be an ABI change, but these defines are largely unused (the only use in tree is in the libc++ test suite where it's use an assertion that will fail due to this bug). Further, since the underlying type remains the same, we're just increasing the range of values a paranoid program might use. Reviewed by: andrew, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D39193 --- sys/arm64/include/_stdint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/include/_stdint.h b/sys/arm64/include/_stdint.h index 32e5b6fd081e..d73a9c088b59 100644 --- a/sys/arm64/include/_stdint.h +++ b/sys/arm64/include/_stdint.h @@ -143,8 +143,8 @@ #define PTRDIFF_MAX INT64_MAX /* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX +#define SIG_ATOMIC_MIN INT64_MIN +#define SIG_ATOMIC_MAX INT64_MAX /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX From nobody Wed Mar 22 16:24:36 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhYhh6518z411n1; Wed, 22 Mar 2023 16:24: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 4PhYhh40dDz3MlW; Wed, 22 Mar 2023 16:24:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1IBHJFdFPhCWihrwO2Bii+cEMyNouWmdSH2D3pPA2pE=; b=pHuOshjjOvsM2MVStYJKlYGtEqFtpLq7/0hBXECKTFjrhnIMBz9hvjy9S8Fr8DptRD64Fy nS+3XdbX98k0N+mebNx0/ciK1znxy7JK/yEhKc4tG/u2qEP5CAtaJRNKPui7Oo5/GeXsbI llLIKIxgLddRwIV8p8nBU41+WUJbJBJAsQU2gAZ9LIZ/Yuq3aWRqJPj7PhkimsWEvzILUI MTfB1ix0drDPepXwfYqyeg7hLVYct1RiBWCwiXAQ6AXVoPXGt3SNqV3tWOKg57RxFwQZbG YVF9g6D/N115jX/hMHUKSRDWhNvOhwLsLG0wbWuIvbD/1+uO7/iVViO0KfYKUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1IBHJFdFPhCWihrwO2Bii+cEMyNouWmdSH2D3pPA2pE=; b=no3bQv5P12tAo8/lDdlTLSADSp97vDWvK5YjSvhgyV+kIx7aQDDhatIP5rNa5K2K1jqg1i a2S8GNULD3nj0vIfBNrq1NtqrQpYGqmuEAAyfgMQANqfidrsDOxF7ifnX7hxshp/AO+1sM Q+6wfGBAMqG5SYUsfHDMG8IwdZiZxSGfCs5GqFVzdMkaEG+W2mztrP4TX4PgEfJJGVRkPS GZMYI3fuOKFECLTl7lEdAAkT7tAdTkS/i20rMeN8Er6bUWZC8nnGOh4jA9UYSaP67MH/90 80JVrvlLyXn1mano1kYh8dkcqwWYiBmq9/DHUyMwDeSUiVpK73Ms9ZR1JcHWlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679502276; a=rsa-sha256; cv=none; b=hh49Dup+KJZftv8xB3r5840Lfi/QlxmX8HwcqAQS/sEORNXkgKbwqBknn6yZlGWV2EXrpr CgpgetCqflvIvUwXiG0SJAftq6WKJz4p2hjDxCOevYCP9F2mbcU9x8e3k+nQShyOOoNkiE NLAqAUNjem3MTmTG/MNudUyGnaE8q9dUE9yNluzn6wKVRyVqVVZdti2dB6fHpGWbLnOz1A 6QPZaWHV8GOY3EM671TG3EzjEN/VSW2lcsDw67tSUxicWbeRZYvSjVy3iU5Ju9zJAJdSd/ 0sj+9p4+QzeAkhtDlhKNexU7kNZXakAJqAvwmQE1SlAE+aR8KiAXSUPFkxfJvQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhYhh336Cz11W3; Wed, 22 Mar 2023 16:24: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 32MGOajs007667; Wed, 22 Mar 2023 16:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MGOa5c007666; Wed, 22 Mar 2023 16:24:36 GMT (envelope-from git) Date: Wed, 22 Mar 2023 16:24:36 GMT Message-Id: <202303221624.32MGOa5c007666@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: de761318a4a0 - main - riscv: Fix sig_atomic_t limit definitions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de761318a4a0a030035657ff72ddc93bdd2e0bb0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=de761318a4a0a030035657ff72ddc93bdd2e0bb0 commit de761318a4a0a030035657ff72ddc93bdd2e0bb0 Author: Brooks Davis AuthorDate: 2023-03-22 16:23:22 +0000 Commit: Brooks Davis CommitDate: 2023-03-22 16:23:22 +0000 riscv: Fix sig_atomic_t limit definitions sig_atomic_t is defined as a long and thus is 64-bit on arm64. For some reason its limit was incorrectly specified as a 32-bit number. This had the unfortunate side effect of causing gnulib to override most of the definitions in stdint.h. On CheriBSD this breaks all software that uses gnulib in annoying and hard to debug ways. Technically updating the limits might be an ABI change, but these defines are largely unused (the only use in tree is in the libc++ test suite where it's use an assertion that will fail due to this bug). Further, since the underlying type remains the same, we're just increasing the range of values a paranoid program might use. Reviewed by: emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D39194 --- sys/riscv/include/_stdint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/riscv/include/_stdint.h b/sys/riscv/include/_stdint.h index 32e5b6fd081e..d73a9c088b59 100644 --- a/sys/riscv/include/_stdint.h +++ b/sys/riscv/include/_stdint.h @@ -143,8 +143,8 @@ #define PTRDIFF_MAX INT64_MAX /* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX +#define SIG_ATOMIC_MIN INT64_MIN +#define SIG_ATOMIC_MAX INT64_MAX /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX From nobody Wed Mar 22 16:24:37 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhYhj5F4Wz411rB; Wed, 22 Mar 2023 16:24: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 4PhYhj4m9Wz3Mnt; Wed, 22 Mar 2023 16:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+BgQi+gWbsMzV+zH6CDV9uLx3vDqsuc4D4eG/Q7MyLc=; b=YEWS4AJaIzSYauC2O4jf0GtRkwed18B+/us80YSf+nANAJbUPO+UUui0yGH5wZy/4wsdwZ pvTAxp7zZdcay965DJds1uulsPY2ppuSD9k066hvNHZF0dn0mtwELw0azw/cw3HshoS4UU LcjXAUVr4ORkShl9NbzLKuA7CqDdNltJTRvIDE63+Ao5hs/zzI6ymrg/iHWxXL+yUXckPR iZ06sWRH1CbOS72GJKDADzxXhg9wxFo9mgQmXGefHpN3Dd+FKRFsbLfde/8c0TQTZdJn7R xDOB2EHzf366IgWGVK7GZ0DCLLmZCch+lKopNIYHxfGUSQWBJ8BRVFAO8snDGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679502277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+BgQi+gWbsMzV+zH6CDV9uLx3vDqsuc4D4eG/Q7MyLc=; b=wMj1X9cuTW/k7NhMo4oteDF5bx003iEuYjo2TpdlA84Cs6ilez1V4PYy3nslnKUzrUBX9I kk8l+7Cvh69EEgDYuPBVnPd3SsSde8PSvyQ+aQaYtrZ0zTzasMDCcpA3dBwpLYFJNGFWKa 9OGn0APhnSbU9hJyvASEQo2Xipmtcv+R4iNXoNuazxqp5t3d0kA8Rc3sBskQ53yZ7nRvWa JVmXr6jzM0MZD0eYAD3fDzDi0edtYORe7E2y66ToSxLePlVJaBa1pN7f6kComwEYnIvNb9 w1M8T/ykBFssMhiyE4eEZ+IrfIr/mT2QyOUuz1USUEhH8sxCn8V8B3Osiv+2cw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679502277; a=rsa-sha256; cv=none; b=qvwaDlRvaGqOVVZW5LiATekEPxrVcGtVGvDT7BEC61gY7nc9CdBNcXfE26/tA29NIipwFt 54Omhbkn/OamzN14nmntOVcuwadysHwk6IrrEqRmNyY56h1eAXo//3n7LGgLiYma17R0pn DAtwHFCFbqt8uddV0XOXYOsWsUJtEk+i9ny5SNZbieozRI5OYnqe53/ucuof5G1FHb+h1S Yj+0O/kH8Qq0qA0jzV5W4aPm0vsAe8rroW7CCkSGibimjydjX7T4v4fB6EODWxbpp/79bI M2Iewu7Uw8liX5oiMC6Utns/4GNxjhU4RLRU5EN2Oneq1Inc626peFN5ltUkig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhYhj3rpDz11G7; Wed, 22 Mar 2023 16:24: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 32MGObXf007693; Wed, 22 Mar 2023 16:24:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MGObJx007692; Wed, 22 Mar 2023 16:24:37 GMT (envelope-from git) Date: Wed, 22 Mar 2023 16:24:37 GMT Message-Id: <202303221624.32MGObJx007692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: eb232cffc92d - main - amd64: reduce header pollution in _stdint.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb232cffc92d3bb9776cf0ce0c9a9c30913f8cfa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=eb232cffc92d3bb9776cf0ce0c9a9c30913f8cfa commit eb232cffc92d3bb9776cf0ce0c9a9c30913f8cfa Author: Brooks Davis AuthorDate: 2023-03-22 16:23:57 +0000 Commit: Brooks Davis CommitDate: 2023-03-22 16:23:57 +0000 amd64: reduce header pollution in _stdint.h In 38d1ac34ff82bd2aeb308b52a65b686060e52873 SIGATOMIC_{MIN,MAX} were defined in terms of LONG_{MIN,MAX}. Later, they were switched to __LONG_{MIN,MAX} in 78fe75bc280264e7471b3069e148cae32e8ae211 where an include of machine/_limits.h was added. Switch to using fixed width INT64_{MIN,MAX} and remove the header pollution. No functional change. Reviewed by: theraven, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D39196 --- sys/x86/include/_stdint.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/x86/include/_stdint.h b/sys/x86/include/_stdint.h index 1607db0de9b6..e891e2230b30 100644 --- a/sys/x86/include/_stdint.h +++ b/sys/x86/include/_stdint.h @@ -42,8 +42,6 @@ #ifndef _MACHINE__STDINT_H_ #define _MACHINE__STDINT_H_ -#include - #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) #define INT8_C(c) (c) @@ -171,8 +169,8 @@ #define PTRDIFF_MAX INT64_MAX /* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN __LONG_MIN -#define SIG_ATOMIC_MAX __LONG_MAX +#define SIG_ATOMIC_MIN INT64_MIN +#define SIG_ATOMIC_MAX INT64_MAX /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX From nobody Wed Mar 22 19:00:43 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phd8q63vFz419jl; Wed, 22 Mar 2023 19:00: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 4Phd8q5g46z44d5; Wed, 22 Mar 2023 19:00:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679511643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8lmKdqywq3cbQxBJNndz+waTnVU7TUUcRS2QLLd62l0=; b=I6wq8sdeXhbj3+pPnsnv3pPbFTAMS3mb3HiBxD2hQVeRvFdQDJeXPVEZJ5r4qdeKAVGvkl pyKofc2iCLhVT4GvfteS3wluGjEiVsMzzB6C1g/q5UFoWHluiC79rSr+AuVCImEVTa3wZH DwZGFDa0Hrnq8MBY7rtEohTuwIhVKDce7jyBWivZHRM7ABlHKdbZUIQE0OnSTQvQxpFQEI uIdCoG2mQIjwu6C1TOh8EUnqr/j6RTFjj+4xGuaaXtijq3mABX4xQzYSCfhw7hBsYShIon Jt6MtGXraf3WogLuRmMpCD6VyhXzwzJG60xr5cl6Hi8kwTK5FZZ7/KICTzjkkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679511643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8lmKdqywq3cbQxBJNndz+waTnVU7TUUcRS2QLLd62l0=; b=DqEu/+vEMP3xYHr3c+33gom+iPh5cXambX//MXM43hP1Lq/EEXrc608aBeUPOmzhGcPmp7 zoSuuvkBNiVLN0yC58rc+IaiHTmFLi55mRpMOJizr4GL5fB8HCFHlFrlNu+29xQoUfbeL0 djCDAF2p1tE1xSBrVgWiQ3NG+srANOkuTf4ufMbm09gLNohozvPGrsQNOFO+GmXbDP/3VA YkxpSoZkXGa2RSHPSyId7u/Ut+PDg3ceX/Dp3esHF4hMVOZqQfuoCfrzkILMsJJzhMVz9M oBCymj74y2lTbywiS4vZ3/IxGBGvKMU7Vif7mJzxnn4nfMLgnRRQPtx4MgkKgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679511643; a=rsa-sha256; cv=none; b=VoySfGwednXfn7JKMFwHxnFKaQc9QAgQYOTP5RPAwuqwisM6r5zJc1Tv3cV94PCzMI7Is6 Y+fZQXuLLvECUrve2yid/c/KMoXehJ0AhcV8u+41au3wRgW+uBiQorHgiwBbWIGA02bupo lUc3Bf9l6mWMGTLEVmY+0hnntzNna/lrdIUCGy68r4wdPygByiP+UgiGkOCfrHzoVH6Y0R 56VYxkgZfBjbKIqaU6zbjGbrL5ilwkCOIpD1PO/h9dyq7+gwycGjzdVBFUr8gfgjJ1rA6o z+K8x43x4LgqxOfDEbKGwrC7zPA22I07HnztS0pnt7rq5/5QqecUrPd2227sWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Phd8q4mvKz14pd; Wed, 22 Mar 2023 19:00: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 32MJ0hOf063901; Wed, 22 Mar 2023 19:00:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJ0hXW063900; Wed, 22 Mar 2023 19:00:43 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:00:43 GMT Message-Id: <202303221900.32MJ0hXW063900@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: f9c7fb7caed0 - main - arpa: garbage collect ns_newmsg/ns_rdata decls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9c7fb7caed063757c7bb6a08cb5e81b2bbb5a6e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f9c7fb7caed063757c7bb6a08cb5e81b2bbb5a6e commit f9c7fb7caed063757c7bb6a08cb5e81b2bbb5a6e Author: Val Packett AuthorDate: 2023-02-06 19:03:58 +0000 Commit: Ed Maste CommitDate: 2023-03-22 18:58:23 +0000 arpa: garbage collect ns_newmsg/ns_rdata decls These were brought in by the libbind import, but these functions were never actually implemented anywhere, only header declarations and symbol map entries were imported. Fixes: 046c3635cdb2 ("Bring final version of libbind:") Fixes: e45764721aed ("Update our stub resolver to final version of ...") Reported by: ld.lld 16 being --no-undefined-version by default Sponsored by: https://www.patreon.com/valpackett Reviewed by: emaste Pull request: https://github.com/freebsd/freebsd-src/pull/700 Differential Revision: https://reviews.freebsd.org/D38407 --- include/arpa/nameser.h | 40 ---------------------------------------- lib/libc/nameser/Symbol.map | 10 ---------- 2 files changed, 50 deletions(-) diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index 5dcc4f3b911c..69ec06dd7233 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -133,17 +133,6 @@ typedef struct __ns_msg { const u_char *_msg_ptr; } ns_msg; -/* - * This is a newmsg handle, used when constructing new messages with - * ns_newmsg_init, et al. - */ -struct ns_newmsg { - ns_msg msg; - const u_char *dnptrs[25]; - const u_char **lastdnptr; -}; -typedef struct ns_newmsg ns_newmsg; - /* Private data structure - do not use from outside library. */ struct _ns_flagdata { int mask, shift; }; extern struct _ns_flagdata _ns_flagdata[]; @@ -571,16 +560,6 @@ typedef enum __ns_cert_types { #endif #define ns_makecanon __ns_makecanon #define ns_samename __ns_samename -#define ns_newmsg_init __ns_newmsg_init -#define ns_newmsg_copy __ns_newmsg_copy -#define ns_newmsg_id __ns_newmsg_id -#define ns_newmsg_flag __ns_newmsg_flag -#define ns_newmsg_q __ns_newmsg_q -#define ns_newmsg_rr __ns_newmsg_rr -#define ns_newmsg_done __ns_newmsg_done -#define ns_rdata_unpack __ns_rdata_unpack -#define ns_rdata_equal __ns_rdata_equal -#define ns_rdata_refers __ns_rdata_refers __BEGIN_DECLS int ns_msg_getflag(ns_msg, int); @@ -653,25 +632,6 @@ int ns_subdomain(const char *, const char *); #endif int ns_makecanon(const char *, char *, size_t); int ns_samename(const char *, const char *); -int ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *); -int ns_newmsg_copy(ns_newmsg *, ns_msg *); -void ns_newmsg_id(ns_newmsg *handle, u_int16_t id); -void ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value); -int ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname, - ns_type qtype, ns_class qclass); -int ns_newmsg_rr(ns_newmsg *handle, ns_sect sect, - ns_nname_ct name, ns_type type, - ns_class rr_class, u_int32_t ttl, - u_int16_t rdlen, const u_char *rdata); -size_t ns_newmsg_done(ns_newmsg *handle); -ssize_t ns_rdata_unpack(const u_char *, const u_char *, ns_type, - const u_char *, size_t, u_char *, size_t); -int ns_rdata_equal(ns_type, - const u_char *, size_t, - const u_char *, size_t); -int ns_rdata_refers(ns_type, - const u_char *, size_t, - const u_char *); __END_DECLS #ifdef BIND_4_COMPAT diff --git a/lib/libc/nameser/Symbol.map b/lib/libc/nameser/Symbol.map index 2c4b76e69410..b91977b9a07b 100644 --- a/lib/libc/nameser/Symbol.map +++ b/lib/libc/nameser/Symbol.map @@ -39,14 +39,4 @@ FBSD_1.4 { __ns_name_owned; __ns_name_map; __ns_name_labels; - __ns_newmsg_init; - __ns_newmsg_copy; - __ns_newmsg_id; - __ns_newmsg_flag; - __ns_newmsg_q; - __ns_newmsg_rr; - __ns_newmsg_done; - __ns_rdata_unpack; - __ns_rdata_equal; - __ns_rdata_refers; }; From nobody Wed Mar 22 19:35:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhdxG6ntXz41D0x; Wed, 22 Mar 2023 19:35: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 4PhdxG5P6Gz4DQh; Wed, 22 Mar 2023 19:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7ecXVVKdbZzozdQivX0/udrp8V3rqA9+KO4vrGpODSE=; b=BCtD+NdeR/re3A+oc+uNx4+lWt8pw7Fof1MvV4jzU6yUOauRQ6Rl4XCSUFEGPxllloPHp4 q0YRBv20TuSOwsNTEnZw6juncMSiI8+CMNXJW0R/Fpm3TL9TrWHn1a3loDOpTKjLn1bvum tfC1Xa/UuF9eBKVVHxeKoZ5Sr9rIYWuATIv6jTv88Sr2Jc3rw3qZveatveqUN2eSon0ROS xWfKNA+sbw8jxOBItpjTE00mRd58eYJIsJMiuqTXoo5Rgg7nkLiqq+Av6/YIsuVzap370U Pz3kHbjdAE9m1KFL4+T0wv7MprqNZxw8FsGV4A381rS59TsW7fO0nnyj2zmc4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7ecXVVKdbZzozdQivX0/udrp8V3rqA9+KO4vrGpODSE=; b=dlm/npqryhhrWpe8N8dXWpUtL4pwVuEBLrHbNfJ++9o+N0TllMXdHxZ1KQJ35brdZYcXo9 4yTPNOGQxvaltekskyDBxaMkDoQ0votCT3+Vik239ctTfeKjcG6XesoousEtm6e29whorP KOQsVa084te04mylDNzKRXsWpTAYPpAnFwfi6chPiK8/l9TIAgFu0z5SYo9G44Rh9uya9s u6ELnhYFpXW2ZWnn4ZvDzQrBDMBz4pqBs5zrPiEvrPgr2Xw1K92wFP/kJ42vp/lcOUCeOi sdr0kcty8doUdTfMZRu4VVwLgH0gS7R/+Dp4LViGahTXNxdR9oa5JzuAK4twRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679513746; a=rsa-sha256; cv=none; b=QBMaWwN14MPsCBWcJLihmEGp+HHeyTstSxkbfaGf8zYURBOwCuCB6dg+hfxXIK2jljpN+y 0jgaV0msAz6u7+3qZTs/TSHFun249ugNkjA3Cskekp+xHuFURqfaidrjebyNvObcI08qrO 8LBjHPWF2r9pTdQFED08Zyt6lsRPwFf+M2VNKe1pCd85fvZ8UfthO6ZzgG2yL/AFwaKZLc WFxJDuV5u/PcnyS3E+A+U1KBJHUp+WLm/l34rgHeXQp18VxvZJ9KIFvkiMX8CefPbQA7Xp yn9KWyZaaQjK6cOb3thEZw+3d+5SKutwesvRvrMf5XHduEYKXOXrpMX04WQP7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhdxG4VtSz15bf; Wed, 22 Mar 2023 19:35: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 32MJZkHK019748; Wed, 22 Mar 2023 19:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJZkRa019747; Wed, 22 Mar 2023 19:35:46 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:35:46 GMT Message-Id: <202303221935.32MJZkRa019747@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: 48c519be0e80 - main - libpfctl: Don't pass stack garbage to free. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48c519be0e8005aedc817b1bc1101ad32b67a67a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=48c519be0e8005aedc817b1bc1101ad32b67a67a commit 48c519be0e8005aedc817b1bc1101ad32b67a67a Author: John Baldwin AuthorDate: 2023-03-22 19:33:59 +0000 Commit: John Baldwin CommitDate: 2023-03-22 19:33:59 +0000 libpfctl: Don't pass stack garbage to free. GCC 9 on stable/12 reports a -Wmaybe-uninitialized error for the call to free in _pfctl_clear_states. Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D39198 --- lib/libpfctl/libpfctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index f95f79024bf5..f34f83cfb57c 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -1188,7 +1188,6 @@ static int _pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed, uint64_t ioctlval) { - struct pfioc_nv nv; nvlist_t *nvl; int ret; @@ -1211,7 +1210,6 @@ _pfctl_clear_states(int dev, const struct pfctl_kill *kill, *killed = nvlist_get_number(nvl, "killed"); nvlist_destroy(nvl); - free(nv.data); return (ret); } From nobody Wed Mar 22 19:35:47 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhdxJ03K0z41Cf1; Wed, 22 Mar 2023 19:35: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 4PhdxH6Gx5z4DPm; Wed, 22 Mar 2023 19:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sv/CekILKvFxrcdfbegckKu/48k5tF9Eu6QstQez27k=; b=ayEMb9QojPSVaZM21ZWrHLLafHjUOzmH/qLLvg4eN5gqVdmnSZwM+o+cTgekJH82Uh46lx AZjDBsqGacbsOOD9TmrQTLSMiJligd1QqsDcmfnfjYOw9F96n5eXfU9dw48nsghofIx8dr tghvY2n7O810L0NcZPYKj0K4M8sOhbPV9giN/G7I5YnakxBrhUuSMlowWZ0FTys1hC9K65 u5BdzZsY38RRyNkn2UHLViIlP19ME4dIjF9se8iFcEP4yNRvPwxwHc95dZoA3QRHhf15nj d3URv81PoV1stZ8v01f9Ct9cSmgZfBTmpZfXZb0hGmOCERhEBvut82bWJdb2Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sv/CekILKvFxrcdfbegckKu/48k5tF9Eu6QstQez27k=; b=mDB254v0yP2e64a/aYPhkWDsIs2YWEOmX1ZRmm8XhoIQ/2oWdXqAjG8Tr0K/VdaNJ3MkMK VUORpxU2dY611B7CMMqMBI6aPioHfUxnwIxtx0nU4H6eQP7IMocg37PsPNsAw8XOM5sTEg jCQtzOFULc4+LiYUqWS9uFuxIWntF+jUBCp2RITasShRmA8Qte36DNDT9HTWtheO0AzDnt cww9Nycy3JzlImJgWX2kVl4t7fRudd38k14yudR9vfY266dfxat+WMQH37MOAnfBy1I9IA vJfA4Os2q+2S1DhA6JqT5dRI/VHxqLgwUH//MWvhKQKhcXfjQ7puEaPovqdvfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679513747; a=rsa-sha256; cv=none; b=ArNf3TuonPnTlBS7SU5N665lm9Z86XmzpxVJWpXDLh3bxAkqPFYMq3i5MvOUDj3CgNVu5a iwQpwk3VgUoxnuYk+hoIJ3Apk0RsOBwwTwg2m6yXAVFlZJ/yxW0AnsqAU6ZmIkAa+IQmXG 5tjWgSZrLtiYgwL/UZD/qoWCJG6Nfa5oaCmkXFW+In5X8TSyHWNmeLhBVGZfB32gtB8sNE ftxrKnGlfo2w/t3Ndwj9c1geHUKtjR9E8b2tQzHZ22TuJ0A8l9jdGshtFcrZMsjtz+LK4z fyUDG7OBKz2i6Vor3pueAih613SXNZ6XnMQRqrvjjlK+iO2/MDqi0Q9j0c8Uqw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhdxH59pVz15y4; Wed, 22 Mar 2023 19:35: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 32MJZliT019773; Wed, 22 Mar 2023 19:35:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJZlHM019772; Wed, 22 Mar 2023 19:35:47 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:35:47 GMT Message-Id: <202303221935.32MJZlHM019772@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: 61482760a0ca - main - bhyve: Accept a variable-length string name for qemu_fwcfg_add_file. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61482760a0ca198a9310d450133e9ac792b67955 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=61482760a0ca198a9310d450133e9ac792b67955 commit 61482760a0ca198a9310d450133e9ac792b67955 Author: John Baldwin AuthorDate: 2023-03-22 19:34:34 +0000 Commit: John Baldwin CommitDate: 2023-03-22 19:34:34 +0000 bhyve: Accept a variable-length string name for qemu_fwcfg_add_file. It is illegal (UB?) to pass a shorter array to a function argument that takes a fixed-length array. Do a runtime check for names that are too long via strlen() instead. Reviewed by: markj Reported by: GCC -Wstringop-overread Differential Revision: https://reviews.freebsd.org/D39211 --- usr.sbin/bhyve/qemu_fwcfg.c | 6 ++++-- usr.sbin/bhyve/qemu_fwcfg.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c index 1b0b5e3e9931..2d91213dc7c5 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.c +++ b/usr.sbin/bhyve/qemu_fwcfg.c @@ -261,9 +261,11 @@ qemu_fwcfg_register_port(const char *const name, const int port, const int size, } int -qemu_fwcfg_add_file(const uint8_t name[QEMU_FWCFG_MAX_NAME], - const uint32_t size, void *const data) +qemu_fwcfg_add_file(const char *name, const uint32_t size, void *const data) { + if (strlen(name) >= QEMU_FWCFG_MAX_NAME) + return (EINVAL); + /* * QEMU specifies count as big endian. * Convert it to host endian to work with it. diff --git a/usr.sbin/bhyve/qemu_fwcfg.h b/usr.sbin/bhyve/qemu_fwcfg.h index f59087250816..f3846d64085a 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.h +++ b/usr.sbin/bhyve/qemu_fwcfg.h @@ -18,6 +18,6 @@ struct qemu_fwcfg_item { uint8_t *data; }; -int qemu_fwcfg_add_file(const uint8_t name[QEMU_FWCFG_MAX_NAME], +int qemu_fwcfg_add_file(const char *name, const uint32_t size, void *const data); int qemu_fwcfg_init(struct vmctx *const ctx); From nobody Wed Mar 22 19:35:48 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhdxK1LnRz41CxZ; Wed, 22 Mar 2023 19:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PhdxK07P9z4DRC; Wed, 22 Mar 2023 19:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rLEQ3uAwb85/YIORX8fNZkqUyhTVMIFta8D2l0Q11Xo=; b=GUKbrqDv661i0/H0ldsDbDpkkY8oJnJzJ3UEcaSSradwwfIYfHKylDmC4YGh2gtaT5ere8 AW+/TTo9DwvX14HGFRd8ETp+D4p1R6j0TYUoz8jvVLNLDNQZLvgkE5atYPQBfE5oUyRSdD fQ9pUgeapdkWB7QMJzI04PX85yWkmFIYZCtxHeG3B9Ryhh4uId3aPGPSHb2o+GUD9Af6RA NPyQTEXXFVEtQr6VdvdbCnstfiAnvVhjMgvDua+Ew4Za0AGM8VLuyLCAIl/uzt4ADDC02/ 3y//tk5LgrEfcCnqEUhKqHUOkLbVOF+VwMNBjgmomvBxH0Gv5UIlIepvyn+pPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rLEQ3uAwb85/YIORX8fNZkqUyhTVMIFta8D2l0Q11Xo=; b=eFfIGa/Z3Crxr9gImspJff+34UMqAdnQ6Nz4NRnpPFt1haptpyuM97xEc8pg2EPaQF/uRP Wf5P5oCzVL7wj6A7UPH1RY7rDE9uVCodhJdfp7b7JCCrBqgk5yyNJybYKIVEqicHVXYvD3 X8tq4tnQd9Z7gUoi4pRckDWuAjghR28b/kLQ2z+0gPlaUjH7S/VYjnAOPyAanovUN2tU6Z hMzWilDQgCZiW8gmCTwr7VFllGcAWnpRXvJyHufMtsc83xSZVhIYv+EdRp1aO7D7dN0FkT Z8KCrT1aoZnUnkvmvSzcmNbeJ1DjDTF6y0WEtGXTSBPuBHaj+b2QQ9f3b1IBPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679513749; a=rsa-sha256; cv=none; b=GUx56kHB4PqVnryF6EeoIEWz8H6XRxpgeTQZKZAoZEa+MeV2HEuiQJw+Wfz6YBoZovjWIJ UiRXiItZwT2qtrT5b5S+a3SbGf3Yn0YBW8tiZru14kPCKAZ5tZoHXZrtgZFfGZPvNDiPs4 aLgtqBYESpET1r4IJDusz++kwy7sUfXqOIUXFCAHd7T2P6T1xPkZhsUGDS4lfn9JqHf2rK /7m4RZiyfaCvOxGzko4FalxlXSe0TRjwWS5J0ZJvg8fXYMLdEtXlr77+rVIrmKKjlNxt1/ w3LpLOyock8YDSWgMAYoRRygrt2ykDW50Rw0gLunpiVhYkZvWWFQB8rxKbo81g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhdxJ61g6z15bg; Wed, 22 Mar 2023 19:35: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 32MJZm85019803; Wed, 22 Mar 2023 19:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJZmTA019802; Wed, 22 Mar 2023 19:35:48 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:35:48 GMT Message-Id: <202303221935.32MJZmTA019802@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: 7bf44831ca05 - main - bhyve: Don't return -ENOMEM from qemu_fwcfg_add_file. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bf44831ca05c67169fd90408b514573ddbbcf9d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7bf44831ca05c67169fd90408b514573ddbbcf9d commit 7bf44831ca05c67169fd90408b514573ddbbcf9d Author: John Baldwin AuthorDate: 2023-03-22 19:34:56 +0000 Commit: John Baldwin CommitDate: 2023-03-22 19:34:56 +0000 bhyve: Don't return -ENOMEM from qemu_fwcfg_add_file. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D39212 --- usr.sbin/bhyve/qemu_fwcfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c index 2d91213dc7c5..2cc334190c15 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.c +++ b/usr.sbin/bhyve/qemu_fwcfg.c @@ -300,7 +300,7 @@ qemu_fwcfg_add_file(const char *name, const uint32_t size, void *const data) warnx( "%s: Unable to allocate a new qemu fwcfg files directory (count %d)", __func__, count); - return (-ENOMEM); + return (ENOMEM); } /* copy files below file_index to new directory */ From nobody Wed Mar 22 19:35:49 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhdxL2D6Mz41Crl; Wed, 22 Mar 2023 19:35: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 4PhdxL1ByRz4DV5; Wed, 22 Mar 2023 19:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wrOOSHVt10DS+g0Al5FX9O2EpfKLeOONxQN6BxvtmXk=; b=iQIon5guKpthQiBBV1cWViW41EvUwgKQBZXgyrlD6EOZQF+Z1JZiq53uRI2tvRlBJlN2qH CIp7cDHv9hKhsOuYikZwFcQNa1d7DMyNXsxZi9eNzMgLpekeKfYDVQ9RD+xEy6SO7C+HGW N9KLdugCPntrvNyuci9kbIFSOJCyGMMqKlWyUo/eCKjJGzTTTgvQDLXWpXJmzQofnTZsgL FHJwrJxH2e8Rx5YIg0+t2wasijoL/dC79wf+4NUt6r6bXozjUrfBFpFy/drpBgGan7UE0E zl8g4WJM3TJ/L4i5D4J9VMAYrK4tHkqb+1SI1EApLgJLT4BM29uZXH6P6KdVNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wrOOSHVt10DS+g0Al5FX9O2EpfKLeOONxQN6BxvtmXk=; b=gQDdbdSLaj5RM7GUDbf9zAAtqlSQIUrLBgkKCw4ZE+5e8R27dDie2PVGrgRlCkQ16LP9/Q M+u2QRQsQbgBdu8MMr02KJ9yw22I/ed3Dy3v4vL9p0io8QZei4Vmu6VBKiiA+VyrkNpeLB dY2icD0uObpTypuc2CIgzXnfurwyu41DNiHC2cL/tLFcdQ7N1CYQnR427KGzIcA+fzMpgZ //rCZIGoWLDBRNxPdPSrtij4Ax4+8Iww03lD9Y+W7TNNOIluNxmv2yk0gb7L3BdQlbGjE3 JVb5jreYfzSb3KzTFCaVvlQ6fCyzKVtwmdKufdZHEXwDvfv/4iSenYFEtM7b9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679513750; a=rsa-sha256; cv=none; b=yIjeE0pO9Ipkr84WG+BFlFBWM3nea/AZBfY/e2LribeaGrapCGBDQiH3M7cPYDdJWNyDSm eXo5GpaEG7SOAGGV33DiAYa85vHZz8K1tuyHRbRy0sdPZ7Zx6l9R2OzBmpFsxjTAn0bAcE NT5txAMF8arErufQC8sEMLjjt/WEv5oZ7zPFH9uPnRqbOThCbHL54wJK39+j5bgvr0toKs 68tukBjMXUvnZgYIZ0ue6OF3bTyCmkV/sIT5FZmkLpbnBBf2AAp14uFATh6p1hIUE0z6v6 IQCjJCrfUt6FjA0wgeoelPaJROrsUJbRlkXrtdcvHn9STlHM8+DbxJXmKlhQEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhdxL063Fz15tr; Wed, 22 Mar 2023 19:35: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 32MJZnW3019822; Wed, 22 Mar 2023 19:35:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJZnL9019821; Wed, 22 Mar 2023 19:35:49 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:35:49 GMT Message-Id: <202303221935.32MJZnL9019821@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: 4ffeb3b88ed2 - main - sys: Stop enabling -Wnested-externs. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ffeb3b88ed228e72e13abe1be888c77c6ede95d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4ffeb3b88ed228e72e13abe1be888c77c6ede95d commit 4ffeb3b88ed228e72e13abe1be888c77c6ede95d Author: John Baldwin AuthorDate: 2023-03-22 19:35:09 +0000 Commit: John Baldwin CommitDate: 2023-03-22 19:35:09 +0000 sys: Stop enabling -Wnested-externs. clang doesn't implement this warning, so violations are only caught by GCC. It is also no longer a common practice to use this as it was in the original BSD code, so the need for the warning is not as important as when it was used to do cleanups 20 years ago. A recent commit (c3179891f897d840f578a5139839fcacb587c96d) triggers this warning on GCC, but that commit uses nested externs purposefully. Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D39214 --- sys/conf/kern.mk | 2 +- sys/conf/kern.pre.mk | 1 - sys/conf/kmod.mk | 3 +-- sys/modules/pms/Makefile | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 74c47479ab9e..a80d6211c182 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -3,7 +3,7 @@ # # Warning flags for compiling the kernel and components of the kernel: # -CWARNFLAGS?= -Wall -Wnested-externs -Wstrict-prototypes \ +CWARNFLAGS?= -Wall -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Wcast-qual \ -Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \ -Wmissing-include-dirs -fdiagnostics-show-option \ diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index ca04e348808d..ec5c1d331533 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -225,7 +225,6 @@ CDDL_CFLAGS= \ -Wno-duplicate-decl-specifier \ -Wno-missing-braces \ -Wno-missing-prototypes \ - -Wno-nested-externs \ -Wno-parentheses \ -Wno-pointer-arith \ -Wno-strict-prototypes \ diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 9c681bad3c80..83506ece333d 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -551,8 +551,7 @@ OPENZFS_CFLAGS= \ -I${SYSDIR}/cddl/compat/opensolaris \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ -include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h -OPENZFS_CWARNFLAGS= \ - -Wno-nested-externs +OPENZFS_CWARNFLAGS= .include .include diff --git a/sys/modules/pms/Makefile b/sys/modules/pms/Makefile index 4dc00b75ff6f..3219b3e0e4a3 100644 --- a/sys/modules/pms/Makefile +++ b/sys/modules/pms/Makefile @@ -22,7 +22,6 @@ CFLAGS+=-fms-extensions CFLAGS+=-Wredundant-decls CFLAGS+=-Wunused-variable -CFLAGS+=-Wnested-externs CFLAGS+=-Woverflow CFLAGS+=-Wmissing-prototypes CFLAGS+=-Wparentheses From nobody Wed Mar 22 19:35:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhdxM709zz41D12; Wed, 22 Mar 2023 19:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PhdxM23Smz4Dd1; Wed, 22 Mar 2023 19:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BqUTERp6yFlFijgoW6mMMKV9YtnPllrxBc2wAuqiFsw=; b=iWh2Qf3DVDpLWTmif2P/8c1F7+eAJ7ZlMjR0DIrRxidxaM9c3qw0CO/WoGQ8Z+6yAUxCko yxf2D105YN24R+S7JwmzQweHNyGrjMtHWZFv0O9+pdRBHZjz9GQKF6VqVnzZwCwc24Zq8x 2A+8AOoKXgfrakhWV3q0/Ql5cnNx5Ex+7a8rb17zxW358Kx9OwdcWcFymxfA6CcZcTIsXJ Ff9jidht0Bxxh5J87SJMIr6327mbd3SN+PNDgOgwLy7G8QOsTEmBo2E3XVJKLxw0kX1IGw idNKElm62kyPsRXO11qZchv2DN/2GFw/l+81PT+HsSHrSWZ934jsT1jeeZ59zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679513751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BqUTERp6yFlFijgoW6mMMKV9YtnPllrxBc2wAuqiFsw=; b=e754Ky6RXdVRSqkwDcynrzAwttJmWzjMX978Fk0RSklBY9sLaUsiJI0UpYayq1yQqtS3RJ Zhng7PP7vigE0KvqAleKqt0sscGG0LUsYd3IJKDcE6kaAQCZoIrfvzFMBRD1W0aXsnzRQ/ 53nj4tWwirokfrhBBdyisVP66pKwoNNE0KEmi1eiy5Tl3841CMvMI73oS05AJMKoJ2rYN9 LUOargAzonqGS+k8LCmyB0/nAYXclLffmqd8ogsygKkOer6Kn5Ok/h9b3R2HoL+EcWAI+H mAcIwD2v1C3V7fk41xh7bEidxBKsrRUy9gB6Zc3ldxKj870UsGfry0hNHaR1gQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679513751; a=rsa-sha256; cv=none; b=ZUMbVbJOsjqtShABPdU4Uupa2nFVqNuVjkRxicHEF16Xz8niD/SZqFlDp58YeK6C/vmWm2 SkhYVvaZYqHRQ4D7OBtTAFTYYYHZ93ETkyZW4VtmQ6rtmX0953wBeNiYJp0NVnzpOtulXH rF1N4NykeU40GFZ+dycpPrptsOwlNxvoRrbS6tYa4ys+qePs/7vQMr/8JX3CApGFDZPDNO HW4TFq4R+ZHi4kf3c3NgiGG8Ci8yWDn5XZxTExnRF6GsCnEvnWgEsssGC0doi8NIBwc9WH us9tkGAcgbP9JjRWMO7xUAxFAo4PyxA8jG8WE/MoIF0mKQKFp1QhQpPbbyUTFw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhdxM13kBz169l; Wed, 22 Mar 2023 19:35: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 32MJZpvq019841; Wed, 22 Mar 2023 19:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MJZp0f019840; Wed, 22 Mar 2023 19:35:51 GMT (envelope-from git) Date: Wed, 22 Mar 2023 19:35:51 GMT Message-Id: <202303221935.32MJZp0f019840@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: dddb1aec4d54 - main - sys: Retire OPENZFS_CWARNFLAGS now that it is empty. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dddb1aec4d54ba949201f4a2e3146cfab4a5870f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dddb1aec4d54ba949201f4a2e3146cfab4a5870f commit dddb1aec4d54ba949201f4a2e3146cfab4a5870f Author: John Baldwin AuthorDate: 2023-03-22 19:35:30 +0000 Commit: John Baldwin CommitDate: 2023-03-22 19:35:30 +0000 sys: Retire OPENZFS_CWARNFLAGS now that it is empty. Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D39217 --- sys/conf/kmod.mk | 1 - sys/modules/dtrace/dtaudit/Makefile | 1 - sys/modules/dtrace/dtmalloc/Makefile | 1 - sys/modules/dtrace/dtnfscl/Makefile | 1 - sys/modules/dtrace/dtrace/Makefile | 1 - sys/modules/dtrace/fasttrap/Makefile | 1 - sys/modules/dtrace/fbt/Makefile | 1 - sys/modules/dtrace/kinst/Makefile | 1 - sys/modules/dtrace/profile/Makefile | 1 - sys/modules/dtrace/prototype/Makefile | 1 - sys/modules/dtrace/sdt/Makefile | 2 +- sys/modules/dtrace/systrace/Makefile | 1 - sys/modules/dtrace/systrace_freebsd32/Makefile | 1 - sys/modules/dtrace/systrace_linux/Makefile | 1 - sys/modules/dtrace/systrace_linux32/Makefile | 1 - sys/modules/opensolaris/Makefile | 1 - sys/modules/zfs/Makefile | 2 -- 17 files changed, 1 insertion(+), 18 deletions(-) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 83506ece333d..a3ff24f0571a 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -551,7 +551,6 @@ OPENZFS_CFLAGS= \ -I${SYSDIR}/cddl/compat/opensolaris \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ -include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h -OPENZFS_CWARNFLAGS= .include .include diff --git a/sys/modules/dtrace/dtaudit/Makefile b/sys/modules/dtrace/dtaudit/Makefile index 3571bcbb7ea2..72cdf03f4bc3 100644 --- a/sys/modules/dtrace/dtaudit/Makefile +++ b/sys/modules/dtrace/dtaudit/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/dtmalloc/Makefile b/sys/modules/dtrace/dtmalloc/Makefile index ffde4f811ee8..910f8f360e80 100644 --- a/sys/modules/dtrace/dtmalloc/Makefile +++ b/sys/modules/dtrace/dtmalloc/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/dtnfscl/Makefile b/sys/modules/dtrace/dtnfscl/Makefile index d28641e51ec8..6184ad183fc6 100644 --- a/sys/modules/dtrace/dtnfscl/Makefile +++ b/sys/modules/dtrace/dtnfscl/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile index 712e10331a38..0bd81bb39db0 100644 --- a/sys/modules/dtrace/dtrace/Makefile +++ b/sys/modules/dtrace/dtrace/Makefile @@ -57,7 +57,6 @@ dtrace_asm.o: assym.inc CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h CFLAGS.dtrace_asm.S+= -D_SYS_ERRNO_H_ -D_SYS_PARAM_H_ -DLOCORE -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} CWARNFLAGS+= -Wno-parentheses CWARNFLAGS+= -Wno-cast-qual CWARNFLAGS+= -Wno-unused diff --git a/sys/modules/dtrace/fasttrap/Makefile b/sys/modules/dtrace/fasttrap/Makefile index 0eecfcb11aab..1be1b97736ea 100644 --- a/sys/modules/dtrace/fasttrap/Makefile +++ b/sys/modules/dtrace/fasttrap/Makefile @@ -26,6 +26,5 @@ SRCS+= u8_textprep.c CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} CWARNFLAGS+= -Wno-cast-qual CWARNFLAGS+= -Wno-unused diff --git a/sys/modules/dtrace/fbt/Makefile b/sys/modules/dtrace/fbt/Makefile index 360d92000776..288c8cafa817 100644 --- a/sys/modules/dtrace/fbt/Makefile +++ b/sys/modules/dtrace/fbt/Makefile @@ -23,4 +23,3 @@ CFLAGS+= -I${SYSDIR}/cddl/dev/fbt .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/kinst/Makefile b/sys/modules/dtrace/kinst/Makefile index edf97cbfda79..76304a430cd6 100644 --- a/sys/modules/dtrace/kinst/Makefile +++ b/sys/modules/dtrace/kinst/Makefile @@ -14,4 +14,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} \ .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/profile/Makefile b/sys/modules/dtrace/profile/Makefile index b3eec9a19f23..aa36f9a2dfba 100644 --- a/sys/modules/dtrace/profile/Makefile +++ b/sys/modules/dtrace/profile/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/prototype/Makefile b/sys/modules/dtrace/prototype/Makefile index 189d6c2df2a2..476c567a4dc0 100644 --- a/sys/modules/dtrace/prototype/Makefile +++ b/sys/modules/dtrace/prototype/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/sdt/Makefile b/sys/modules/dtrace/sdt/Makefile index a025848e3a60..d672b3c9aab9 100644 --- a/sys/modules/dtrace/sdt/Makefile +++ b/sys/modules/dtrace/sdt/Makefile @@ -11,5 +11,5 @@ SRCS+= vnode_if.h CFLAGS+= ${OPENZFS_CFLAGS} .include + CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/systrace/Makefile b/sys/modules/dtrace/systrace/Makefile index 2250a7418193..3e122f70da25 100644 --- a/sys/modules/dtrace/systrace/Makefile +++ b/sys/modules/dtrace/systrace/Makefile @@ -13,4 +13,3 @@ CFLAGS+= ${OPENZFS_CFLAGS} .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/systrace_freebsd32/Makefile b/sys/modules/dtrace/systrace_freebsd32/Makefile index 3b77bc4c6d0e..4661633f9a62 100644 --- a/sys/modules/dtrace/systrace_freebsd32/Makefile +++ b/sys/modules/dtrace/systrace_freebsd32/Makefile @@ -14,4 +14,3 @@ CFLAGS+= -DFREEBSD32_SYSTRACE .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/systrace_linux/Makefile b/sys/modules/dtrace/systrace_linux/Makefile index 56f422dfb9e5..7dbd88ffb5f0 100644 --- a/sys/modules/dtrace/systrace_linux/Makefile +++ b/sys/modules/dtrace/systrace_linux/Makefile @@ -15,4 +15,3 @@ CFLAGS+= -DLINUX_SYSTRACE .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/dtrace/systrace_linux32/Makefile b/sys/modules/dtrace/systrace_linux32/Makefile index febd4a0c1bab..81aa1b7de9df 100644 --- a/sys/modules/dtrace/systrace_linux32/Makefile +++ b/sys/modules/dtrace/systrace_linux32/Makefile @@ -15,4 +15,3 @@ CFLAGS+= -DLINUX32_SYSTRACE .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/opensolaris/Makefile b/sys/modules/opensolaris/Makefile index 7010485b0ee7..f5d6f7f4639c 100644 --- a/sys/modules/opensolaris/Makefile +++ b/sys/modules/opensolaris/Makefile @@ -34,4 +34,3 @@ IGNORE_PRAGMA= 1 .include CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index 858f69144954..7c39b9ddecc4 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -342,8 +342,6 @@ CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h -CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} - CFLAGS.gcc+= -Wno-pointer-to-int-cast CFLAGS.lapi.c= -Wno-cast-qual From nobody Wed Mar 22 19:44:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phf7M0xn6z41DRZ for ; Wed, 22 Mar 2023 19:44:31 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 4Phf7L5vt1z4HfJ for ; Wed, 22 Mar 2023 19:44:30 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f43.google.com with SMTP id h17so18257348wrt.8 for ; Wed, 22 Mar 2023 12:44:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679514269; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DPjkibs8WJKDKLhvd7zvBqeHkIy4raf9s3t9NmjL2MQ=; b=WCQ8DRusFXUfKGsxS3JLIvgJdyB1BGni7zad/6avb6jP5t0vBnT//iHeAlWhRz30vg D7XuDs3IWSbu1vkNqyEQ2boy16AxVzJeDZ+XgHKQxqLO09ofmuNNW/PMSgMnDlFBEKtY OLFO7Cqa6IdIICVfxLnyDDqxpjU16qEfItuVyOBYV+X0Z4pup395e+PsfFh5niF5MkvQ +f2R472JkCx50N2zq9kloJFzvyQFvpQGOApx08w6X/hM9om5D3Y1sz8aba/1DMKNqtrP LvgY6kjegy2G1OmsHdz2SRBKhCwt18SQZglprEA3dCcUrofhEZfuaC2U3GL5C1QLPnHH fhUQ== X-Gm-Message-State: AAQBX9evu8/PD29vyNWiThD7fnV6nULRifiTX+O4mhl3B6Tfvt4F44eN 4EyMceuWipCtO6Wd4F6f5ruda4GbTn5RlUmJgdSFqg== X-Google-Smtp-Source: AKy350asrUSgrvLZM8/BBhjjrNpkzIb47flKt0HJTThsePTO/s6PdJ7vyW5WEOObiHLnK6JtWq6Ekg== X-Received: by 2002:a5d:4087:0:b0:2cf:ee3b:950 with SMTP id o7-20020a5d4087000000b002cfee3b0950mr672594wrp.54.1679514269024; Wed, 22 Mar 2023 12:44:29 -0700 (PDT) Received: from smtpclient.apple (global-5-144.n-2.net.cam.ac.uk. [131.111.5.144]) by smtp.gmail.com with ESMTPSA id f11-20020a5d4dcb000000b002cfe3f842c8sm14411811wru.56.2023.03.22.12.44.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2023 12:44:28 -0700 (PDT) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: git: 61482760a0ca - main - bhyve: Accept a variable-length string name for qemu_fwcfg_add_file. From: Jessica Clarke In-Reply-To: <202303221935.32MJZlHM019772@gitrepo.freebsd.org> Date: Wed, 22 Mar 2023 19:44:27 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <29CA9EB9-4226-4FB0-982E-A88A8BC5ACCB@freebsd.org> References: <202303221935.32MJZlHM019772@gitrepo.freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Rspamd-Queue-Id: 4Phf7L5vt1z4HfJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 22 Mar 2023, at 19:35, John Baldwin wrote: >=20 > The branch main has been updated by jhb: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D61482760a0ca198a9310d450133e9ac7= 92b67955 >=20 > commit 61482760a0ca198a9310d450133e9ac792b67955 > Author: John Baldwin > AuthorDate: 2023-03-22 19:34:34 +0000 > Commit: John Baldwin > CommitDate: 2023-03-22 19:34:34 +0000 >=20 > bhyve: Accept a variable-length string name for = qemu_fwcfg_add_file. >=20 > It is illegal (UB?) to pass a shorter array to a function argument > that takes a fixed-length array. Do a runtime check for names that > are too long via strlen() instead. So, without static in there (that very weird corner of the C grammar*), the size is meaningless. GCC just treats this as a convention that you meant the size to do something for the purposes of diagnostics, but not semantics, so this is in fact a known, and by design, false-positive. Jess *: void foo(int array[static N]) > Reviewed by: markj > Reported by: GCC -Wstringop-overread > Differential Revision: https://reviews.freebsd.org/D39211 > --- > usr.sbin/bhyve/qemu_fwcfg.c | 6 ++++-- > usr.sbin/bhyve/qemu_fwcfg.h | 2 +- > 2 files changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c > index 1b0b5e3e9931..2d91213dc7c5 100644 > --- a/usr.sbin/bhyve/qemu_fwcfg.c > +++ b/usr.sbin/bhyve/qemu_fwcfg.c > @@ -261,9 +261,11 @@ qemu_fwcfg_register_port(const char *const name, = const int port, const int size, > } >=20 > int > -qemu_fwcfg_add_file(const uint8_t name[QEMU_FWCFG_MAX_NAME], > - const uint32_t size, void *const data) > +qemu_fwcfg_add_file(const char *name, const uint32_t size, void = *const data) > { > + if (strlen(name) >=3D QEMU_FWCFG_MAX_NAME) > + return (EINVAL); > + > /* > * QEMU specifies count as big endian. > * Convert it to host endian to work with it. > diff --git a/usr.sbin/bhyve/qemu_fwcfg.h b/usr.sbin/bhyve/qemu_fwcfg.h > index f59087250816..f3846d64085a 100644 > --- a/usr.sbin/bhyve/qemu_fwcfg.h > +++ b/usr.sbin/bhyve/qemu_fwcfg.h > @@ -18,6 +18,6 @@ struct qemu_fwcfg_item { > uint8_t *data; > }; >=20 > -int qemu_fwcfg_add_file(const uint8_t name[QEMU_FWCFG_MAX_NAME], > +int qemu_fwcfg_add_file(const char *name, > const uint32_t size, void *const data); > int qemu_fwcfg_init(struct vmctx *const ctx); From nobody Wed Mar 22 20:28:13 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phg5n2jk5z41GYN; Wed, 22 Mar 2023 20:28:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Phg5n2BLDz4QW2; Wed, 22 Mar 2023 20:28:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679516893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qp6fPFjWROz5Zg9Hhkxcppc9jJpHSW7scQ35yre+0PM=; b=GBj1cWUg3XkFMSPXuntnBQEtZUE7Ggk5j0KePe+EmHtIVyp4azyKetrrQD4SIKWl3GDynf KIHBe/2pVd3YIvK55KnpJm2KFoPDR7kDJJ+NSO5JYdz0ayNwGjWmWWNF/mVQGznPooVlLF fiYWGUdsyMmydNyo5wgqWP9+cw69Vpr6AK2UPZRAWt+goXUKsiZnWeDXAzjXLIfM3IJrSi HkWYMl1MTqZ5rRlk8Z1Xr4IgPsCL8he/+TWCMjcwnrV8KTohuZmBq66Qs+9w/e9Z7CQ4hs JnT5xCry5KAllZVmIoldUf7/XXnb2pKz+QBJEeNdNsPLgIb5Vwe9sziS/ylReQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679516893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qp6fPFjWROz5Zg9Hhkxcppc9jJpHSW7scQ35yre+0PM=; b=rUwYACnKHE9CBJ9rC/rHivXZQ+uogfKbNZzI1AUhvq3s/gA+MP0H1yRibFCzZv36uMljog Syc/KwjJ4XLUx1NcgX+7ucmkn0tkaYCAzZSyeZ4vjuMC217Wa0mxxE2DhN6zLFwV7uc2Ea bbQmsqUHDziFbIgmgrHs44y1BdeZ9K09nD1K4P7gL6d160pKHyMcaFcjM1XGLbUyIpCrJ3 mwepu8Qs8J+/QgJSKbUSYzxibb0PiNoxR5AIERcgmz+3yN6OzPKu2u9nrWysIsPBJUPJU1 lTf8SP/FbSjs7dnfSeM5OtPe7wSnxYuh8kCnvpH0prgc4DKQfCF8bPTIUZbF9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679516893; a=rsa-sha256; cv=none; b=lqOEFZfKPGhGRBI3IS/ak3ODrZSvm7mslUM8poBFAmLVB7bq+d/oPDdJx5rinu7xyhsj9Q u8xFcxCR+3SRQi/HCDNi3kNm2maqoD1uWyU8xQ3hHvn2uhc72gajbRFDJ7P9nAIuepCty5 iyl0g0fJMtpYbxgTCIzynNpyeHumwUpCbkwbZTBpWmVYRPV7kLMN8veFDSoxaRCUG2EuYC XiDsHFLjYjSNIwUemQOz/9kFwCffBPDVRhZkV3HAfNU/DFeuCQGkub1KpghAOxHCYEfn6l d/vaoV4DnyocdUuyF2hXZITWBV7g0ttwg+XZgwORGPtBFUBrdJ183pxURb62Ww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Phg5n1Bf1z17QQ; Wed, 22 Mar 2023 20:28: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 32MKSDlo004120; Wed, 22 Mar 2023 20:28:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MKSDJe004119; Wed, 22 Mar 2023 20:28:13 GMT (envelope-from git) Date: Wed, 22 Mar 2023 20:28:13 GMT Message-Id: <202303222028.32MKSDJe004119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rene Ladan Subject: git: b0f6acbaf8bb - main - misc/organization: add bofh as a new portmgr member List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rene X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0f6acbaf8bb93cbfbc26e5261e47a9ccc7aa91d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rene: URL: https://cgit.FreeBSD.org/src/commit/?id=b0f6acbaf8bb93cbfbc26e5261e47a9ccc7aa91d commit b0f6acbaf8bb93cbfbc26e5261e47a9ccc7aa91d Author: Rene Ladan AuthorDate: 2023-03-22 20:26:35 +0000 Commit: Rene Ladan CommitDate: 2023-03-22 20:26:35 +0000 misc/organization: add bofh as a new portmgr member Hat: portmgr-secretary --- share/misc/organization.dot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/misc/organization.dot b/share/misc/organization.dot index c8c1cc6b4298..aab39c96ea73 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -31,7 +31,7 @@ doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nbcr, gabor, gjb, hrs,\nblackend, ryusuke, wblock"] pkgmgr [label="Package Management Team\npkgmgr@FreeBSD.org\nantoine, bdrewery"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nbapt, mat, pizzamig\nrene, swills, tcberner"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nbapt, bofh, mat, pizzamig\nrene, swills, tcberner"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\ngjb, kib\n, blackend, delphij, cperciva"] secteam [label="Security Team\nsecteam@FreeBSD.org\ndelphij,\ndes, markj,\nemaste,\ngjb, gordon,\noshogbo, philip"] From nobody Wed Mar 22 21:46:39 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhhrL0266z41Lbn; Wed, 22 Mar 2023 21:46:42 +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 4PhhrK6g5fz3Lmp; Wed, 22 Mar 2023 21:46:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679521601; 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=YIP9XiEnwr4ZuipwIaH4Yb/JEombDV93dpGnRqEOS1s=; b=i96mY4QOCQHWHGkCkrSl9IbWGDaeNEOzebgBZIpoJlIc9A+AjDvnkM/jugrEFRoCmnbAYv 4YWgoaz+eGExcvjXiMv/4xavbjrRGCmjQmZfsC55p02xhEggJ8JW/uP3DZ+S7fSkKWkx8s djZknIc4pFj+4SqV1al7k4baWq39eLZpR9w0Kq64k/fSHQuDERims9+IYLK6FL/NTylqFz X+TpIItkAytZBz12GopXtn2osaXa06nr7q0PdF0S9wYrRr7+rRBE9j3zic+oPHa6TU8j5m Si6lS+5IGwn+WFfSzWxeYjOSUOeYVYM7H1bsrXfPG74V6dphQ7jJo3on9xJAgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679521601; 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=YIP9XiEnwr4ZuipwIaH4Yb/JEombDV93dpGnRqEOS1s=; b=RDzUKsuUgcRRZCfQKgjrVFHCgOWNRSMl9uY8cvRpR82MYmhMidMKMAgNcy6CZfM8wRdlI/ gUf3lSxyFzzWD3+DNoUCzCPql+4v/mR9KWGwxDffMi9idmQ/OIjhwfgv4q5pf/Et344B/0 PbAbxTn1TbZDYE45vPRHm8+DiVTUWavvY69+r0Wswz6usH6wLn1Ych0W1NPSpOfO3xnuCl Gl9WKpBIciWiCcZKG/DAC3h3u1gwhu+s9zg6yuzBzQ1XrDXCP72dzbENbC04ZjDxyrAMpe jvHVuUTOYL2K0v9Az046dQygFu/ww3lKBKyEvAodLZUksNL7OlzXnLAKyqoHwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679521601; a=rsa-sha256; cv=none; b=IcWLzHBMJOdEtB+PzrUIghAmns+ei2X4mt6sLV/bpgOvkccEEw2q0QnyQn1zmJ/qBMkl7q e8dixbIREej3GEBv4D2sU+IPbAUXjxV7lc7LGef2oi7nYETyqwnOEEYkNyYbzxveXFY4rh 05EzKgxReQWePt0353vQXZNe+MPYDE+cap0RHEj13QjJ/qMncshw53zkvecYA4A7EYt4+W ZtRusFxATQpGNvUkypxYnHgriyQbNdaV/34h321TEj6yiK5Yd6PHGk0N+6sBBmQ2tAdDbx 8u9EExe4hawAs6tXcYBJyPU8C0Lzu7N3D94+9OfgHmObSLCdVdVY/EcXwNuHrg== Received: from [IPV6:2601:648:8680:16b0:cc93:2ec:c80c:1599] (unknown [IPv6:2601:648:8680:16b0:cc93:2ec:c80c:1599]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PhhrK2TF0zGmq; Wed, 22 Mar 2023 21:46:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 22 Mar 2023 14:46:39 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: git: 61482760a0ca - main - bhyve: Accept a variable-length string name for qemu_fwcfg_add_file. Content-Language: en-US To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202303221935.32MJZlHM019772@gitrepo.freebsd.org> <29CA9EB9-4226-4FB0-982E-A88A8BC5ACCB@freebsd.org> From: John Baldwin In-Reply-To: <29CA9EB9-4226-4FB0-982E-A88A8BC5ACCB@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 3/22/23 12:44 PM, Jessica Clarke wrote: > On 22 Mar 2023, at 19:35, John Baldwin wrote: >> >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=61482760a0ca198a9310d450133e9ac792b67955 >> >> commit 61482760a0ca198a9310d450133e9ac792b67955 >> Author: John Baldwin >> AuthorDate: 2023-03-22 19:34:34 +0000 >> Commit: John Baldwin >> CommitDate: 2023-03-22 19:34:34 +0000 >> >> bhyve: Accept a variable-length string name for qemu_fwcfg_add_file. >> >> It is illegal (UB?) to pass a shorter array to a function argument >> that takes a fixed-length array. Do a runtime check for names that >> are too long via strlen() instead. > > So, without static in there (that very weird corner of the C grammar*), > the size is meaningless. GCC just treats this as a convention that you > meant the size to do something for the purposes of diagnostics, but not > semantics, so this is in fact a known, and by design, false-positive. Humm, ok. I'd probably still rather pacify the warning rather than silence the warning as it finds real bugs in other places. -- John Baldwin From nobody Wed Mar 22 22:58:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhkRV2gkFz41Ql0; Wed, 22 Mar 2023 22:58: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 4PhkRV0Qr6z3sfc; Wed, 22 Mar 2023 22:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679525926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vL+KoIAnbJ2BnfwpZaxpU3iFxdywjXK1+oCHxUcG6QM=; b=da9J0jr53avBjgTU2GKHVS1LjJuWPY2Kh7iPWSwEZJq5wUtWhwt1Wgq9OwwTsk0d4OiW04 Oz7c3Imx0LPDhnet8tbSu+7xv5/b6iL0Ojo+Bo7nH7kW3FomB87Z9ml7RCxnULGvKr1sUZ YIG9cGVJln3zbBotCNyp5nBTukLBOD7AcKUmS7IirSeS4/LX3pKYAlBJES40pTHEC0O7On /qbhYB297VJFgIhTouqN8dQlvu2fAR5PQdpvxfr5tG3hk/tLmAX/4jkbn1JJoS4SXoUr4U Gk6ufeLZsuxej7loeHZgbvcMCvJiIFl1APqOC6rC4dZpxjP3eRUtfx4A0CkDoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679525926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vL+KoIAnbJ2BnfwpZaxpU3iFxdywjXK1+oCHxUcG6QM=; b=yQbHaXTIXzMtBQ5Tma/tpxi6deF7NzasTDP2XCflYeE49AIHCAIEpyQqUX8wL4e55i+nUM Aq5+Z7vwf3RhbZwTEHxCewoMGMzh5Gq8cXBb/p5Pxp3WgIoveVMdgiq36661gpBpCOL6Jz dabUrW3CQZ4qWlXeRTfNnQwUth6TZdiuNBmV8aDcpBBR7zwjDPQawCrBq+uCdazYt/Bfbg 5fh75g7zDCl1FKYuFyy1skeMdi1nZ51iuI7z2Z1nwDz/nPFpS4aGZTuVRVg03/EsRN7vzz oNMdBGdPjrWO2XpeA9ozUGThjksZE5WsqdlXzEzzHAS6SDu6ghKPZ3afK2HWWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679525926; a=rsa-sha256; cv=none; b=QOfkIkTLX8xyhSqfoQrDO7FncFTzNrez3eU/TGRcr22bJut7ysur6+9KRGW8aRsflMLKfr KB1s9hvvBY7Ry4sZUQ6BJ1vTNUEKNk3eaSp1WYup/+iJFvodTM11/hmuyduGG+UnTwwkfz qnHbLyN1PJk3Gg48sVX4yD4cEXHcDua14JMaor2mbTslX+xHc8LrIAAsjWPl3/lmS6d5NU Ccf7M8y4CMnyXy2FqXrzbsSXMS5NCgPKxFns9J26S1ecOS0vl2M1TwdfyGI7t9Ne41Dv1O 2HkX7NJlTOJ9+ZeGV5fefiqqKfHHdmyg68Dkv8x1RNOaCcFieaG0s3pKes0eZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhkRT6PGCz1C5n; Wed, 22 Mar 2023 22:58: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 32MMwjKu051380; Wed, 22 Mar 2023 22:58:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MMwjjL051379; Wed, 22 Mar 2023 22:58:45 GMT (envelope-from git) Date: Wed, 22 Mar 2023 22:58:45 GMT Message-Id: <202303222258.32MMwjjL051379@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: e5d0d1c5fbbc - main - Rewrite function definitions with identifier lists. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5d0d1c5fbbc0ce44fdc720a35b499056fe60b06 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=e5d0d1c5fbbc0ce44fdc720a35b499056fe60b06 commit e5d0d1c5fbbc0ce44fdc720a35b499056fe60b06 Author: Kirk McKusick AuthorDate: 2023-03-22 22:57:26 +0000 Commit: Kirk McKusick CommitDate: 2023-03-22 22:58:18 +0000 Rewrite function definitions with identifier lists. A few functions snuck in with K&R style definitions. Also add some missing memory frees. MFC after: 1 week --- sbin/dump/tape.c | 54 +++++++++++++++++++++++++--------------- sbin/fsck_ffs/dir.c | 5 ++++ sbin/fsck_ffs/fsutil.c | 6 ++--- sbin/fsck_ffs/inode.c | 20 +++++---------- sbin/fsck_ffs/pass2.c | 1 + sbin/fsck_ffs/suj.c | 4 +-- tools/diag/prtblknos/main.c | 4 +-- tools/diag/prtblknos/prtblknos.c | 26 +++++-------------- 8 files changed, 57 insertions(+), 63 deletions(-) diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index 45ad0ee50487..c123f7fa9404 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -74,7 +74,8 @@ static long blocksthisvol; /* number of blocks on current output file */ static char *nexttape; static FILE *popenfp = NULL; -static int atomic(ssize_t (*)(), int, char *, int); +static int atomic_read(int, void *, int); +static int atomic_write(int, const void *, int); static void worker(int, int); static void create_workers(void); static void flushtape(void); @@ -236,7 +237,7 @@ flushtape(void) wp->req[trecno].count = 0; /* Sentinel */ - if (atomic(write, wp->fd, (char *)wp->req, siz) != siz) + if (atomic_write(wp->fd, (const void *)wp->req, siz) != siz) quit("error writing command pipe: %s\n", strerror(errno)); wp->sent = 1; /* we sent a request, read the response later */ @@ -247,7 +248,7 @@ flushtape(void) /* Read results back from next worker */ if (wp->sent) { - if (atomic(read, wp->fd, (char *)&got, sizeof got) + if (atomic_read(wp->fd, (void *)&got, sizeof got) != sizeof got) { perror(" DUMP: error reading command pipe in master"); dumpabort(0); @@ -264,8 +265,8 @@ flushtape(void) */ for (i = 0; i < WORKERS; i++) { if (workers[i].sent) { - if (atomic(read, workers[i].fd, - (char *)&got, sizeof got) + if (atomic_read(workers[i].fd, + (void *)&got, sizeof got) != sizeof got) { perror(" DUMP: error reading command pipe in master"); dumpabort(0); @@ -322,7 +323,7 @@ trewind(void) * fixme: punt for now. */ if (workers[f].sent) { - if (atomic(read, workers[f].fd, (char *)&got, sizeof got) + if (atomic_read(workers[f].fd, (void *)&got, sizeof got) != sizeof got) { perror(" DUMP: error reading command pipe in master"); dumpabort(0); @@ -446,7 +447,7 @@ rollforward(void) lastspclrec = savedtapea - 1; } size = (char *)ntb - (char *)q; - if (atomic(write, wp->fd, (char *)q, size) != size) { + if (atomic_write(wp->fd, (const void *)q, size) != size) { perror(" DUMP: error writing command pipe"); dumpabort(0); } @@ -486,7 +487,7 @@ rollforward(void) * worked ok, otherwise the tape is much too short! */ if (wp->sent) { - if (atomic(read, wp->fd, (char *)&got, sizeof got) + if (atomic_read(wp->fd, (void *)&got, sizeof got) != sizeof got) { perror(" DUMP: error reading command pipe in master"); dumpabort(0); @@ -676,8 +677,7 @@ dumpabort(int signo __unused) } void -Exit(status) - int status; +Exit(int status) { #ifdef TDEBUG @@ -735,8 +735,8 @@ create_workers(void) } for (i = 0; i < WORKERS; i++) - (void) atomic(write, workers[i].fd, - (char *) &workers[(i + 1) % WORKERS].pid, + (void) atomic_write(workers[i].fd, + (const void *) &workers[(i + 1) % WORKERS].pid, sizeof workers[0].pid); master = 0; @@ -777,7 +777,7 @@ worker(int cmd, int worker_number) /* * Need the pid of the next worker in the loop... */ - if ((nread = atomic(read, cmd, (char *)&nextworker, sizeof nextworker)) + if ((nread = atomic_read(cmd, (void *)&nextworker, sizeof nextworker)) != sizeof nextworker) { quit("master/worker protocol botched - didn't get pid of next worker.\n"); } @@ -785,7 +785,7 @@ worker(int cmd, int worker_number) /* * Get list of blocks to dump, read the blocks into tape buffer */ - while ((nread = atomic(read, cmd, (char *)wp->req, reqsiz)) == reqsiz) { + while ((nread = atomic_read(cmd, (void *)wp->req, reqsiz)) == reqsiz) { struct req *p = wp->req; for (trecno = 0; trecno < ntrec; @@ -794,8 +794,8 @@ worker(int cmd, int worker_number) blkread(p->dblk, wp->tblock[trecno], p->count * TP_BSIZE); } else { - if (p->count != 1 || atomic(read, cmd, - (char *)wp->tblock[trecno], + if (p->count != 1 || atomic_read(cmd, + (void *)wp->tblock[trecno], TP_BSIZE) != TP_BSIZE) quit("master/worker protocol botched.\n"); } @@ -858,7 +858,8 @@ worker(int cmd, int worker_number) * pass size of write back to master * (for EOT handling) */ - (void) atomic(write, cmd, (char *)&size, sizeof size); + (void)atomic_write(cmd, (const void *)&size, + sizeof size); } /* @@ -873,15 +874,28 @@ worker(int cmd, int worker_number) /* * Since a read from a pipe may not return all we asked for, - * or a write may not write all we ask if we get a signal, * loop until the count is satisfied (or error). */ static int -atomic(ssize_t (*func)(), int fd, char *buf, int count) +atomic_read(int fd, void *buf, int count) { int got, need = count; - while ((got = (*func)(fd, buf, need)) > 0 && (need -= got) > 0) + while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0) + buf += got; + return (got < 0 ? got : count - need); +} + +/* + * Since a write to a pipe may not write all we ask if we get a signal, + * loop until the count is satisfied (or error). + */ +static int +atomic_write(int fd, const void *buf, int count) +{ + int got, need = count; + + while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0) buf += got; return (got < 0 ? got : count - need); } diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 18229ab96fb6..64e477c66ed8 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -525,6 +525,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name) } } irelse(&ip); + free(idesc.id_name); if (lfdir == 0) { pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY"); printf("\n\n"); @@ -621,6 +622,7 @@ changeino(ino_t dir, const char *name, ino_t newnum) idesc.id_parent = newnum; /* new value for name */ ginode(dir, &ip); error = ckinode(ip.i_dp, &idesc); + free(idesc.id_name); irelse(&ip); return (error); } @@ -655,15 +657,18 @@ makeentry(ino_t parent, ino_t ino, const char *name) } if ((ckinode(dp, &idesc) & ALTERED) != 0) { irelse(&ip); + free(idesc.id_name); return (1); } getpathname(pathbuf, parent, parent); if (expanddir(&ip, pathbuf) == 0) { irelse(&ip); + free(idesc.id_name); return (0); } retval = ckinode(dp, &idesc) & ALTERED; irelse(&ip); + free(idesc.id_name); return (retval); } diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index ac5dd3ebe08e..d58527231240 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -1163,9 +1163,7 @@ allocblk(long startcg, long frags, } ufs2_daddr_t -std_checkblkavail(blkno, frags) - ufs2_daddr_t blkno; - long frags; +std_checkblkavail(ufs2_daddr_t blkno, long frags) { struct bufarea *cgbp; struct cg *cgp; @@ -1279,9 +1277,11 @@ getpathname(char *namebuf, ino_t curdir, ino_t ino) ginode(ino, &ip); if ((ckinode(ip.i_dp, &idesc) & FOUND) == 0) { irelse(&ip); + free(idesc.id_name); break; } irelse(&ip); + free(idesc.id_name); namelookup: idesc.id_number = idesc.id_parent; idesc.id_parent = ino; diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 057d49a1ea18..947e5e0cbc08 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -798,12 +798,8 @@ snapclean(struct inodesc *idesc) * must always have been allocated from a BLK_NOCOPY location. */ int -snapblkfree(fs, bno, size, inum, checkblkavail) - struct fs *fs; - ufs2_daddr_t bno; - long size; - ino_t inum; - ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags); +snapblkfree(struct fs *fs, ufs2_daddr_t bno, long size, ino_t inum, + ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags)) { union dinode *dp; struct inode ip; @@ -930,10 +926,8 @@ snapblkfree(fs, bno, size, inum, checkblkavail) * block. Here we need to check each block in the buffer. */ void -copyonwrite(fs, bp, checkblkavail) - struct fs *fs; - struct bufarea *bp; - ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags); +copyonwrite(struct fs *fs, struct bufarea *bp, + ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags)) { ufs2_daddr_t copyblkno; long i, numblks; @@ -953,10 +947,8 @@ copyonwrite(fs, bp, checkblkavail) } static void -chkcopyonwrite(fs, copyblkno, checkblkavail) - struct fs *fs; - ufs2_daddr_t copyblkno; - ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags); +chkcopyonwrite(struct fs *fs, ufs2_daddr_t copyblkno, + ufs2_daddr_t (*checkblkavail)(ufs2_daddr_t blkno, long frags)) { struct inode ip; union dinode *dp; diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index 4e17863ef04c..abe14549e6f4 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -602,6 +602,7 @@ fix_extraneous(struct inoinfo *inp, struct inodesc *idesc) if ((ckinode(ip.i_dp, &dotdesc) & FOUND)) inp->i_dotdot = dotdesc.id_parent; irelse(&ip); + free(dotdesc.id_name); } /* * We have the previously found old name (inp->i_parent) and the diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c index c85f1f4b81cd..40bbe340bfc6 100644 --- a/sbin/fsck_ffs/suj.c +++ b/sbin/fsck_ffs/suj.c @@ -384,9 +384,7 @@ blk_isindir(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn) * they will only have usable blocks in them. */ ufs2_daddr_t -suj_checkblkavail(blkno, frags) - ufs2_daddr_t blkno; - long frags; +suj_checkblkavail(ufs2_daddr_t blkno, long frags) { struct bufarea *cgbp; struct cg *cgp; diff --git a/tools/diag/prtblknos/main.c b/tools/diag/prtblknos/main.c index 65efa786b700..e5b24ed3117a 100644 --- a/tools/diag/prtblknos/main.c +++ b/tools/diag/prtblknos/main.c @@ -44,9 +44,7 @@ void prtblknos(struct fs *fs, union dinode *dp); struct uufsd disk; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { union dinodep dp; struct fs *fs; diff --git a/tools/diag/prtblknos/prtblknos.c b/tools/diag/prtblknos/prtblknos.c index ae53471156a6..d6135f70eb46 100644 --- a/tools/diag/prtblknos/prtblknos.c +++ b/tools/diag/prtblknos/prtblknos.c @@ -53,9 +53,7 @@ static void indirprt(struct fs *, int, ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t, ufs_lbn_t); void -prtblknos(fs, dp) - struct fs *fs; - union dinode *dp; +prtblknos(struct fs *fs, union dinode *dp) { int i, mode, frags; ufs_lbn_t lbn, lastlbn, len, blksperindir; @@ -154,13 +152,8 @@ prtblknos(fs, dp) } static void -indirprt(fs, level, blksperindir, lbn, blkno, lastlbn) - struct fs *fs; - int level; - ufs_lbn_t blksperindir; - ufs_lbn_t lbn; - ufs2_daddr_t blkno; - ufs_lbn_t lastlbn; +indirprt(struct fs *fs, int level, ufs_lbn_t blksperindir, ufs_lbn_t lbn, + ufs2_daddr_t blkno, ufs_lbn_t lastlbn) { char indir[MAXBSIZE]; ufs_lbn_t i, last; @@ -209,10 +202,7 @@ indirprt(fs, level, blksperindir, lbn, blkno, lastlbn) } static const char * -distance(fs, lastblk, firstblk) - struct fs *fs; - ufs2_daddr_t lastblk; - ufs2_daddr_t firstblk; +distance(struct fs *fs, ufs2_daddr_t lastblk, ufs2_daddr_t firstblk) { ufs2_daddr_t delta; int firstcg, lastcg; @@ -237,12 +227,8 @@ distance(fs, lastblk, firstblk) static const char *indirname[UFS_NIADDR] = { "First", "Second", "Third" }; static void -printblk(fs, lbn, blkno, numfrags, lastlbn) - struct fs *fs; - ufs_lbn_t lbn; - ufs2_daddr_t blkno; - int numfrags; - ufs_lbn_t lastlbn; +printblk(struct fs *fs, ufs_lbn_t lbn, ufs2_daddr_t blkno, int numfrags, + ufs_lbn_t lastlbn) { static int seq; static ufs2_daddr_t totfrags, lastindirblk, lastblk, firstblk; From nobody Wed Mar 22 23:57:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhllF1dbxz41TGJ; Wed, 22 Mar 2023 23:57: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 4PhllF13wrz4128; Wed, 22 Mar 2023 23:57:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679529449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IHUqQBZwzr0czMnbu/EyzvSSjnOrjSfmNGt5LvZEfXg=; b=tzS14aqOcfKiwH1mE/EdBVTSpJUfUD9CP42fnnpLe4dIm9cMYJHsSa04IcFwpIf56xucuq glcalsrK9qa13x5FaAF1IaohgcDpYSXAUYS5Yg0HYKxnQ4ElvMbvpLgm1wxuVOczgTaenA KoRgBUc8ZUOfjM9ZiAb9oT8CoVcnpTvUGgnwd07SvIS/gcwInO0vEGIbuRDMkJC9dgWK+G nc1CSmEAvAW1XCgqDetmu1U4jC+loPJ5IbMucK+MvhL4+Y15Y2l04scbz1XtvGxswB084g F7S5YzT4FL2AGBibft+El4QKvKNRGNw9rZYvBRECrpGRQLCIp5+UYAVF8iI9lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679529449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IHUqQBZwzr0czMnbu/EyzvSSjnOrjSfmNGt5LvZEfXg=; b=JuS68mDiU2dTc0ykE+L/Lv7Vmse5KIUi6mbb/Yf1LbsnvU1UTip1eB6F8EODoPvALwhhnj Fd/fnA6hZ+6494HSYPIf3y4m3E5b43lzljvjgg2Bz4VzyhsS69AiKRBorgxWSLyKCAuXb+ zLQ8KhSEunSheS18wx4n9E4merdMFp5YdfXXOnlByTlMMCz2I36DsNQWuyS6Bj+byf914f 5f+yI7jARSqfqlTF4lDlFGCw1r4jlxPWQtC26BX1dza5FjKrQcsck99wmnVq6Yda35ZwsG u3ZMMh7nvcbAlXSziXsb+BGbxKepteK6UsfwFtCk7u2U1bgiK/eCJegCeheQWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679529449; a=rsa-sha256; cv=none; b=pAduJJJKGqjY1of1gctZAVyRXkbXkQxLpWtrC6UBzAfrCQ435njrIYhyyu4g+B/iNjtdLg IfF9ekrT53zaw00iL4/dshJ3JFskEslv8/zM3DMiL1R92aAf0DoD/nQkApq2TLvakLVKm6 JMNQYOkBqh6THk4wWnZ0DWkY8cBeMh3L0U48QBMlF0zH8BPqgHvVP7sYk8Fr9ibp3m4U/f IIPwAGEljkonpLg91RRR8KIIURxA4ntxGuOgaa4vNVu/eGQdR6AfV65dGGKuSUEZlofQn+ Lbs54uqKDznESyCkSF7WYIy54RLm0C/PsLYyhteItzcgU6wxuqSryoDL7oRaKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhllF069HzF7G; Wed, 22 Mar 2023 23:57: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 32MNvSDE048635; Wed, 22 Mar 2023 23:57:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MNvSbm048634; Wed, 22 Mar 2023 23:57:28 GMT (envelope-from git) Date: Wed, 22 Mar 2023 23:57:28 GMT Message-Id: <202303222357.32MNvSbm048634@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: b5d43972e394 - main - vfs: decouple freevnodes from vnode batching List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: b5d43972e3941d6c03d935dc423385f3c2178d68 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b5d43972e3941d6c03d935dc423385f3c2178d68 commit b5d43972e3941d6c03d935dc423385f3c2178d68 Author: Mateusz Guzik AuthorDate: 2023-03-21 07:27:25 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-22 23:57:25 +0000 vfs: decouple freevnodes from vnode batching In principle one cpu can keep vholding vnodes, while another vdrops them. In this case it may be the local count will keep growing in an unbounded manner. Roll it up after a threshold instead. While here move it out of dpcpu into struct pcpu. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D39195 --- sys/kern/vfs_subr.c | 55 ++++++++++++++++++++++++++++++++--------------------- sys/sys/pcpu.h | 3 ++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c117ada017c9..d89e0ed13dd5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -287,7 +287,6 @@ SYSCTL_INT(_debug, OID_AUTO, rush_requests, CTLFLAG_RW, &stat_rush_requests, 0, #define VDBATCH_SIZE 8 struct vdbatch { u_int index; - long freevnodes; struct mtx lock; struct vnode *tab[VDBATCH_SIZE]; }; @@ -1418,48 +1417,62 @@ static int vnlruproc_sig; * at any given moment can still exceed slop, but it should not be by significant * margin in practice. */ -#define VNLRU_FREEVNODES_SLOP 128 +#define VNLRU_FREEVNODES_SLOP 126 + +static void __noinline +vfs_freevnodes_rollup(int8_t *lfreevnodes) +{ + + atomic_add_long(&freevnodes, *lfreevnodes); + *lfreevnodes = 0; + critical_exit(); +} static __inline void vfs_freevnodes_inc(void) { - struct vdbatch *vd; + int8_t *lfreevnodes; critical_enter(); - vd = DPCPU_PTR(vd); - vd->freevnodes++; - critical_exit(); + lfreevnodes = PCPU_PTR(vfs_freevnodes); + (*lfreevnodes)++; + if (__predict_false(*lfreevnodes == VNLRU_FREEVNODES_SLOP)) + vfs_freevnodes_rollup(lfreevnodes); + else + critical_exit(); } static __inline void vfs_freevnodes_dec(void) { - struct vdbatch *vd; + int8_t *lfreevnodes; critical_enter(); - vd = DPCPU_PTR(vd); - vd->freevnodes--; - critical_exit(); + lfreevnodes = PCPU_PTR(vfs_freevnodes); + (*lfreevnodes)--; + if (__predict_false(*lfreevnodes == -VNLRU_FREEVNODES_SLOP)) + vfs_freevnodes_rollup(lfreevnodes); + else + critical_exit(); } static u_long vnlru_read_freevnodes(void) { - struct vdbatch *vd; - long slop; + long slop, rfreevnodes; int cpu; - mtx_assert(&vnode_list_mtx, MA_OWNED); - if (freevnodes > freevnodes_old) - slop = freevnodes - freevnodes_old; + rfreevnodes = atomic_load_long(&freevnodes); + + if (rfreevnodes > freevnodes_old) + slop = rfreevnodes - freevnodes_old; else - slop = freevnodes_old - freevnodes; + slop = freevnodes_old - rfreevnodes; if (slop < VNLRU_FREEVNODES_SLOP) - return (freevnodes >= 0 ? freevnodes : 0); - freevnodes_old = freevnodes; + return (rfreevnodes >= 0 ? rfreevnodes : 0); + freevnodes_old = rfreevnodes; CPU_FOREACH(cpu) { - vd = DPCPU_ID_PTR((cpu), vd); - freevnodes_old += vd->freevnodes; + freevnodes_old += cpuid_to_pcpu[cpu]->pc_vfs_freevnodes; } return (freevnodes_old >= 0 ? freevnodes_old : 0); } @@ -3513,7 +3526,6 @@ vdbatch_process(struct vdbatch *vd) mtx_lock(&vnode_list_mtx); critical_enter(); - freevnodes += vd->freevnodes; for (i = 0; i < VDBATCH_SIZE; i++) { vp = vd->tab[i]; TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); @@ -3522,7 +3534,6 @@ vdbatch_process(struct vdbatch *vd) vp->v_dbatchcpu = NOCPU; } mtx_unlock(&vnode_list_mtx); - vd->freevnodes = 0; bzero(vd->tab, sizeof(vd->tab)); vd->index = 0; critical_exit(); diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h index 14bef5cf690e..9ac4144d3267 100644 --- a/sys/sys/pcpu.h +++ b/sys/sys/pcpu.h @@ -189,7 +189,8 @@ struct pcpu { long pc_cp_time[CPUSTATES]; /* statclock ticks */ struct _device *pc_device; /* CPU device handle */ void *pc_netisr; /* netisr SWI cookie */ - int pc_unused1; /* unused field */ + int8_t pc_vfs_freevnodes; /* freevnodes counter */ + char pc_unused1[3]; /* unused pad */ int pc_domain; /* Memory domain. */ struct rm_queue pc_rm_queue; /* rmlock list of trackers */ uintptr_t pc_dynamic; /* Dynamic per-cpu data area */ From nobody Thu Mar 23 00:17:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhmBJ5sT4z41VCG; Thu, 23 Mar 2023 00:17: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 4PhmBJ56Vjz41qG; Thu, 23 Mar 2023 00:17:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679530648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SGfXfaRKcVQxGQCF1djYPLpYthQGe9F4iZTJnzqQUrM=; b=RrkRcwATsQJivzhX55qp55F8xoBVsnZf233RnHu6HmSNZylKQehjph8lxAVB1ZPX7+QyP3 z9XgeuwA3rVNlvjILehjA0VcuzJB8n7Em40ImsLVTPiSCj38VE3uuSI11EG9o46jFMVVUC uHAYVISY2TWxbSlysnK6Fh26YYDHTuKj8Zw5KdhhytcRZZDqygIIAcmNmC8J8qz/pqTlLP sKWHfEuryQATpK0LIViORyXRqUt0dCEzxUsCTOdmKVrzTb8BhCsg686HRPsFm9HvYGRJFv s8mph6uhmib+psTlVgCrLrf9f1F8ebbAwrtjz8YxGhDLHNpg9rCt5Q/LGT7tGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679530648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SGfXfaRKcVQxGQCF1djYPLpYthQGe9F4iZTJnzqQUrM=; b=NES1uCcZ5zBrDvqt7E6fk9Zc0xu5hRMEQwiGtVFuzbf7VN3Pz5wiMiE5SmEiOp1AH6yl35 FkGzzJesp7HiL4gxLfBwXVidt4/iePWaTTtn7yMjWDz6mYRAsR3FYoha78HWQzjUofaBeH /7XP5UkujTp44YwkPMBv6+CMYHaXRnNBE1rIpV3b4bH0+SC/S2CBCq9OmUBrIX3QfyzM8Q L/G/hDPIjy7uIHdYkwVXEcvSjgNlN5Z/0Xj2WnuZD18cHgpfMP9jKEEpmbV2upl11HOC9j vmi8qtcTkFWHjANcDiP6czPZEzbw9cWoqKt0vzNl4oe+1Vv/pcxmy7qQFi4mNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679530648; a=rsa-sha256; cv=none; b=AZxrUB8sLjDm+7UKSE0D7feioyNem5mwKYrNtax3RvACv0yLR6msFpWnGskvTdaCeEkjU+ fyHOj9dSc91ZPTf5ND5K/S13hzpzet1lUGKnQ65cD0g4A9xI7eGwlaGK9qDuOv/EpVhMOR 6q8u09e45h86OEsByjkTh0r9aBRHLbcGq47yPFWcmICYQp0K1KXSQ9PACaWNoPlr3op9hc 0+n9CiBwGSkoM0hCTekT+XgLHHbz22vrXLkGW3wZqIP8S73g2YgMRkCn6edAxad3LJNCVG Flb1P9xyQClD20ovA5VqduLytk/RBMT2OF7MTEA2Q5weVMairQt6poKDi5dsHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhmBJ3sglzFNF; Thu, 23 Mar 2023 00:17: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 32N0HStp082181; Thu, 23 Mar 2023 00:17:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N0HSp2082180; Thu, 23 Mar 2023 00:17:28 GMT (envelope-from git) Date: Thu, 23 Mar 2023 00:17:28 GMT Message-Id: <202303230017.32N0HSp2082180@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: e091be417add - main - ifconfig: ifieee80211: print bssid name List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e091be417add7e9130653462012a9ab2f4fb5269 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=e091be417add7e9130653462012a9ab2f4fb5269 commit e091be417add7e9130653462012a9ab2f4fb5269 Author: Bjoern A. Zeeb AuthorDate: 2023-03-21 21:25:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-03-23 00:15:15 +0000 ifconfig: ifieee80211: print bssid name In certain setups (e.g., autonomous APs) it is extremly helpful to have a way to map the BSSIDs to names for both normal status output as well as the scan list. This often allows a quicker overview than remembering (or manually looking up) BSSIDs. Call ether_ntohost() on the bssid and consult /etc/ethers and print "(name)" after the bssid for the status output and "(name)" at the end of the line after the IE list. MFC after: 10 days Reviewed by: adrian, cy Differential Revision: https://reviews.freebsd.org/D39192 --- sbin/ifconfig/ifieee80211.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index cb465a02b794..065a141da0f1 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -3716,6 +3716,17 @@ printmimo(const struct ieee80211_mimo_info *mi) mi->ch[3].noise[0]); } +static void +printbssidname(const struct ether_addr *n) +{ + char name[MAXHOSTNAMELEN + 1]; + + if (ether_ntohost(name, n) != 0) + return; + + printf(" (%s)", name); +} + static void list_scan(int s) { @@ -3767,6 +3778,7 @@ list_scan(int s) ); printies(vp + sr->isr_ssid_len + sr->isr_meshid_len, sr->isr_ie_len, 24); + printbssidname((const struct ether_addr *)sr->isr_bssid); printf("\n"); cp += sr->isr_len, len -= sr->isr_len; } while (len >= sizeof(struct ieee80211req_scan_result)); @@ -4904,8 +4916,10 @@ ieee80211_status(int s) printf(" channel UNDEF"); if (get80211(s, IEEE80211_IOC_BSSID, data, IEEE80211_ADDR_LEN) >= 0 && - (memcmp(data, zerobssid, sizeof(zerobssid)) != 0 || verbose)) + (memcmp(data, zerobssid, sizeof(zerobssid)) != 0 || verbose)) { printf(" bssid %s", ether_ntoa((struct ether_addr *)data)); + printbssidname((struct ether_addr *)data); + } if (get80211len(s, IEEE80211_IOC_STATIONNAME, data, sizeof(data), &len) != -1) { printf("\n\tstationname "); From nobody Thu Mar 23 00:31:08 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhmV44gqvz40Gn7; Thu, 23 Mar 2023 00:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PhmV44D6nz43t0; Thu, 23 Mar 2023 00:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679531468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O3CseVLJTI0495vK1lQYMm5ud3J2WFrwXi7gXc2ImTE=; b=W3nYtv5XL0wTZKN53MfBaRrdmhujXbFh/8nhnKxgetDqwZrn+JckSttzUeKvpzKuFWBvtR juqzHcL+37SjF+xjkoE/MIkvL4Hg1/zQM4E7v9zv/mgYUM8eiv+ZWRMTqmq0KAtoXsrJtI HQcHaNSVF9JaHxh005iw5Zhf/2HkWHhA8PawKPUtdLE6LxXKOdyL+XyEQJcLWlTkqnfX3w KwNt1Zzdn37tLxr88Ufk0R7+QdTY7vje3mxNYr5NDhdt/LeDBpt8HQsRha4mFiU/wIKR2M f6Ea5OPh+Wg+hne1QqVuKBswHACdbY8xuqak+xwHPUy3cAiKWa2ag1LqNBvHjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679531468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O3CseVLJTI0495vK1lQYMm5ud3J2WFrwXi7gXc2ImTE=; b=goZbz9tLfXDuLwmcl4PRnQQA6UFM541pEJKdgF9Me1A4LbHLFRM4tmK3jObakUzyF9d8Tg u1WWAoeOpPITSiPok1+36/Lbxzy7gCwZwcvYFQaOMMtj9y+c+zA/U1uH+6NDy5XJgpyqKY 9XdQSz33D+VBjBtSnWgySSoDK+e7Fy68RGmssB+xQzeWxtGu8BK17WoDRU2zxput2Y/kj6 lxweThDeEEXWOk/TYoaXtChY5cesU/jWgyDfKAFtEl2CI73gI42yjmyOhc22crhcoqkk9o CLcNLVVFhgVW+xdhaZByOWThl5St9KxjLUfTm9EGAowYqHq1oNPjzrDyAXk8zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679531468; a=rsa-sha256; cv=none; b=EO7tXEhpBdc4W9idQMpQIRp7tSkaYLRdhZX4asFz9fTThLjNF/4Z9ih0i4ntbztXpdoJzz qzns+iAm8u+sH3TUpJOHum2/XMFCEQ4c2RB7+kXJTtgS697RjJnxYS8YV3zuASFvNumErp LYj50eXpyXh6iMX8jDqNMtIenhSP3dGAr72MMOhzg0oGYPvFhc5A+NY49UPhgWMFTi1DSM sPPvT+SySVddrWzMJy2Ga55a/W2dPgjIX7eRGBJ540Rjs+nO+PA6TqbUd8HiEuOs5dkyu6 7/aqAmBL6kaOEEDxFuusJkPvRtIrtysKfN3FJ1CGC/QTjcIjVK1TwoYxGbHb4g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhmV43HsJzF9B; Thu, 23 Mar 2023 00:31: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 32N0V8ip010432; Thu, 23 Mar 2023 00:31:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N0V8T5010431; Thu, 23 Mar 2023 00:31:08 GMT (envelope-from git) Date: Thu, 23 Mar 2023 00:31:08 GMT Message-Id: <202303230031.32N0V8T5010431@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: 700acdc7b532 - main - rtw89: fix -Wunused-but-set-variable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 700acdc7b53213c1d9f35c05a1c1f58f285cd14d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=700acdc7b53213c1d9f35c05a1c1f58f285cd14d commit 700acdc7b53213c1d9f35c05a1c1f58f285cd14d Author: Bjoern A. Zeeb AuthorDate: 2023-03-23 00:29:38 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-03-23 00:29:38 +0000 rtw89: fix -Wunused-but-set-variable Fix a -Wunused-but-set-variable warning by adding the field to the debug logging as is done for other versions handler functions. MFC after: 3 days --- sys/contrib/dev/rtw89/coex.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/contrib/dev/rtw89/coex.c b/sys/contrib/dev/rtw89/coex.c index 4779fe3ef1f1..aa90bf616b41 100644 --- a/sys/contrib/dev/rtw89/coex.c +++ b/sys/contrib/dev/rtw89/coex.c @@ -4092,8 +4092,13 @@ static void _update_wl_info(struct rtw89_dev *rtwdev) } rtw89_debug(rtwdev, RTW89_DBG_BTC, +#if defined(__linux__) "[BTC], cnt_connect = %d, link_mode = %d\n", cnt_connect, wl_rinfo->link_mode); +#elif defined(__FreeBSD__) + "[BTC], cnt_connect = %d, connecting = %d, link_mode = %d\n", + cnt_connect, cnt_connecting, wl_rinfo->link_mode); +#endif _fw_set_drv_info(rtwdev, CXDRVINFO_ROLE); } From nobody Thu Mar 23 01:18:23 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhnXb3bXlz40KhX; Thu, 23 Mar 2023 01:18: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 4PhnXb34YXz4BNw; Thu, 23 Mar 2023 01:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679534303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCqi7B8Ci4PrG8cN3o0qqP0JTpB8v6NVVuPwITYwu9M=; b=yAYbX1uOSbKmCfpxMaEW8A+MOucfk4RVVjelmFKo3OfmXpC9tTFYS8Ha4SACP9Z6ZqkwbV aSyYyW0J5XGWDAK0RCXkaHyldrGzJD3Gsij8X+FkLlOwsu+LTD+ptHjUV7j/76m6s5ECGz pK4C0ZDrw7s0BZ4zGgkK1X4kU3QnIan2L/dBYqOTuHAokCuRnYQnfhsHrvJE9VDfV1uCrq PvM7ZZksMZL4IotShnx9tWmkaBDVZ3yDF+mcKnUoUyvpMkGDG3wkRXP+ze7PmQ3bdqfFZE cW//yfktAWbXoMyyEHydl3Ap6BjgPPMUtSBk9dRowSEZ6pZTsGwgcx2OFy3Vbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679534303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCqi7B8Ci4PrG8cN3o0qqP0JTpB8v6NVVuPwITYwu9M=; b=QRw5+YJIUBSJ2s0bT4bPYMikyiiIZuQZO2ojV+gw6AeFfPPAzgSnSVuP04B1MFBNX0cLoO 2sYvCnw501iUEqkfmtaEqjA/vHov9InvDabGd1wPd/LA4XHpPzGvwxrzo+TdunSwC34HA7 MLy+lVTHt/+xQHHNLlTTwimsY7GLUNU7og/uUI+EKMfnGGcWxMNGLRIiexMaB7TN6JWt+1 dAfvgmjxowb5c8vOCuG/jojA+zCLoEG+9KXRrfIzAMUkrgmW/DOL+kJY45PsZQvJ4p1FrD 6nalj5ru7F1L1bFd1+9M9bqc4Ve84mri2evTlNp7rFJ9LbQT6iyyTdZiMNSt9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679534303; a=rsa-sha256; cv=none; b=O42/QZ84aOPKkYbka9xPKlymPTKGPdZy6tmS6o7ql6i0WreMhVRtfjlHTfbS7R7nuzDXjS 2UTb2LFqa5orgGeoK7+NGxLrIubffmfde6cElyFxPMfIAuYylQydK8e2bJzNrX44cjDeCf MIbOnxFn4Ai2kkPIl8WqdoquzrWqPh85eyZ8kNe3OhgkIZ85gyGyP+lBukRzQxsfyPcZ06 qkXRzQGRE5w7r5jFlUyBJ3npmjUFiYdQfGgxikGDUIBaC6T5wNnVqMEd2tDvMzpfdhi2j7 wiDU2U8RuT4AAdWeZUU9NYgodAqutVl5axRAjyXp1MqOtzRMYYtMZ4eZ9dku0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhnXb27TJzGXm; Thu, 23 Mar 2023 01:18: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 32N1INVL081026; Thu, 23 Mar 2023 01:18:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N1IN2E081025; Thu, 23 Mar 2023 01:18:23 GMT (envelope-from git) Date: Thu, 23 Mar 2023 01:18:23 GMT Message-Id: <202303230118.32N1IN2E081025@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: 59559d1354ee - main - LinuxKPI: remove now implemented dummy headers. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59559d1354ee1bbff7dbf7c483a28b028b05c7fe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=59559d1354ee1bbff7dbf7c483a28b028b05c7fe commit 59559d1354ee1bbff7dbf7c483a28b028b05c7fe Author: Bjoern A. Zeeb AuthorDate: 2023-03-23 01:15:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-03-23 01:15:53 +0000 LinuxKPI: remove now implemented dummy headers. Both iommu.h and kconfig.h now exist in the common code. There is no need for the duplicate (empty) headers anymore. --- sys/compat/linuxkpi/dummy/include/linux/iommu.h | 0 sys/compat/linuxkpi/dummy/include/linux/kconfig.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/compat/linuxkpi/dummy/include/linux/iommu.h b/sys/compat/linuxkpi/dummy/include/linux/iommu.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sys/compat/linuxkpi/dummy/include/linux/kconfig.h b/sys/compat/linuxkpi/dummy/include/linux/kconfig.h deleted file mode 100644 index e69de29bb2d1..000000000000 From nobody Thu Mar 23 01:35:10 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phnw06VGsz40Lcr; Thu, 23 Mar 2023 01:35: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 4Phnw06F4Gz4F8m; Thu, 23 Mar 2023 01:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679535312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ti0XDkR0VZetnatKrA/WleUdKYlaYdSRWeW38W7oWnc=; b=uTOfdQ9yiiIUrMc73zz5jH5lGmtIrbvTQRvB8Z8erqMyFIz8u/9UZnyFaegHMVzRnH+CZl 1IrO83co+o4h6J1pSw2fEekuSN3IH8IJhliSe6jqhigB4WFBw2Vdm/XfHfNaAZYdaspWDH B2am0GxHdib8XzXq8TYDern+J6n2W84XB7b5z5uxtlFptJHbaudTtzVfDzrG0l5EgTJenX RPE2L/V91fw7ftwphpiNy1VKLeE5aP9QS4F3eNxdn1kKkItVIBlcBMkVCXOaum/9LLT4wW hk+JtZiksxsVvTrTKSnxCNkRnJp35Q7KkG3+PIIca8hgLGBKswspsV/edXaeEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679535312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ti0XDkR0VZetnatKrA/WleUdKYlaYdSRWeW38W7oWnc=; b=rAf6h0LHfEsYFSEeMHXD4aF/HSnE8MY/JVThwrRSKOnRCgwemjHvFShmXj+ZLoNs0OCvyP 7eCvuZQE1N0gkr1MRPohSp7Fpc6O3UuIHeh4IvA9eaZhYgmH9PJrYLtXZNqVWsE+kLIq+1 1pBY3Z1wE+k7HiehFnorALoGJSRuTwhsqh0k33a7TVcCO1k8Ub7t3m6meixVo0Pb/I0E9e Fdi+KisnHefLLxyorJJRjYlqwAtDa5yAHKmgknUvdhKtSk2DF8a7rFn+bt/5smybqnVSw6 1fAgX2G2X1kvquECWXH0+4/y1BRMB2p07cFQ9W4quei3agfXj8+8k6zCKaB4Dg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679535312; a=rsa-sha256; cv=none; b=eJmkWMrW6MoHj+Ea6M3QSV7nximvkpUnLFk8N3TzwEIKCV0bmjmBZ5EWQiM3DnfUTcOu2o +ybTVmIlf3Tbu2FNmX3TyAW7Lwknt//b5Swg3kqCL45qT8QFfDIg1v6e7Ufk0Brhk2XdfJ Gva1F27YLxILOAXsaofQbeZZcHLP5edG0Cm3VeiwRe00rZRgy2TNqaTJKO6gfBgm2YAUug ZfQHety+tW3y0gagdjvGIrbDjGE1p8iSv7VaGsqCwPHQERSHg1QjxFxQVE6l3hj9hT2YQf z10iIW7Zt9f+jvhDMlHwEAdZ7tYc/tKjNYgkq7TfdaBsWsOpnr/tHSoCboFwBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Phnw05HXRzGt8; Thu, 23 Mar 2023 01:35: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 32N1ZCkt012665; Thu, 23 Mar 2023 01:35:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N1ZAxf012663; Thu, 23 Mar 2023 01:35:10 GMT (envelope-from git) Date: Thu, 23 Mar 2023 01:35:10 GMT Message-Id: <202303230135.32N1ZAxf012663@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: 259e2ad76d1d - main - contrib/tzdata: import tzdata 2023a List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 259e2ad76d1da961cc34c2903cb5f72f28503eb8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=259e2ad76d1da961cc34c2903cb5f72f28503eb8 commit 259e2ad76d1da961cc34c2903cb5f72f28503eb8 Merge: 59559d1354ee e31cd8521ff5 Author: Philip Paeps AuthorDate: 2023-03-23 01:33:45 +0000 Commit: Philip Paeps CommitDate: 2023-03-23 01:33:45 +0000 contrib/tzdata: import tzdata 2023a Changes: https://github.com/eggert/tz/blob/2023a/NEWS MFC after: 1 day contrib/tzdata/CONTRIBUTING | 2 +- contrib/tzdata/Makefile | 53 ++++++++-------- contrib/tzdata/NEWS | 127 +++++++++++++++++++++++++++++++++----- contrib/tzdata/africa | 71 +++++++++++++--------- contrib/tzdata/antarctica | 2 +- contrib/tzdata/asia | 128 ++++++++++++++++++++++++++++++++++++--- contrib/tzdata/australasia | 44 ++++++-------- contrib/tzdata/backward | 1 + contrib/tzdata/backzone | 11 +++- contrib/tzdata/checktab.awk | 5 +- contrib/tzdata/europe | 59 +++++++++--------- contrib/tzdata/leap-seconds.list | 8 +-- contrib/tzdata/leapseconds | 8 +-- contrib/tzdata/leapseconds.awk | 50 +++++++++------ contrib/tzdata/northamerica | 31 +++++----- contrib/tzdata/southamerica | 2 +- contrib/tzdata/theory.html | 66 +++++++++++++------- contrib/tzdata/version | 2 +- contrib/tzdata/zone.tab | 29 +++++---- contrib/tzdata/zone1970.tab | 58 +++++++++--------- 20 files changed, 504 insertions(+), 253 deletions(-) diff --cc contrib/tzdata/Makefile index afb9d538a203,000000000000..6edc73cc6ffb mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1250 -1,0 +1,1249 @@@ +# Make and install tzdb code and data. + +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= Factory + - # The POSIXRULES macro controls interpretation of nonstandard and obsolete - # POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. - # Such a setting uses the rules in a template file to determine - # "spring forward" and "fall back" days and times; the environment - # variable itself specifies UT offsets of standard and daylight saving time. - # ++# The POSIXRULES macro controls interpretation of POSIX-like TZ ++# settings like TZ='EET-2EEST' that lack DST transition rules. +# If POSIXRULES is '-', no template is installed; this is the default. - # +# Any other value for POSIXRULES is obsolete and should not be relied on, as: +# * It does not work correctly in popular implementations such as GNU/Linux. +# * It does not work even in tzcode, except for historical timestamps +# that precede the last explicit transition in the POSIXRULES file. +# Hence it typically does not work for current and future timestamps. - # In short, software should avoid ruleless settings like TZ='EET-2EEST' - # and so should not depend on the value of POSIXRULES. - # +# If, despite the above, you want a template for handling these settings, +# you can change the line below (after finding the timezone you want in the +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. + +POSIXRULES= - + +# Also see TZDEFRULESTRING below, which takes effect only - # if the time zone files cannot be accessed. ++# if POSIXRULES is '-' or if the template file cannot be accessed. + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + +# Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) +TIME_T_ALTERNATIVES_HEAD = int_least64_t +TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 8536.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with +# applications that are not leap second aware, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_right + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, +# and was modified in tzdb 2021b to generate version 4 TZif files. +# EXPIRES_LINE defaults to 0 for now so that the leapseconds file +# can be given to pre-2020a zic implementations and so that TZif files +# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', +# but only for entries listed in the backward-compatibility file zone.tab, use +# PACKRATDATA= backzone +# PACKRATLIST= zone.tab +# If you want all the 'backzone' data, use +# PACKRATDATA= backzone +# PACKRATLIST= +# To omit this data, use +# PACKRATDATA= +# PACKRATLIST= + +PACKRATDATA= +PACKRATLIST= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Non-default libraries needed to link. +# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. +LDLIBS= + +# Add the following to the end of the "CFLAGS=" line as needed to override +# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DECL_TIMEGM=0 if does not declare timegm +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) - # -DHAVE_GENERIC=0 if _Generic does not work* ++# -DHAVE__GENERIC=0 if _Generic does not work* +# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), +# -DHAVE_GETRANDOM=0 to avoid using getrandom +# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), +# where LDLIBS also needs to contain -lintl on some hosts; +# -DHAVE_GETTEXT=0 to avoid using gettext +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with the POSIX standard +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). - # -DHAVE_INTTYPES_H=0 if does not work* ++# -DHAVE_INTTYPES_H=0 if does not work*+ +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_SETENV=0 if your system lacks the setenv function - # -DHAVE_SNPRINTF=0 if your system lacks the snprintf function ++# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ +# -DHAVE_STDCKDINT_H=0 if neither nor substitutes like +# __builtin_add_overflow work* - # -DHAVE_STDINT_H=0 if does not work* ++# -DHAVE_STDINT_H=0 if does not work*+ +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function - # -DHAVE_STRTOLL=0 if your system lacks the strtoll function ++# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if does not work* +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if does not work* +# -DHAVE_UTMPX_H=0 if does not work* +# -Dlocale_t=XXX if your system uses XXX instead of locale_t ++# -DPORT_TO_C89 if tzcode should also run on C89 platforms+ +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=long on hosts like MS-Windows that lack ssize_t ++# -DSUPPORT_C89 if the tzcode library should support C89 callers+ +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified - # DST transitions if the time zone files cannot be accessed ++# DST transitions for POSIX-style TZ strings lacking them, ++# in the usual case where POSIXRULES is '-'. If not specified, ++# TZDEFRULESTRING defaults to US rules for future DST transitions. ++# This mishandles some past timestamps, as US DST rules have changed. ++# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, ++# as Europe and US DST rules differ. ++# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably older ones that +# ignore or otherwise mishandle 64-bit data in TZif files; +# however, fat TZif files may trigger bugs in newer TZif readers. +# Slim TZif files are more efficient, and are the default. +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# +# * Options marked "*" can be omitted if your compiler is C23 compatible. ++# * Options marked "+" are obsolescent and are planned to be removed ++# once the code assumes C99 or later. +# +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector +# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wduplicated-branches -Wduplicated-cond \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ + -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ + -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ + -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wstringop-truncation -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. Although these two fields +# not required by POSIX, a future version of POSIX is planned to require them +# and they are widely available on GNU/Linux and BSD systems. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by +# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the following +# functions to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "timelocal" is equivalent to "mktime". +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the - # time library, and if STD_INSPIRED is also defined the functions ++# time library, and if STD_INSPIRED is also defined to nonzero the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and Posix conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. + +CFLAGS= + +# Linker flags. Default to $(LFLAGS) for backwards compatibility +# to release 2012h and earlier. + +LDFLAGS= $(LFLAGS) + +# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in +# submake command lines. The default is no leap seconds. + +LEAPSECONDS= + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around bugs in older applications, +# possibly at the expense of introducing bugs in newer ones, +# append "-b fat"; see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) + +# The name of a Posix-compliant 'awk' on your system. +# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. +# Also, it is better (though not essential) if 'awk' supports UTF-8, +# and unfortunately mawk and busybox awk do not support UTF-8. +# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. +AWK= awk + +# The full path name of a Posix-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to Posix, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + - # These characters are Latin-1, and so are likely to be displayable - # even in editors with limited character sets. - UNUSUAL_OK_LATIN_1 = «°±»½¾× - # This IPA symbol is represented in Unicode as the composition of - # U+0075 and U+032F, and U+032F is not considered alphabetic by some - # grep implementations that do not grok composition. - UNUSUAL_OK_IPA = u̯ ++# These non-alphabetic, non-ASCII printable characters are Latin-1, ++# and so are likely displayable even in editors like XEmacs 21 ++# that have limited display capabilities. ++UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. - UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA) ++UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) + +# Put this in a bracket expression to match spaces. +s = [:space:] + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w --sort=name +TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ + then echo $(GNUTARFLAGS); \ + else :; \ + fi` + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. +# This makes it easier to see which Zone has been affected. +DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ + || echo ' -F^TZ=') + +############################################################################### + +#MAKE= make + +cc= cc +CC= $(cc) -DTZDIR='"$(TZDIR)"' + +AR= ar + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o asctime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o asctime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README SECURITY theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ + check_tz-how-to.html check_tz-link.html +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone1970.tab zone.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ + $(PACKRATDATA) $(PACKRATLIST) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs +TZS_DEPS= $(YDATA) asctime.c localtime.c \ + private.h tzfile.h zdump.c zic.c +TZDATA_DIST = $(COMMON) $(DATA) $(MISC) +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab + +# And for the benefit of csh users on systems that assume the user +# shell should be used to handle commands in Makefiles. . . + +SHELL= /bin/sh + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ + if test '$(VERSION)' = unknown && V=`cat $@`; then \ + case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) \ + -v DATAFORM=`expr $@ : '\(.*\).zi'` \ + -v PACKRATDATA='$(PACKRATDATA)' \ + -v PACKRATLIST='$(PACKRATLIST)' \ + -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + version=`sed 1q version` && \ + LC_ALL=C $(AWK) \ + -v dataform='$(DATAFORM)' \ + -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ + -v redo='$(REDO)' \ + -v version="$$version" \ + -f zishrink.awk \ + $(DATAFORM).zi >$@.out + mv $@.out $@ + +version.h: version + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Arguments to pass to submakes of install_data. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + LEAPSECONDS='$(LEAPSECONDS)' \ + PACKRATDATA='$(PACKRATDATA)' \ + PACKRATLIST='$(PACKRATLIST)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +# 'make install_data' installs one set of TZif files. +install_data: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data + +right_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ + install_data + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ + >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + wd=`pwd` && \ + x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) -rc $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + VERSION=`cat version` && sed \ + -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \ + -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ + -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ + -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ + +check: check_back check_mild +check_mild: check_character_set check_white_space check_links \ + check_name_lengths check_slashed_abbrs check_sorted \ + check_tables check_web check_ziguard check_zishrink check_tzs + +check_character_set: $(ENCHILADA) + test ! '$(UTF8_LOCALE)' || \ + ! printf 'A\304\200B\n' | \ + LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ + LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE README SECURITY \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ + +check_white_space: $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + ! grep -n '[$s]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + touch $@ + +PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ +FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} + +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone + touch $@ + +PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ +STDOFF = [-+]?[0-9:.]+ +RULELESS_SAVE = (-|$(STDOFF)[sd]?) +RULELESS_SLASHED_ABBRS = \ + $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ + +check_slashed_abbrs: $(TDATA_TO_CHECK) + ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) + touch $@ + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + - check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab ++check_sorted: backward backzone + $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ + backward | LC_ALL=C sort -cu + $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu + touch $@ + +check_back: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) \ + -v DATAFORM=$(DATAFORM) \ + -v backcheck=backward \ + -f checklinks.awk $(TDATA_TO_CHECK) + touch $@ + +check_links: checklinks.awk tzdata.zi + $(AWK) \ + -v DATAFORM=$(DATAFORM) \ + -f checklinks.awk tzdata.zi + touch $@ + +check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) + for tab in $(ZONETABLES); do \ + test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ + $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ + || exit; \ + done + touch $@ + +check_tzs: $(TZS) $(TZS_NEW) + if test -s $(TZS); then \ + $(DIFF_TZS) $(TZS) $(TZS_NEW); \ + else \ + cp $(TZS_NEW) $(TZS); \ + fi + touch $@ + +check_web: $(CHECK_WEB_PAGES) +check_theory.html: theory.html +check_tz-art.html: tz-art.html +check_tz-how-to.html: tz-how-to.html +check_tz-link.html: tz-link.html +check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: + $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ + -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ + test ! -s $@.out || { cat $@.out; exit 1; } + mv $@.out $@ + +check_ziguard: rearguard.zi vanguard.zi ziguard.awk + $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ + diff -u rearguard.zi - + $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ + diff -u vanguard.zi - + touch $@ + +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: check_zishrink_posix check_zishrink_right +check_zishrink_posix check_zishrink_right: \ + zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ + $(TDATA) $(DATAFORM).zi tzdata.zi + rm -fr $@.dir $@-t.dir $@-shrunk.dir + mkdir $@.dir $@-t.dir $@-shrunk.dir + case $@ in \ + *_right) leap='-L leapseconds';; \ + *) leap=;; \ + esac && \ + $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ + $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ + case $(DATAFORM),$(PACKRATLIST) in \ + main,) \ + $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ + diff -r $@.dir $@-t.dir;; \ + esac + diff -r $@.dir $@-shrunk.dir + rm -fr $@.dir $@-t.dir $@-shrunk.dir + touch $@ + +clean_misc: + rm -fr check_*.dir + rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ *** 334 LINES SKIPPED *** From nobody Thu Mar 23 03:13:39 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phr5b2qyHz40Rwf; Thu, 23 Mar 2023 03:13: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 4Phr5b2KWxz4LlM; Thu, 23 Mar 2023 03:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679541219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cagzUigZkRrrp8zSMNsdpGhUTXK/OA2LYmlIfCw0LQs=; b=w31qtybr/qsuhclX3/k59+jXXs0K7XvinZ65oFkyTouo5ilp4YX6G0UsJidGh5g8ZxRMGk OT5xZi+Dc6KnwpKQF6S6SLVDOWoVBQ8jCaO1y0OyoxfZvgec4ABHfSyhrBFs96RFYosYxZ XNHDBy5fM+OXMzw9zxPw2kwT0bq8ReGCaMhWRFf/8REluWxF9hXe7OOpX+ZuTTxpAmL1Um xTnsSlPeawRPjttoTLQzWdQbYD3nTpBG6s1IiMFLHVAJ89QReL+CSCQFAxgjkgitiwkDs3 mEsB//XTenYJitT/34zjzb8rBxYN2Ko5h1E0qO0HFcKc4s84Q41JRCYP0FsQmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679541219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cagzUigZkRrrp8zSMNsdpGhUTXK/OA2LYmlIfCw0LQs=; b=dHNFd3omo1ybddxjYPkRZwupU1d2NitTCszmegAOopxK8Vu+JaggY7LXFwFgFDepBT6c3p 8urwPJ1r10KujFzkJroGXHRm0B3SuwCWbnpmjCf6/g+mE4G4fB4fl3LNpzVe9Ub/Aa8Nyi z7sSFPa/ik/8rxRTYo6NKyivqstEeEpr3hDKW9GkFd+rfNgFuIjZxxt6axm5+PdLFAOOeQ Cr1KUTL+98qPv9eIaplV9LY8DMXTphF5aAI6N1RI3+UvEzbynlsIGJM7jnAphlrfHYPXeS JwsPT1K2nSYdu3p0iJdZEvMlm3mo3IV+YlTE0CrbKKNSHMHSwrbEMSmiQ96aeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679541219; a=rsa-sha256; cv=none; b=Do5/DteSDjpDjzjPlAtDxNamIqepwjKtGsygjP5XeRSUYn1QYIdtu0VCWjAaGBp8hLyDag EqBD8I32Xqjg96iWzaTsWtzrhMP+vGDNmaHSkHO/PN3U+HwtiVR2ZZJ+IPlqq48EQ2hZNz m6G8HGSuK7U80kIRUeDvOErtm8CmsIHmVS+GVVCKwL1Ifq14xWsyVjUpZuBvxJmAxX3xzD XHVuAuURbAETdlfiDQOzKF+mu06phMwQASIujg9uNPRfRXqvG6vUunHGN+G3GIOkYfh4qx Y7oEVQjhF2uBv8FkgPlDC2sdurqsGbw9bqqFpnlQu5003eeoyeaNcZNTrszksQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Phr5b1N87zKkS; Thu, 23 Mar 2023 03:13: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 32N3DdWw077792; Thu, 23 Mar 2023 03:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N3DdUF077791; Thu, 23 Mar 2023 03:13:39 GMT (envelope-from git) Date: Thu, 23 Mar 2023 03:13:39 GMT Message-Id: <202303230313.32N3DdUF077791@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: 4c41f4a0d67f - main - daemon: decouple init logic from main loop List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c41f4a0d67fc93cfb07ad5287f02d024d19ef5a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4c41f4a0d67fc93cfb07ad5287f02d024d19ef5a commit 4c41f4a0d67fc93cfb07ad5287f02d024d19ef5a Author: Ihor Antonov AuthorDate: 2023-03-23 02:37:12 +0000 Commit: Kyle Evans CommitDate: 2023-03-23 02:37:12 +0000 daemon: decouple init logic from main loop main() func contained both initialization and main loop logic. This made certain operations like restarting problematic and required dirty hacks in form of goto jumps. This commit moves the main loop logic into daemon_eventloop(), cleans up main, and makes restart logic clear: daemon_mainloop() is run in a loop with a restart condition checked at the end. Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/699 --- usr.sbin/daemon/daemon.c | 195 ++++++++++++++++++++++++++--------------------- 1 file changed, 109 insertions(+), 86 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 983dbdc7ed8c..4b218c2b53c5 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -60,7 +60,12 @@ __FBSDID("$FreeBSD$"); #define LBUF_SIZE 4096 struct daemon_state { + sigset_t mask_orig; + sigset_t mask_read; + sigset_t mask_term; + sigset_t mask_susp; int pipe_fd[2]; + char **argv; const char *child_pidfile; const char *parent_pidfile; const char *output_filename; @@ -96,6 +101,7 @@ static void open_pid_files(struct daemon_state *); static void do_output(const unsigned char *, size_t, struct daemon_state *); static void daemon_sleep(time_t, long); static void daemon_state_init(struct daemon_state *); +static void daemon_eventloop(struct daemon_state *); static void daemon_terminate(struct daemon_state *); static volatile sig_atomic_t terminate = 0; @@ -163,47 +169,9 @@ main(int argc, char *argv[]) char *p = NULL; int ch = 0; struct daemon_state state; - sigset_t mask_orig; - sigset_t mask_read; - sigset_t mask_term; - sigset_t mask_susp; daemon_state_init(&state); - /* - * Signal handling logic: - * - * - SIGTERM is masked while there is no child. - * - * - SIGCHLD is masked while reading from the pipe. SIGTERM has to be - * caught, to avoid indefinite blocking on read(). - * - * - Both SIGCHLD and SIGTERM are masked before calling sigsuspend() - * to avoid racing. - * - * - After SIGTERM is recieved and propagated to the child there are - * several options on what to do next: - * - read until EOF - * - read until EOF but only for a while - * - bail immediately - * Currently the third option is used, because otherwise there is no - * guarantee that read() won't block indefinitely if the child refuses - * to depart. To handle the second option, a different approach - * would be needed (procctl()?). - * - * - Child's exit might be detected by receiveing EOF from the pipe. - * But the child might have closed its stdout and stderr, so deamon - * must wait for the SIGCHLD to ensure that the child is actually gone. - */ - sigemptyset(&mask_susp); - sigemptyset(&mask_read); - sigemptyset(&mask_term); - sigemptyset(&mask_orig); - sigaddset(&mask_susp, SIGTERM); - sigaddset(&mask_susp, SIGCHLD); - sigaddset(&mask_term, SIGTERM); - sigaddset(&mask_read, SIGCHLD); - /* * Supervision mode is enabled if one of the following options are used: * --child-pidfile -p @@ -309,6 +277,7 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; + state.argv = argv; if (argc == 0) { usage(1); @@ -343,8 +312,8 @@ main(int argc, char *argv[]) pidfile_write(state.parent_pidfh); if (state.supervision_enabled) { - /* Block SIGTERM to avoid racing until we have forked. */ - if (sigprocmask(SIG_BLOCK, &mask_term, &mask_orig)) { + /* Block SIGTERM to avoid racing until the child is spawned. */ + if (sigprocmask(SIG_BLOCK, &state.mask_term, &state.mask_orig)) { warn("sigprocmask"); daemon_terminate(&state); } @@ -357,8 +326,50 @@ main(int argc, char *argv[]) * not have superuser privileges. */ (void)madvise(NULL, 0, MADV_PROTECT); -restart: - if (pipe(state.pipe_fd)) { + } + do { + daemon_eventloop(&state); + close(state.pipe_fd[0]); + state.pipe_fd[0] = -1; + } while (state.restart_enabled && !terminate); + + daemon_terminate(&state); +} + + +/* + * Main event loop: fork the child and watch for events. + * In legacy mode simply execve into the target process. + * + * Signal handling logic: + * + * - SIGTERM is masked while there is no child. + * + * - SIGCHLD is masked while reading from the pipe. SIGTERM has to be + * caught, to avoid indefinite blocking on read(). + * + * - Both SIGCHLD and SIGTERM are masked before calling sigsuspend() + * to avoid racing. + * + * - After SIGTERM is recieved and propagated to the child there are + * several options on what to do next: + * - read until EOF + * - read until EOF but only for a while + * - bail immediately + * Currently the third option is used, because otherwise there is no + * guarantee that read() won't block indefinitely if the child refuses + * to depart. To handle the second option, a different approach + * would be needed (procctl()?). + * + * - Child's exit might be detected by receiveing EOF from the pipe. + * But the child might have closed its stdout and stderr, so deamon + * must wait for the SIGCHLD to ensure that the child is actually gone. + */ +static void +daemon_eventloop(struct daemon_state *state) +{ + if (state->supervision_enabled) { + if (pipe(state->pipe_fd)) { err(1, "pipe"); } /* @@ -371,43 +382,43 @@ restart: /* fork failed, this can only happen when supervision is enabled */ if (pid == -1) { warn("fork"); - daemon_terminate(&state); + daemon_terminate(state); } /* fork succeeded, this is child's branch or supervision is disabled */ if (pid == 0) { - pidfile_write(state.child_pidfh); + pidfile_write(state->child_pidfh); - if (state.user != NULL) { - restrict_process(state.user); + if (state->user != NULL) { + restrict_process(state->user); } /* * In supervision mode, the child gets the original sigmask, * and dup'd pipes. */ - if (state.supervision_enabled) { - close(state.pipe_fd[0]); - if (sigprocmask(SIG_SETMASK, &mask_orig, NULL)) { + if (state->supervision_enabled) { + close(state->pipe_fd[0]); + if (sigprocmask(SIG_SETMASK, &state->mask_orig, NULL)) { err(1, "sigprogmask"); } - if (state.stdmask & STDERR_FILENO) { - if (dup2(state.pipe_fd[1], STDERR_FILENO) == -1) { + if (state->stdmask & STDERR_FILENO) { + if (dup2(state->pipe_fd[1], STDERR_FILENO) == -1) { err(1, "dup2"); } } - if (state.stdmask & STDOUT_FILENO) { - if (dup2(state.pipe_fd[1], STDOUT_FILENO) == -1) { + if (state->stdmask & STDOUT_FILENO) { + if (dup2(state->pipe_fd[1], STDOUT_FILENO) == -1) { err(1, "dup2"); } } - if (state.pipe_fd[1] != STDERR_FILENO && - state.pipe_fd[1] != STDOUT_FILENO) { - close(state.pipe_fd[1]); + if (state->pipe_fd[1] != STDERR_FILENO && + state->pipe_fd[1] != STDOUT_FILENO) { + close(state->pipe_fd[1]); } } - execvp(argv[0], argv); + execvp(state->argv[0], state->argv); /* execvp() failed - report error and exit this process */ - err(1, "%s", argv[0]); + err(1, "%s", state->argv[0]); } /* @@ -417,64 +428,65 @@ restart: * * Unblock SIGTERM - now there is a valid child PID to signal to. */ - if (sigprocmask(SIG_UNBLOCK, &mask_term, NULL)) { + if (sigprocmask(SIG_UNBLOCK, &state->mask_term, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } - close(state.pipe_fd[1]); - state.pipe_fd[1] = -1; + close(state->pipe_fd[1]); + state->pipe_fd[1] = -1; - setproctitle("%s[%d]", state.title, (int)pid); + setproctitle("%s[%d]", state->title, (int)pid); for (;;) { - if (child_gone && state.child_eof) { + if (child_gone && state->child_eof) { break; } if (terminate) { - daemon_terminate(&state); + daemon_terminate(state); } - if (state.child_eof) { - if (sigprocmask(SIG_BLOCK, &mask_susp, NULL)) { + if (state->child_eof) { + if (sigprocmask(SIG_BLOCK, &state->mask_susp, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } while (!terminate && !child_gone) { - sigsuspend(&mask_orig); + sigsuspend(&state->mask_orig); } - if (sigprocmask(SIG_UNBLOCK, &mask_susp, NULL)) { + if (sigprocmask(SIG_UNBLOCK, &state->mask_susp, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } continue; } - if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) { + if (sigprocmask(SIG_BLOCK, &state->mask_read, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } - state.child_eof = !listen_child(state.pipe_fd[0], &state); + state->child_eof = !listen_child(state->pipe_fd[0], state); - if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { + if (sigprocmask(SIG_UNBLOCK, &state->mask_read, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } } - if (state.restart_enabled && !terminate) { - daemon_sleep(state.restart_delay, 0); - } - if (sigprocmask(SIG_BLOCK, &mask_term, NULL)) { + + /* + * At the end of the loop the the child is already gone. + * Block SIGTERM to avoid racing until the child is spawned. + */ + if (sigprocmask(SIG_BLOCK, &state->mask_term, NULL)) { warn("sigprocmask"); - daemon_terminate(&state); + daemon_terminate(state); } - if (state.restart_enabled && !terminate) { - close(state.pipe_fd[0]); - state.pipe_fd[0] = -1; - goto restart; + + /* sleep before exiting mainloop if restart is enabled */ + if (state->restart_enabled && !terminate) { + daemon_sleep(state->restart_delay, 0); } - daemon_terminate(&state); } static void @@ -746,6 +758,7 @@ daemon_state_init(struct daemon_state *state) { *state = (struct daemon_state) { .pipe_fd = { -1, -1 }, + .argv = NULL, .parent_pidfh = NULL, .child_pidfh = NULL, .child_pidfile = NULL, @@ -767,6 +780,16 @@ daemon_state_init(struct daemon_state *state) .output_fd = -1, .output_filename = NULL, }; + + sigemptyset(&state->mask_susp); + sigemptyset(&state->mask_read); + sigemptyset(&state->mask_term); + sigemptyset(&state->mask_orig); + sigaddset(&state->mask_susp, SIGTERM); + sigaddset(&state->mask_susp, SIGCHLD); + sigaddset(&state->mask_term, SIGTERM); + sigaddset(&state->mask_read, SIGCHLD); + } static _Noreturn void From nobody Thu Mar 23 03:13:40 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phr5d0J67z40Rg1; Thu, 23 Mar 2023 03:13: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 4Phr5c3qcWz4M9X; Thu, 23 Mar 2023 03:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679541220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eHXp9PTr/Ri8gnye9ySckb4wBVs70gvlaWQQLRhfjfM=; b=w6I2/eTwYFazj+7Zph1k5BdJqkFdc3UoyjdeffD0vMmxFm/9dyaEfMjMTCthsB3yJAwLZv MgYQJ/fi0DradwGxDpOMXm9BgVTA1vq8JfKvHYTQMnAlMh6c8vuzPCr0OnruI7i3JNrxWv 0cgnw7vZ+CfdlznjXVppYavQ+L6VKgKxCl3BFpvTb/8jknApA5FkEnp4pN/goHq0jMfZWF 7ZW2iDdLR2S2eaUiqEl01NxEWNqU7UHZ1ZVLaTqspCTv+3CxW6wNsLbBG1HaiXRKXWzHBK 4hoHYB+2gN1nUvcVkGCYV6DfX6tRhY6saYF2cpgBp1NFX5DjpLvOiHVSkV6PPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679541220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eHXp9PTr/Ri8gnye9ySckb4wBVs70gvlaWQQLRhfjfM=; b=KiD79HlxgsZv7RyxH5nhd8WfyX8OPhKuacj77uxwKcN0QFKoUPXmpbvDrahaY+hztJVWZ7 0bhha7gDqevgPh0TfQOkA5f3lDfs0oSqFuP+GCpJseTLYRcLVqt+WkKs5sJwfrw0jcRRTr h7vqDjjkmxSVzyrMf6l8brsDdBOyDfTmfjd+m8ajqoMVSxSmqW+xiAw4y+kZEVM0mDLvYG lYyCi3bY2PoZm9YQeqSb+6MyVh/VHIfiz9JkVidNrFRN+kM5j3PRFWWykIMS37FerCJRPs wDqtSHCex/Y8kDNPX/3DojKbe7MQ1EmQvt27boz+Gl5WKdxw9RgRg3r+hHeDKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679541220; a=rsa-sha256; cv=none; b=GMQqd+5iZMIEa/zgUOLOfMYYafzR24HpxIK/Zk9FKxqNBds6OkqMBhU/zY3AOWxPWF9rtN zBCAt/VYDkYWWzo+G3D6y2LDsvSuKFzI6P1G/RFQ9mJsoBfAxr/GnU8vwNerxCuZNXX9m1 qZXrYqMeQwqgxF4ktLedPSfvtFWAL6mX1CNdY9/LnXsiHb/YMLT40G5zHD4+qPCT9uzwsf uhUACgC8+niptDYrA4IKZApElzvlNSYrLM0RCTEIoI342nrUnFNtsHylnxDsPZ1Hu+F1n1 Zdz8EADVM3m506Bn91A6NY2doLSMbjzon0uNwyVvFb7d0tVZbTVPXp4lxNTLig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Phr5c2JFbzKZW; Thu, 23 Mar 2023 03:13: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 32N3De55077811; Thu, 23 Mar 2023 03:13:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32N3Dewk077810; Thu, 23 Mar 2023 03:13:40 GMT (envelope-from git) Date: Thu, 23 Mar 2023 03:13:40 GMT Message-Id: <202303230313.32N3Dewk077810@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: b84aaf143c50 - main - daemon: reformat longopts List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b84aaf143c5097e6b2481b9afec66c90deec627f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b84aaf143c5097e6b2481b9afec66c90deec627f commit b84aaf143c5097e6b2481b9afec66c90deec627f Author: Kyle Evans AuthorDate: 2023-03-23 02:39:10 +0000 Commit: Kyle Evans CommitDate: 2023-03-23 02:39:34 +0000 daemon: reformat longopts Use a single tab instead of eight spaces, these aren't line continuations. --- usr.sbin/daemon/daemon.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 4b218c2b53c5..790b0f6fcd0f 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -112,23 +112,23 @@ static volatile sig_atomic_t do_log_reopen = 0; static const char shortopts[] = "+cfHSp:P:ru:o:s:l:t:m:R:T:h"; static const struct option longopts[] = { - { "change-dir", no_argument, NULL, 'c' }, - { "close-fds", no_argument, NULL, 'f' }, - { "sighup", no_argument, NULL, 'H' }, - { "syslog", no_argument, NULL, 'S' }, - { "output-file", required_argument, NULL, 'o' }, - { "output-mask", required_argument, NULL, 'm' }, - { "child-pidfile", required_argument, NULL, 'p' }, - { "supervisor-pidfile", required_argument, NULL, 'P' }, - { "restart", no_argument, NULL, 'r' }, - { "restart-delay", required_argument, NULL, 'R' }, - { "title", required_argument, NULL, 't' }, - { "user", required_argument, NULL, 'u' }, - { "syslog-priority", required_argument, NULL, 's' }, - { "syslog-facility", required_argument, NULL, 'l' }, - { "syslog-tag", required_argument, NULL, 'T' }, - { "help", no_argument, NULL, 'h' }, - { NULL, 0, NULL, 0 } + { "change-dir", no_argument, NULL, 'c' }, + { "close-fds", no_argument, NULL, 'f' }, + { "sighup", no_argument, NULL, 'H' }, + { "syslog", no_argument, NULL, 'S' }, + { "output-file", required_argument, NULL, 'o' }, + { "output-mask", required_argument, NULL, 'm' }, + { "child-pidfile", required_argument, NULL, 'p' }, + { "supervisor-pidfile", required_argument, NULL, 'P' }, + { "restart", no_argument, NULL, 'r' }, + { "restart-delay", required_argument, NULL, 'R' }, + { "title", required_argument, NULL, 't' }, + { "user", required_argument, NULL, 'u' }, + { "syslog-priority", required_argument, NULL, 's' }, + { "syslog-facility", required_argument, NULL, 'l' }, + { "syslog-tag", required_argument, NULL, 'T' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; static _Noreturn void From nobody Thu Mar 23 07:53:27 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhyJT19ckz411vm for ; Thu, 23 Mar 2023 07:53:29 +0000 (UTC) (envelope-from 010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com) Received: from a8-52.smtp-out.amazonses.com (a8-52.smtp-out.amazonses.com [54.240.8.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PhyJS1Z9rz3rN2 for ; Thu, 23 Mar 2023 07:53:28 +0000 (UTC) (envelope-from 010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn header.b=HtCN1si1; dkim=pass header.d=amazonses.com header.s=224i4yxa5dv7c2xz3womw6peuasteono header.b="ip/ht7wQ"; spf=pass (mx1.freebsd.org: domain of 010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com designates 54.240.8.52 as permitted sender) smtp.mailfrom=010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com; dmarc=pass (policy=none) header.from=tarsnap.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1679558007; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=EONDGMFm0pjOqYQjepe/PTCFAsynLS0SK+pVvxAfiyQ=; b=HtCN1si12K6W1xUaCTDVU1wZ4ywf18nuNBFVf+ZErjHPYnlbsIf+Pt8qGZyNrcr4 ye/LFBB2pJk65v6wA7lcHr9lndYNVJXejlLQeFJHNblYx7VF0lj4STi2hDYtosbJAH9 U0ZYaj/nsRRWolMLHdompCJ2tqOTjKwLeZB9jwrE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1679558007; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=EONDGMFm0pjOqYQjepe/PTCFAsynLS0SK+pVvxAfiyQ=; b=ip/ht7wQZNF9mWKu0SxTkCrlYtyHDjJnEDVw/rbRbtXff/AC38/OX+jPQ1MkMYDs 9YPU7DeprOyNpKkw7yg8xSMXbmNIujG3WXgEXvbSH1cdc1huz+UDYGUap0p9uOKMLgT wJfVlz2WQSj75q721fvZ+0WpFVG1HFMrxDbOftN0= Message-ID: <010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@email.amazonses.com> Date: Thu, 23 Mar 2023 07:53:27 +0000 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: git: ed52baf51bd1 - main - _endian.h: Include sys/ctypes.h for visibility macros To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> Content-Language: en-US From: Colin Percival In-Reply-To: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-SES-Outgoing: 2023.03.23-54.240.8.52 X-Spamd-Result: default: False [-1.19 / 15.00]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.986]; DMARC_POLICY_ALLOW(-0.50)[tarsnap.com,none]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn,amazonses.com:s=224i4yxa5dv7c2xz3womw6peuasteono]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-main@FreeBSD.org]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com,010001870d7559c5-696f82f5-3218-4c79-9252-a72cf5167c37-000000@amazonses.com]; FROM_HAS_DN(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[54.240.8.52:from]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[amazonses.com:dkim] X-Rspamd-Queue-Id: 4PhyJS1Z9rz3rN2 X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N On 3/21/23 19:26, Warner Losh wrote: > [...] > This had the side effect of sometimes (in the traditional BSD > compliation environment) > #if BYTE_ORDER == LITTLE_ENDIAN > and > #if BYTE_ORDER == BIG_ENDIAN > both being true because none of these were defined. This fixes > that. It also fixes including it after but not before. Would it be worth adding #if LITTLE_ENDIAN == BIG_ENDIAN #error Endian defines are broken! #endif just to ensure that any future issues show up quickly? -- Colin Percival FreeBSD Deputy Release Engineer & EC2 platform maintainer Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From nobody Thu Mar 23 08:13:29 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Phylr5jYZz412yW for ; Thu, 23 Mar 2023 08:13:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 4Phylq6MYyz3v0F for ; Thu, 23 Mar 2023 08:13:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b="Z12AANk/"; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2a00:1450:4864:20::536) smtp.mailfrom=wlosh@bsdimp.com; dmarc=none Received: by mail-ed1-x536.google.com with SMTP id h8so82941412ede.8 for ; Thu, 23 Mar 2023 01:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1679559220; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=A9mB95AeNkhSXvzdyC5VGMKI0fp79nA9a7yBdmjgZOY=; b=Z12AANk/CSf7WYfQK3ZIyOG7XJZ49PiABFitxYMJkgjuZj1heI5TYHquVYl0cR8img AvuTqbrrD6ydfh5giOuJJLMdi8ao6anAbSAogDbThDtP/wvOFF47WSskdbTD8cXRR/L7 PAVALGa9605oL3mTrhx+IZlk1Wi5J25+rKFEhGpyTBZUKY/MtMWDTIGS9u8v5hbrNyvM q6qPxwUuPtlNz/oliT0O7enByjuVEOIS19IbXcL2eLDbhzSROa86rdOtiwEFk/ouTOGZ SWAAv7hmv6Uc+4E3UNruMVOvDJNpc08bK4qqEa7ybIKFqjRijOSM8zTpuo2i8gJLZ46G jwIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679559220; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A9mB95AeNkhSXvzdyC5VGMKI0fp79nA9a7yBdmjgZOY=; b=Mhy6rD4xeZLoKcXH57SeW29vHUvJc/fKlJwzdAqSWZl4qaAgACdWC9VPF3+obqvn/b PZNx+poXY0yNUY0feOUk93OKR0kVI+1jx/hBOEmwfoaKfYyllJQh7tuE4kRiYBX8O+jV XIudlIs09la3eIdRGGHDV2SVraD2a+R8LxGjgK8Pt9sKpPvBiGthGjz0StJngn2sTpAr s6d8pvYQA2FA4TedtG9Av6Lktsfln0MN234KCWl5G42EsSP34B8CHTK6nOpCkcdI7OZK zo4pJekOvVZEtLXsETIHq73W+7heEHpKt801NDsvf3HfK8NhDbO8DZpblJc7jxEfSe+5 OzgQ== X-Gm-Message-State: AO0yUKW/CC7pqU8SwBfIksiBQDY43qNAipYLYLw8dfFibc/GjsG3OkNt Mvx/RjzaubCwLTuXL74VKHPDnCFXdBnv/cHvRXxsXg== X-Google-Smtp-Source: AK7set+Vw9DV8glRDnwPEQc2saApqlW3HLPmXhZbBT1MpxVc8FXC40hCa0v+AR+2F3dpAZIY2ATkTWc5p09Xm8LYKw4= X-Received: by 2002:a17:907:a706:b0:930:310:abcf with SMTP id vw6-20020a170907a70600b009300310abcfmr5077908ejc.2.1679559220441; Thu, 23 Mar 2023 01:13:40 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> <010001870d7559c1-09ae94d7-ae1d-4a75-880e-e4f55b4b178e-000000@email.amazonses.com> In-Reply-To: <010001870d7559c1-09ae94d7-ae1d-4a75-880e-e4f55b4b178e-000000@email.amazonses.com> From: Warner Losh Date: Thu, 23 Mar 2023 02:13:29 -0600 Message-ID: Subject: Re: git: ed52baf51bd1 - main - _endian.h: Include sys/ctypes.h for visibility macros To: Colin Percival Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b6c50e05f78cda61" X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.997]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::536:from]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_SPF_NA(0.00)[no SPF record]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; DMARC_NA(0.00)[bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4Phylq6MYyz3v0F X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N --000000000000b6c50e05f78cda61 Content-Type: text/plain; charset="UTF-8" On Thu, Mar 23, 2023, 8:53 AM Colin Percival wrote: > > > On 3/21/23 19:26, Warner Losh wrote: > > [...] > > This had the side effect of sometimes (in the traditional BSD > > compliation environment) > > #if BYTE_ORDER == LITTLE_ENDIAN > > and > > #if BYTE_ORDER == BIG_ENDIAN > > both being true because none of these were defined. This fixes > > that. It also fixes including it after but not before. > > Would it be worth adding > > #if LITTLE_ENDIAN == BIG_ENDIAN > #error Endian defines are broken! > #endif > > just to ensure that any future issues show up quickly? > Not in *endian.h. The problem is that we fail to define them at all, then user programs expect to use them and sometimes they are defined, and other times they are not. Inside of endian.h the above can be true when we're not compiling for __BSD_VISIBLE because in C's reprocessor, undefined values are substituted with zero always... I'd planned on adding a test for it, though, to make sure that we catch this case in testing. But I was planning on that test being: #include int big_endian = BIG_ENDIAN; int little_endian = LITTLE_ENDIAN; int byte_order = BYTE_ORDER which will catch the undefined case since there's no 'substitute 0 for undefined' in an rval. Warner --000000000000b6c50e05f78cda61 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Mar 23, 2023, 8:53 AM Colin P= ercival <cperc= iva@tarsnap.com> wrote:


On 3/21/23 19:26, Warner Losh wrote:
>=C2=A0 =C2=A0 =C2=A0 [...]
>=C2=A0 =C2=A0 =C2=A0 This had the side effect of sometimes (in the trad= itional BSD
>=C2=A0 =C2=A0 =C2=A0 compliation environment)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D LITTLE_ENDIAN
>=C2=A0 =C2=A0 =C2=A0 and
>=C2=A0 =C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D BIG_ENDIAN
>=C2=A0 =C2=A0 =C2=A0 both being true because none of these were defined= . This fixes
>=C2=A0 =C2=A0 =C2=A0 that. It also fixes including it after <stdio.h= > but not before.

Would it be worth adding

#if LITTLE_ENDIAN =3D=3D BIG_ENDIAN
#error Endian defines are broken!
#endif

just to ensure that any future issues show up quickly?


Not in *endian.h. The problem is that we fail to define them
at all, then user programs expect to use them and sometimes
th= ey are defined, and other times they are not. Inside of endian.h
= the above can be true when we're not compiling for __BSD_VISIBLE
<= div>because in C's reprocessor, undefined values are substituted with
zero always...

I'd planned on adding = a test for it, though, to make sure that we catch
this case i= n testing. But I was planning on that test being:

= #include <endian.h>
int big_endian =3D BIG_ENDIAN;
int little_endian =3D LITTLE_ENDIAN;
int byte_order =3D BYTE_OR= DER

which will catch the undefined case since ther= e's no 'substitute 0
for undefined' in an rval.
=

Warner
--000000000000b6c50e05f78cda61-- From nobody Thu Mar 23 11:32:47 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj39X00PJz41DYm; Thu, 23 Mar 2023 11: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 4Pj39W55Mxz4D9s; Thu, 23 Mar 2023 11:32:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679571167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5HWlRPQDLhklwnh4yv8vAt39x4A6BCvTYPf4spkGTaU=; b=Nk+kRIm9ef8EBpxHpJzOIuTWl5cn72T7Gp2DP73ASSjhzKOPQuZgyY0fPSDFbpAMF4eqhY DKxupCzlHHFomH3Oqfl54aVG4dyT2pdNbexmBA4RN4Ymd0FDd1104RSmNARXlPGj3YEdaf vA3sVFjWRFQBZnQQNmiAtR97J1uaHrqIaUpJy25frVkQCG/izSlEPxYdqmRanXrYzFo2GH fxOJ/UwX/sqAL5p2ifEkdWylUWhOObtSpYopJk9R8Y+1f/DZVuiSxV/Be2h+1ar+jkmUko vX0I4zhF9opvd3L2IrzHpt/feP+nCX9xFVSNYFaPrPANU5nXYF7AZOaACtnvQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679571167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5HWlRPQDLhklwnh4yv8vAt39x4A6BCvTYPf4spkGTaU=; b=rr6aIUKxFvQ+L01+xrgvhNC2Y/LFrv4UG37L/ift/sd174kMSa1nCKHlobQh1SzEkR/4cL 4AxuKX9P43KU2L3w0F+02m1eEy+0pdbh0Wx2jdcdSOMX3ezc+2yBkrfGBVQRrc2k9ZT1bM FImKJ0pUwMVbSYNT0wRTLah6n1Q/9Dac92tXCG3Mf2amtz2P8jEXaTSg7Kp3A9u60Dheol Q92E8Pgy7qTP8qOIyfIFycv8YMakAO3Y3L/WutZDoMeDVArHhJN4RDQMk9q0mJTQGcvm7n epDaH1dIeCMi/zs3a57mvWK8nt8px6ayqUx/QUPuIGJ0ThNYYgWf2+MrTGLU7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679571167; a=rsa-sha256; cv=none; b=qFKj/0rEBfGWlxM0/k0H3s7ErxEZhprejymn1jI9U6sjtromGvG0oq53BV92Sxyu89Rt0N g3/rCVvKp4+ROLf2PESi3wjJbUVmkO+xPXjhl60r4g/idCkAh5fEyyjOk+4aMvUB0Uhkni rjhFVSlqzpgy0bJ6hLDO6u9GHuVNRItfkw+o9xW91brwZs0p/tYuAr9DgJtWKoE7wsua1e Hau0t9Ey1M98CQS1rpwYJ1Kox1inQDMfGHdUgpvF5GRMRIu1MpRwHssfjmjhBXXSdBf3Q5 iJ8+HnyeY87x2HY1Rh7jLdTQOibsBgesWV3IZuEvPRajn64AT989U3qx/cKyyg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pj39W49k1zZ72; Thu, 23 Mar 2023 11: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 32NBWlRg098140; Thu, 23 Mar 2023 11: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 32NBWlnO098139; Thu, 23 Mar 2023 11:32:47 GMT (envelope-from git) Date: Thu, 23 Mar 2023 11:32:47 GMT Message-Id: <202303231132.32NBWlnO098139@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: c65c969bd5d4 - main - makefs: correct iso9660 Rock Ridge TF timestamps List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c65c969bd5d4ae7c52dedafb3c39b7e933079d4a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c65c969bd5d4ae7c52dedafb3c39b7e933079d4a commit c65c969bd5d4ae7c52dedafb3c39b7e933079d4a Author: Ed Maste AuthorDate: 2023-03-22 23:42:45 +0000 Commit: Ed Maste CommitDate: 2023-03-23 11:11:58 +0000 makefs: correct iso9660 Rock Ridge TF timestamps The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were incorrect, and timestamps were written in the wrong order. See RRIP 4.1.6 Description of the "TF" System Use Entry for details. PR: 203531 Reported by: Thomas Schmitt Reviewed by: jrtc27, kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39221 --- usr.sbin/makefs/cd9660/iso9660_rrip.c | 4 ++-- usr.sbin/makefs/cd9660/iso9660_rrip.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c index d4440a656bad..afe46c58747d 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.c +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c @@ -699,11 +699,11 @@ cd9660node_rrip_tf(struct ISO_SUSP_ATTRIBUTES *p, fsnode *_node) */ cd9660_time_915(p->attr.rr_entry.TF.timestamp, - _node->inode->st.st_atime); + _node->inode->st.st_mtime); p->attr.rr_entry.TF.h.length[0] += 7; cd9660_time_915(p->attr.rr_entry.TF.timestamp + 7, - _node->inode->st.st_mtime); + _node->inode->st.st_atime); p->attr.rr_entry.TF.h.length[0] += 7; cd9660_time_915(p->attr.rr_entry.TF.timestamp + 14, diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.h b/usr.sbin/makefs/cd9660/iso9660_rrip.h index 3e1a6cb0e7d8..ef35405c62e6 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.h +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.h @@ -52,14 +52,14 @@ #define PX_LENGTH 0x2C #define PN_LENGTH 0x14 -#define TF_CREATION 0x00 -#define TF_MODIFY 0x01 -#define TF_ACCESS 0x02 -#define TF_ATTRIBUTES 0x04 -#define TF_BACKUP 0x08 -#define TF_EXPIRATION 0x10 -#define TF_EFFECTIVE 0x20 -#define TF_LONGFORM 0x40 +#define TF_CREATION 0x01 +#define TF_MODIFY 0x02 +#define TF_ACCESS 0x04 +#define TF_ATTRIBUTES 0x08 +#define TF_BACKUP 0x10 +#define TF_EXPIRATION 0x20 +#define TF_EFFECTIVE 0x40 +#define TF_LONG_FORM 0x80 #define NM_CONTINUE 0x80 #define NM_CURRENT 0x100 #define NM_PARENT 0x200 From nobody Thu Mar 23 12:41:26 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj4hk5w8qz41JR7; Thu, 23 Mar 2023 12:41: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 4Pj4hk5Ttyz4Kmm; Thu, 23 Mar 2023 12:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679575286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qqIy9BugISnCRkOTKaRrmvsFeRj3itV54hWfH7ZZs0w=; b=IWU9fYTm0xSrxVB6RlZBwXX6P+rn8vLfSQ6DGu2NU0uAOEVcWqzB6i1Pe8ajKishjj8j+f CKdwZWK/NgXK3YuH9pUAx1kGVj4vdaa9z84kR09fxpLgkxDUz5PSDMkyYWbdc+aSHSPu7U Xmfz/QyQggAvs3/VF2zpdIfB2lw8pgfFFSlu4BRJlSnpUR1jo/we9Y6TiRAEvwQGbJrq6L 2svIt6hHoVT72Va55/eueB77VQCAL1dJAaOw5hW3nPMSiW5+nKFceXVX+ov7vCOuzVRRaZ Hr4XKYtzBeL+EW6sFR9grHdvH5RNsjHhXT07zZtvB4C02Frzaj+o7IyRQ4Gv1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679575286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qqIy9BugISnCRkOTKaRrmvsFeRj3itV54hWfH7ZZs0w=; b=Suq0werHBtiPvpDTXmgSjvldzJM4XKixSEjaIoQYNLSIIHJISXvRWwz0mwMketSv480LDM dregUW/oF7i4o7YgB3GhncgUA9W1XDGxCmtZtTRefOWxLDCpWJq+DhJatgQZc67Tgsdpgd QwQVNORyHBrDsloKVtPFOA5fplE4uJgk9U/zi063/jYmDX32CoktgYSZdJl3DT0w/oqugs Dojt8UkhlDjYtVvHeJXHjpq6eFYY/wJ5MEfNrCLxjXDUTYlsDDw7qWpHof3OCLk3ACjcKk hEDTvSsMeHJr63z5PsCi2+tNOxuTWvAN8eVFg4hP4FgeM6J8SuGPSMJNq1YXvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679575286; a=rsa-sha256; cv=none; b=ph9CmQKOeW/2ysyK8bQ9DdjMyJSPNsr9FDL1AJDucccEEoW9IYAOqDdrolX0y+B1bShb9p kgM6NNysC5yju7G3GOHqJ+c2fyGLMNKWv3slRsLaD87T8XVWgWFNCS6cqjLCHZBBkr4gEt uiFwCmra4jHHI2qBJNrLjn09h8wW5GzTzplh7HFNw5OWdJ8UDJDnIUK4wRvtXSJXZdn7sX pOkEBSWHGAKZC9r+CdfGLaTkSzjJpoEmEAdDHfMGUGcxVucbFpM2xviuP6f16ER6Dca5Rx vR7SqcwUpz1R2oRMbk+lLS5mcTU5pVw/NIcA3Nh+ImMTnJdgr622srkr/VR8pQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pj4hk4Yfkzbx8; Thu, 23 Mar 2023 12:41: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 32NCfQKE011041; Thu, 23 Mar 2023 12:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NCfQBW011040; Thu, 23 Mar 2023 12:41:26 GMT (envelope-from git) Date: Thu, 23 Mar 2023 12:41:26 GMT Message-Id: <202303231241.32NCfQBW011040@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: c3ec19359e05 - main - makefs: correct iso9660 Rock Ridge NM values List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3ec19359e05c3b609e461896aa6ab4d6ad8121f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c3ec19359e05c3b609e461896aa6ab4d6ad8121f commit c3ec19359e05c3b609e461896aa6ab4d6ad8121f Author: Ed Maste AuthorDate: 2023-03-23 12:35:34 +0000 Commit: Ed Maste CommitDate: 2023-03-23 12:36:15 +0000 makefs: correct iso9660 Rock Ridge NM values These are not actually used by makefs (yet), but ought to match the spec. See RRIP 4.1.4 Description of the "NM" System Use Entry for details. PR: 203531 Sponsored by: The FreeBSD Foundation --- usr.sbin/makefs/cd9660/iso9660_rrip.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.h b/usr.sbin/makefs/cd9660/iso9660_rrip.h index ef35405c62e6..72323ab695e1 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.h +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.h @@ -60,9 +60,9 @@ #define TF_EXPIRATION 0x20 #define TF_EFFECTIVE 0x40 #define TF_LONG_FORM 0x80 -#define NM_CONTINUE 0x80 -#define NM_CURRENT 0x100 -#define NM_PARENT 0x200 +#define NM_CONTINUE 0x01 +#define NM_CURRENT 0x02 +#define NM_PARENT 0x04 #define SUSP_LOC_ENTRY 0x01 From nobody Thu Mar 23 13:11:03 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj5Lw120yz41Ksc; Thu, 23 Mar 2023 13:11: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 4Pj5Lw0YkFz4QY4; Thu, 23 Mar 2023 13:11:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679577064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oj0LxMw4w3bTPJAS4XGLwtRJRf7WTsVzE+75VhEhRl0=; b=kRWRtt47VZYuEEE9RrmCxWVYoWx9jh9qG26amvCcL/wC+Faca3pdqXaA5AKB7TNUIrQesP 6JNfQFweFKndme877sxc8YmjAO2lO6RXf7mUXWjf4fmrB/jBcDvopjjpcuglSoeDQo5Ph0 SGM4F30SeAFCPo0xGKIH/Vu0v0lXffA8ngg0cwFe5+1rZbn8eBUzpNOOhvT16P7folZgmc M/H9NLWhHoF1qXm0SCH+RjAN1YmsiS42eKStBqI115Z/fD4d7A9H1RZ4YLiV8+IXpkQsPu ChREYl+jcjjFjdWhDt16rm0uzM++I4Hpm+gEtWP7HKoqr/MqG04uQxYf69d+8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679577064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oj0LxMw4w3bTPJAS4XGLwtRJRf7WTsVzE+75VhEhRl0=; b=iy0P1WtNJbSOfs7Daw5AMXorCsatnAWS9BWS3X0q/S3nwormCixPfBH4lsbaUFWtCrPRcA VcVOOf5Lp/mlwhZO5jK+H5Q6EFwRCRXjUjRhe2EVN3h9rTt6jk9A8GRZwIYdRyCblpYSJ9 QsY3wz7J//fLfwnnjQJVX+3sQU/hutF6V/EYbBSD3doln6rMGwcoXl8lRNm5g0Webb6kqU 4KYV5iLwyG4buzEjtsCJFP5K0lJ8Z2acbVOrGEmIdjjV/y1HpSDACES2Q67EIZrQX+xBpu uRegBnqNTFPMk1XeZw5OubMvt73V4Si7PmcSXXjKnW4RCE9W7J42MLHjgAFx1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679577064; a=rsa-sha256; cv=none; b=AdrehHmAV9zPgsvasDi230wbuip35AFFrnpi8WS9ixLBhjG85BtAsVapSxh5Zf3u+yQAIF vCWiNgQ65Kj34+3bp02wMq3SxkoKF87tpjQ/YQzLl3/YIjbX2d8UftayRhCoWlz7TVAISi u45SyyV3gGtHPlcBUtJVdKPN/AiZEb817hxk2rDeKU4F16a6UdRj4huILkezJBizwFxajJ 3/iVL7G2fwly1QzyYUfwdhSbry0kU0bdi2E87/YGGO5iWRCjdBDUFw/QVB+a4CqwXeP300 6geoY1fHywIV2k9C5+6azuEptaFW5jHUEuDByKXM0MPQtY37FK6ME2O1uNqwKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pj5Lv6l1vzcRZ; Thu, 23 Mar 2023 13:11: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 32NDB3Ip057954; Thu, 23 Mar 2023 13:11:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NDB32F057953; Thu, 23 Mar 2023 13:11:03 GMT (envelope-from git) Date: Thu, 23 Mar 2023 13:11:03 GMT Message-Id: <202303231311.32NDB32F057953@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: 2af158ae8313 - main - makefs: add missing break for 'g' case in tarfs test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2af158ae8313b250077f5ba60dc41fbed4e711af Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2af158ae8313b250077f5ba60dc41fbed4e711af commit 2af158ae8313b250077f5ba60dc41fbed4e711af Author: Ed Maste AuthorDate: 2023-03-23 13:08:48 +0000 Commit: Ed Maste CommitDate: 2023-03-23 13:10:31 +0000 makefs: add missing break for 'g' case in tarfs test Reported by: Coverity Scan CID: 1506954 Fixes: 6cb78fa479c7 ("tarfs: Repeat tests using GNU tar if available.") Sponsored by: The FreeBSD Foundation --- tests/sys/fs/tarfs/mktar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/fs/tarfs/mktar.c b/tests/sys/fs/tarfs/mktar.c index 391ac9170171..b4ec271c73a1 100644 --- a/tests/sys/fs/tarfs/mktar.c +++ b/tests/sys/fs/tarfs/mktar.c @@ -174,6 +174,7 @@ main(int argc, char *argv[]) switch (opt) { case 'g': opt_g = true; + break; case 'v': opt_v = true; break; From nobody Thu Mar 23 13:38:28 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj5yY27JGz41MJ0; Thu, 23 Mar 2023 13:38: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 4Pj5yY1bcxz4Sph; Thu, 23 Mar 2023 13:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679578709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NINlpA9a7obZHPZIirccWXWkmflr7USUZ5dlXbV6f4s=; b=Z0CZMm5Z0TR/J+pB/RdpbBE9FCHXL8vV675pErNp4Xt0nNPdl75E41za9AZxdgjNvwcGyV Beb2dzjdahLFeUlZRUWbX67jCxlzY7vE4+7D84v9nnnUwT22dL4oitWiHVwob55mGH0jMc t35eIFB+SS75QKL0c4lQCVFdMjM7c3omxbFF/OkFUG4G5nXx4yLwE4qQgWHFE1ydaMn5K5 WjKD1Ywp8DCmaoIHSISbJCXmFpEnz2U5P22U2yZW8iBXRKfYd5bfKnqLiG3F9ZfLDQvQpI p++ZkglOWqqWX2slwQmBbTGYv53okgGze7ly0D0r9TB0A9yhUje4HWZljG0Oxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679578709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NINlpA9a7obZHPZIirccWXWkmflr7USUZ5dlXbV6f4s=; b=StUGXsgQfmdMj1EtGE39hl/ZyHY7ze0ZqQstuKanL3H+jIBo+RNvLiezlltGdJhLM876dM V2cEDzY6tfHGvqjksH5OFonhBgr6BxGTVDzzvpg/dxhWqysJD/Hu3umjsqVH0tNMMdXWFS K8Z8XybswdGRRHEDTdevSBZDKaBpZc0vFNMGbe0jQVz5lK3Ug/FQkyq70T2M/ez05U3/E+ U8wrhwxZyqcgCHSyTtKFKLSwl+BZazcA7oEIUG79Bc+o/vKMiqI2YwTlzIEyoCm1xcvrLi JoSlFzDCtRE4ViBgMruH/2r5gjr5pTMr2pIRcEyxJb634UD5dK1duHSS0V7jOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679578709; a=rsa-sha256; cv=none; b=LGM4Ik7/r9gidpkAyOER64rwxQijr/m5wKtDYxHBhV8OAMARc1+Z/3uJwCvArKsXl2TM9L U9qDnGn2fcmW4PD5th5e6tcfC4pGLP7LyWNqw2P/ytW7O1hkAtHbhxN6kPthk8A4R2sN1R 6itk3jCqt1dqlsgxEpWwX3p/DyaOIqkAGuEfJcSMb1oZOCzdiz7SGY9i2XapR05uQNQitp k1SyCL5ddRsTUN9UFh8wLMc0Wg+b4yxFo7lxOdzwsrty1MlU3oC70D8rjTzu/oEGRi1DtF nrZiZljqedNYpmQq1X9QfhOcMuNOU9Rk7ua2v4+FrG0gJtKyM3ouUqBw6UpTJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pj5yY0L9KzdSq; Thu, 23 Mar 2023 13:38: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 32NDcSpM096726; Thu, 23 Mar 2023 13:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NDcSeb096725; Thu, 23 Mar 2023 13:38:28 GMT (envelope-from git) Date: Thu, 23 Mar 2023 13:38:28 GMT Message-Id: <202303231338.32NDcSeb096725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: e2427c6917dd - main - IfAPI: Add iterator to complement if_foreach() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2427c6917dd66265f1e02aef536f668df19a814 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=e2427c6917dd66265f1e02aef536f668df19a814 commit e2427c6917dd66265f1e02aef536f668df19a814 Author: Justin Hibbits AuthorDate: 2023-03-16 20:24:56 +0000 Commit: Justin Hibbits CommitDate: 2023-03-23 13:39:26 +0000 IfAPI: Add iterator to complement if_foreach() Summary: Sometimes an if_foreach() callback can be trivial, or need a lot of outer context. In this case a regular `for` loop makes more sense. To keep things hidden in the new API, use an opaque `if_iter` structure that can still be instantiated on the stack. The current implementation uses just a single pointer out of the 4 alotted to the opaque context, and the cleanup does nothing, but may be used in the future. Reviewed by: melifaro Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39138 --- sys/net/if.c | 36 ++++++++++++++++++++++++++++++++++++ sys/net/if_var.h | 9 +++++++++ 2 files changed, 45 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index f3ef822178ff..ff942bceb090 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4600,6 +4600,42 @@ if_foreach_sleep(if_foreach_match_t match_cb, void *match_arg, if_foreach_cb_t c return (error); } + +/* + * Uses just 1 pointer of the 4 available in the public struct. + */ +if_t +if_iter_start(struct if_iter *iter) +{ + if_t ifp; + + NET_EPOCH_ASSERT(); + + bzero(iter, sizeof(*iter)); + ifp = CK_STAILQ_FIRST(&V_ifnet); + if (ifp != NULL) + iter->context[0] = CK_STAILQ_NEXT(ifp, if_link); + else + iter->context[0] = NULL; + return (ifp); +} + +if_t +if_iter_next(struct if_iter *iter) +{ + if_t cur_ifp = iter->context[0]; + + if (cur_ifp != NULL) + iter->context[0] = CK_STAILQ_NEXT(cur_ifp, if_link); + return (cur_ifp); +} + +void +if_iter_finish(struct if_iter *iter) +{ + /* Nothing to do here for now. */ +} + u_int if_foreach_lladdr(if_t ifp, iflladdr_cb_t cb, void *cb_arg) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 3e4d6c883c13..5f11998ecab8 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -684,6 +684,15 @@ typedef bool (*if_foreach_match_t)(if_t, void *); int if_foreach(if_foreach_cb_t, void *); int if_foreach_sleep(if_foreach_match_t, void *, if_foreach_cb_t, void *); +/* Opaque iterator structure for iterating over interfaces. */ +struct if_iter { + void *context[4]; +}; + +if_t if_iter_start(struct if_iter *); +if_t if_iter_next(struct if_iter *); +void if_iter_finish(struct if_iter *); + /* Functions */ void if_setinitfn(if_t ifp, if_init_fn_t); void if_setinputfn(if_t ifp, if_input_fn_t); From nobody Thu Mar 23 16:05:20 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj9D42Vbhz41Vtx; Thu, 23 Mar 2023 16:05:24 +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 4Pj9D3534bz3DLx; Thu, 23 Mar 2023 16:05:23 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 3.97.99.33) smtp.mailfrom=cy.schubert@cschubert.com; dmarc=none Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id fLR5pdX2xjvm1fNRKp7x16; Thu, 23 Mar 2023 16:05:22 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id fNRIpAhr6HFsOfNRJpkJne; Thu, 23 Mar 2023 16:05:22 +0000 X-Authority-Analysis: v=2.4 cv=XZqaca15 c=1 sm=1 tr=0 ts=641c78c2 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=k__wU0fu6RkA:10 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=e3K2cC5ZDbAh1FsnALUA: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 ESMTP id 753541FBD; Thu, 23 Mar 2023 09:05:20 -0700 (PDT) Received: from slippy (localhost [IPv6:::1]) by slippy.cwsent.com (Postfix) with ESMTP id 4A5776E6; Thu, 23 Mar 2023 09:05:20 -0700 (PDT) Date: Thu, 23 Mar 2023 09:05:20 -0700 From: Cy Schubert To: Mark Johnston , Jose Luis Duran Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 20b41303140e - main - ping: Print the IP options of the original packet Message-ID: <20230323090520.30554030@slippy> In-Reply-To: <202303191633.32JGXPov003163@gitrepo.freebsd.org> References: <202303191633.32JGXPov003163@gitrepo.freebsd.org> Organization: KOMQUATS X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfNh/jk9xs44GRkE/x+LCBJMhMLRoyXul+lCcsuxGO2J3WX0Gb2qsJyXcmv8wvsI30q5bxOuhCHOEunvBuC1uBmKtfX3XMJ1/mdz2c2VvMyh/6BJzGP4o gn86EM80zvfmALPr/KlTPmjsAlQeUrNrUsVjeYioIQpF7gH0oxReETXUZJby6lKO6ieS/+5OWLTOUZC09ODBlz5iLC3B3aJNrkvOdWa3MmOJGwFD/Xv66oFd M5wokTfAoCjWjGSxqVBOkL4VcLAEDPXKK457E7KwevRE7DTAR95ZViNbpi0HSC3yot36DjPdUH/TjRmIttdH6J9WH5Z9iQ020z4jDpsywfmN5Qtu7ggmVD/z /2aq1aAm X-Spamd-Result: default: False [-1.80 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_IN_DNSWL_MED(-0.20)[3.97.99.33:from]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[FreeBSD.org,gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; RCVD_COUNT_FIVE(0.00)[5]; ARC_NA(0.00)[]; HAS_ORG_HEADER(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; TO_DN_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Queue-Id: 4Pj9D3534bz3DLx X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N On Sun, 19 Mar 2023 16:33:25 GMT Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=20b41303140eee4dfb896558fb83600c5f013d39 > > commit 20b41303140eee4dfb896558fb83600c5f013d39 > Author: Jose Luis Duran > AuthorDate: 2023-02-09 15:47:53 +0000 > Commit: Mark Johnston > CommitDate: 2023-03-19 16:23:06 +0000 > > ping: Print the IP options of the original packet > > When an ICMP packet contains an IP packet in its payload, and that > original IP packet contains options, these options were not displayed > accordingly in pr_iph(). > > pr_iph() is a function that prints the original "quoted packet" IP > header, with only an IP struct as an argument. The IP struct does not > contain IP options, and it is not guaranteed that the options will be > contiguous in memory to the IP struct after > d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52. > > Pass the raw ICMP data along with the IP struct, in order to print the > options, if any. > > Reviewed by: markj > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D38469 > --- > sbin/ping/ping.c | 19 ++++++++++--------- > sbin/ping/tests/ping_test.sh | 2 +- > sbin/ping/tests/test_ping.py | 1 - > 3 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c > index fe319bfb70a5..b1721ad72a5c 100644 > --- a/sbin/ping/ping.c > +++ b/sbin/ping/ping.c > @@ -225,7 +225,7 @@ static void pinger(void); > static char *pr_addr(struct in_addr); > static char *pr_ntime(n_time); > static void pr_icmph(struct icmp *, struct ip *, const u_char *const); > -static void pr_iph(struct ip *); > +static void pr_iph(struct ip *, const u_char *); > static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *); > static void pr_retip(struct ip *, const u_char *); > static void status(int); > @@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) > struct ip oip; > u_char oip_header_len; > struct icmp oicmp; > - const u_char *oicmp_raw; > > /* > * Get size of IP header of the received packet. > @@ -1355,8 +1354,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) > } > > memcpy(&oip, icmp_data_raw, sizeof(struct ip)); > - oicmp_raw = icmp_data_raw + oip_header_len; > - memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); Coverity is complaining about uninitialized oicmp due to the deletion of the above two lines. > > if (((options & F_VERBOSE) && uid == 0) || > (!(options & F_QUIET2) && > @@ -1366,7 +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) > (oicmp.icmp_id == ident))) { > (void)printf("%zd bytes from %s: ", cc, > pr_addr(from->sin_addr)); > - pr_icmph(&icp, &oip, oicmp_raw); > + pr_icmph(&icp, &oip, icmp_data_raw); > } else > return; > } > @@ -1663,14 +1660,13 @@ pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) > * Print an IP header with options. > */ > static void > -pr_iph(struct ip *ip) > +pr_iph(struct ip *ip, const u_char *cp) > { > struct in_addr ina; > - u_char *cp; > int hlen; > > hlen = ip->ip_hl << 2; > - cp = (u_char *)ip + sizeof(struct ip); /* point to options */ > + cp = cp + sizeof(struct ip); /* point to options */ > > (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst\n"); > (void)printf(" %1x %1x %02x %04x %04x", > @@ -1723,7 +1719,12 @@ pr_addr(struct in_addr ina) > static void > pr_retip(struct ip *ip, const u_char *cp) > { > - pr_iph(ip); > + int8_t hlen; > + > + pr_iph(ip, cp); > + > + hlen = ip->ip_hl << 2; > + cp = cp + hlen; > > if (ip->ip_p == 6) > (void)printf("TCP: from port %u, to port %u (decimal)\n", > diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh > index 9f821ed96360..53383f2fb7bc 100644 > --- a/sbin/ping/tests/ping_test.sh > +++ b/sbin/ping/tests/ping_test.sh > @@ -178,7 +178,7 @@ inject_pip_head() > } > inject_pip_body() > { > - atf_check -s exit:2 -o match:"Destination Host Unreachable" -o not-match:"01010101" python3 $(atf_get_srcdir)/injection.py pip > + atf_check -s exit:2 -o match:"Destination Host Unreachable" -o match:"(01){40}" python3 $(atf_get_srcdir)/injection.py pip > } > inject_pip_cleanup() > { > diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py > index a9b760ff7aca..79fd332f1c18 100644 > --- a/sbin/ping/tests/test_ping.py > +++ b/sbin/ping/tests/test_ping.py > @@ -893,7 +893,6 @@ Vr HL TOS Len ID Flg off TTL Pro cks Src Dst > "stderr": "", > "redacted": False, > }, > - marks=pytest.mark.skip("XXX currently failing"), > id="_3_1_opts_NOP_40", > ), > pytest.param( > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0 From nobody Thu Mar 23 16:32:10 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pj9py6M8hz41XKp; Thu, 23 Mar 2023 16:32: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 4Pj9py5fMXz3Gct; Thu, 23 Mar 2023 16:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679589130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VAc1z8kfUUfdmHXKW6stwZr+vELh2KnPRKYQKGstsD4=; b=PvfTvo3ZG6PyaSm3zrB1mqK/HbSbL57ur7DYAUcU2Nrg0SKsc+6BOzFp4KWr3sLb/Gtjk2 kZeoUcTzsgijXAWubpmX8SzB9VEHyja0CmFbYy5TK0MSOGX4D5zgkcl+oMsmR4nD9O+XXr g54SUmiZ0Xl7IV0HCZO5u/euwnWKI7/bGKGZ+9iCIkkQI/ds8KbuffXrJhvH7YvYRduxl0 DD5T6g2SixhHGRbMcv+FVrdQqW8JBgzuR1KvKJD21RQ/fLCKKVtIOQdgr9oGTp7StZsuMa ur2jk7cwqFYB+dgmP1BK0hj/uSaA9lmabNQFFg6pyjba46SVaaNUbuaJ4AeZxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679589130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VAc1z8kfUUfdmHXKW6stwZr+vELh2KnPRKYQKGstsD4=; b=Mf5BWpNrDSY0lP8PzSY1Ef2c26DYicRcmAGa8e5CJkxYZXJBlpH9DhbnCkXqvUECCFXoTa Al7cWxI7BjW3yVg12BRVctKoWvl81ftGG6aoEIkJQrIKUosGIfi/t1EuCt7lWgXsH2hNWl ECzPtS6hCDaqWY5mt4g9vRewlKHKcF9K8rMQ+4g9XGaOQPJUJpuMLUkRWVz33vjlr3vYb5 u/k9bsSphfR8UjecUtVmPNO+qtvrI9ue37M3ZXolUFtz7lVLhEEPt1GHWN2ztfQBZcdjWt yHf/Qz/u3vASK12qj3zV7ht/Lakc0xJvVfTiuqEjZGgG5OgvUUvyv3Fa7/tAow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679589130; a=rsa-sha256; cv=none; b=cyvb6yPzrGpWUTA4xXobPpverKrgsWG2iB8JnJv6khjY2pCPI2IsQZTeJTLFVQ86U4D1Aw g3fgvNLwzCbWk9wnhDGHE+1CxIxXNNt65QxuhwoPsaSWiN7sBJjHcuJW6Y5udIXlUQGAxG NHlga1ImwyqQde54fe54obhGO53Q2az5jiAwbOa4JSy0JqkmZ9LNaZBh8SqKtqCccvnf59 GwEsg3VCRGi61M8LJfBPaBN5tEQ7ctFb8BI8M9qMjcokrEX7t93sbPYT2hV9V0kK7oCkkf VF3bj+3LWwODjR8+tEkUHRlmevcEzIK4tF5sV0BRquWTadq0GxYxBCmvhA+8WQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pj9py4k2Tzjfl; Thu, 23 Mar 2023 16:32: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 32NGWAUb091790; Thu, 23 Mar 2023 16:32:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NGWAWj091789; Thu, 23 Mar 2023 16:32:10 GMT (envelope-from git) Date: Thu, 23 Mar 2023 16:32:10 GMT Message-Id: <202303231632.32NGWAWj091789@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: c6b3f47fedd3 - main - libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6b3f47fedd3f94f74cc4f7c40761b1d0e777f17 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6b3f47fedd3f94f74cc4f7c40761b1d0e777f17 commit c6b3f47fedd3f94f74cc4f7c40761b1d0e777f17 Author: John Baldwin AuthorDate: 2023-03-23 16:31:29 +0000 Commit: John Baldwin CommitDate: 2023-03-23 16:31:58 +0000 libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library. This uses the C++ compiler as the linker instead of the C compiler letting the compiler driver pick the right libraries. This is a no-op on main and stable/13 but matters for stable/12 where the current logic breaks for external GCC since it tries to use a non-existent libstdc++. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39197 --- lib/libpmc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 81e43b696841..01cb562c3fcd 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ -LIB= pmc +LIB_CXX= pmc SRCS= libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc INCS= pmc.h pmclog.h pmcformat.h CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat -LDADD+= -lc++ .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" From nobody Thu Mar 23 16:48:52 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjBBW5WR6z41YTd; Thu, 23 Mar 2023 16:49:07 +0000 (UTC) (envelope-from jlduran@gmail.com) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (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 4PjBBW3CGjz3KX9; Thu, 23 Mar 2023 16:49:07 +0000 (UTC) (envelope-from jlduran@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ot1-x32f.google.com with SMTP id d24-20020a9d72d8000000b0069fb53b68a3so592009otk.11; Thu, 23 Mar 2023 09:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679590146; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BgljrIfYLRoA6+aOrMT0mdWNN//1sJ9n0f/aEpSMPRM=; b=DIyws6+s2r4zwvYrN314sKcswjT1S1JHnZhIhZJhoaLcIMLD8wakMQhsG37wOR3fqN EWUfljOlXVUYIOWdDKLnQd9azG9cz6SavBjVX9MlD7DYExJmn0h//9Q8KwtXsLHgWeo4 gneQkt1NUNzhnw8IMu7TY3frYvH4JdcRtQajXhr57a1xO5QflfVMIYjg/lXJk9El0Awb vUpLnVs/HkuhF9PSSUcXtH6K4waqatJ7Ec0LcIYbrO43YB1vzzGvKaz0DEjnqOzA5gGL PRhtk4EPUaRHJ/7ntrkzSI7WmAb0LZzogQxMa+6abK8J9rTc6vH1LK9idozVBIillaZi RMrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679590146; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BgljrIfYLRoA6+aOrMT0mdWNN//1sJ9n0f/aEpSMPRM=; b=gKTM+yaObegAGifjI6l+nl/87HpB6dvtWr4deEeTH73WWo6yWp0tZAfDM5ThAVy3v2 nOQgCSZ1RezHEnDSmn3DoGzzfLZ5I2cEHoHXzJr1IBbNVub2Bo81SdP3yAbLhcWeigs3 7WX1PMeIzn8ofY3Nvbb5bIomBRDf86J1eGlehIrST5eC5kIJU8ZNuZ8tpgTRk3SBd7gf m74iyIckXctbotCSxSc38Em5cbO4Ob6qo+IHnOBWKXkkmZsEJGXVihsQMjvaVxb2+3SB bHTGKgLUqpg4d2tIbKw3j/kwEa0R3C9m+WR9+8zSv3LbuWyOH3FwQX6Zm+Ow+JDxfz2M AVZA== X-Gm-Message-State: AO0yUKVcWKJBhu0YyjC2HSSorsOr8n+Y0Lt57YMMLb7Cp6E/1vmFoHUF Zbf0ZZUMFdm1opmTQO9VeFpHqgfAx8c= X-Google-Smtp-Source: AK7set82WY3XiIIXNt+XVQqHACCg5HUAqO8rZRDwgXv7VYQoSb++i3Q6xJqvaARQMyGmepeHU6cMVw== X-Received: by 2002:a9d:63c8:0:b0:69f:793a:57a4 with SMTP id e8-20020a9d63c8000000b0069f793a57a4mr102725otl.2.1679590145821; Thu, 23 Mar 2023 09:49:05 -0700 (PDT) Received: from smtpclient.apple (mlsrj200152099p037.mls.com.br. [200.152.99.37]) by smtp.gmail.com with ESMTPSA id f15-20020a9d5f0f000000b0068bd6cf405dsm5447929oti.1.2023.03.23.09.49.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2023 09:49:05 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: git: 20b41303140e - main - ping: Print the IP options of the original packet From: =?utf-8?B?Sm9zw6kgTHVpcyBEdXLDoW4=?= In-Reply-To: <20230323090520.30554030@slippy> Date: Thu, 23 Mar 2023 13:48:52 -0300 Cc: Mark Johnston , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <6AEF84FA-8055-4AD1-83F1-D89386C33092@gmail.com> References: <202303191633.32JGXPov003163@gitrepo.freebsd.org> <20230323090520.30554030@slippy> To: Cy Schubert X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Rspamd-Queue-Id: 4PjBBW3CGjz3KX9 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N > On Mar 23, 2023, at 1:05 PM, Cy Schubert = wrote: >=20 > On Sun, 19 Mar 2023 16:33:25 GMT > Mark Johnston wrote: >=20 >> The branch main has been updated by markj: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D20b41303140eee4dfb896558fb83600c= 5f013d39 >>=20 >> commit 20b41303140eee4dfb896558fb83600c5f013d39 >> Author: Jose Luis Duran >> AuthorDate: 2023-02-09 15:47:53 +0000 >> Commit: Mark Johnston >> CommitDate: 2023-03-19 16:23:06 +0000 >>=20 >> ping: Print the IP options of the original packet >>=20 >> When an ICMP packet contains an IP packet in its payload, and that >> original IP packet contains options, these options were not = displayed >> accordingly in pr_iph(). >>=20 >> pr_iph() is a function that prints the original "quoted packet" IP >> header, with only an IP struct as an argument. The IP struct does = not >> contain IP options, and it is not guaranteed that the options will = be >> contiguous in memory to the IP struct after >> d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52. >>=20 >> Pass the raw ICMP data along with the IP struct, in order to print = the >> options, if any. >>=20 >> Reviewed by: markj >> MFC after: 1 week >> Differential Revision: https://reviews.freebsd.org/D38469 >> --- >> sbin/ping/ping.c | 19 ++++++++++--------- >> sbin/ping/tests/ping_test.sh | 2 +- >> sbin/ping/tests/test_ping.py | 1 - >> 3 files changed, 11 insertions(+), 11 deletions(-) >>=20 >> diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c >> index fe319bfb70a5..b1721ad72a5c 100644 >> --- a/sbin/ping/ping.c >> +++ b/sbin/ping/ping.c >> @@ -225,7 +225,7 @@ static void pinger(void); >> static char *pr_addr(struct in_addr); >> static char *pr_ntime(n_time); >> static void pr_icmph(struct icmp *, struct ip *, const u_char = *const); >> -static void pr_iph(struct ip *); >> +static void pr_iph(struct ip *, const u_char *); >> static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct = timespec *); >> static void pr_retip(struct ip *, const u_char *); >> static void status(int); >> @@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> struct ip oip; >> u_char oip_header_len; >> struct icmp oicmp; >> - const u_char *oicmp_raw; >>=20 >> /* >> * Get size of IP header of the received packet. >> @@ -1355,8 +1354,6 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> } >>=20 >> memcpy(&oip, icmp_data_raw, sizeof(struct ip)); >> - oicmp_raw =3D icmp_data_raw + oip_header_len; >> - memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); >=20 > Coverity is complaining about uninitialized oicmp due to the deletion > of the above two lines. Right. That is strange it happened, but I=E2=80=99ll submit a fix. Thank = you! >=20 >>=20 >> if (((options & F_VERBOSE) && uid =3D=3D 0) || >> (!(options & F_QUIET2) && >> @@ -1366,7 +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> (oicmp.icmp_id =3D=3D ident))) { >> (void)printf("%zd bytes from %s: ", cc, >> pr_addr(from->sin_addr)); >> - pr_icmph(&icp, &oip, oicmp_raw); >> + pr_icmph(&icp, &oip, icmp_data_raw); >> } else >> return; >> } >> @@ -1663,14 +1660,13 @@ pr_icmph(struct icmp *icp, struct ip *oip, = const u_char *const oicmp_raw) >> * Print an IP header with options. >> */ >> static void >> -pr_iph(struct ip *ip) >> +pr_iph(struct ip *ip, const u_char *cp) >> { >> struct in_addr ina; >> - u_char *cp; >> int hlen; >>=20 >> hlen =3D ip->ip_hl << 2; >> - cp =3D (u_char *)ip + sizeof(struct ip); /* point = to options */ >> + cp =3D cp + sizeof(struct ip); /* point to options */ >>=20 >> (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src = Dst\n"); >> (void)printf(" %1x %1x %02x %04x %04x", >> @@ -1723,7 +1719,12 @@ pr_addr(struct in_addr ina) >> static void >> pr_retip(struct ip *ip, const u_char *cp) >> { >> - pr_iph(ip); >> + int8_t hlen; >> + >> + pr_iph(ip, cp); >> + >> + hlen =3D ip->ip_hl << 2; >> + cp =3D cp + hlen; >>=20 >> if (ip->ip_p =3D=3D 6) >> (void)printf("TCP: from port %u, to port %u = (decimal)\n", >> diff --git a/sbin/ping/tests/ping_test.sh = b/sbin/ping/tests/ping_test.sh >> index 9f821ed96360..53383f2fb7bc 100644 >> --- a/sbin/ping/tests/ping_test.sh >> +++ b/sbin/ping/tests/ping_test.sh >> @@ -178,7 +178,7 @@ inject_pip_head() >> } >> inject_pip_body() >> { >> - atf_check -s exit:2 -o match:"Destination Host Unreachable" -o = not-match:"01010101" python3 $(atf_get_srcdir)/injection.py pip >> + atf_check -s exit:2 -o match:"Destination Host Unreachable" -o = match:"(01){40}" python3 $(atf_get_srcdir)/injection.py pip >> } >> inject_pip_cleanup() >> { >> diff --git a/sbin/ping/tests/test_ping.py = b/sbin/ping/tests/test_ping.py >> index a9b760ff7aca..79fd332f1c18 100644 >> --- a/sbin/ping/tests/test_ping.py >> +++ b/sbin/ping/tests/test_ping.py >> @@ -893,7 +893,6 @@ Vr HL TOS Len ID Flg off TTL Pro cks = Src Dst >> "stderr": "", >> "redacted": False, >> }, >> - marks=3Dpytest.mark.skip("XXX currently failing"), >> id=3D"_3_1_opts_NOP_40", >> ), >> pytest.param( >>=20 >=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org >=20 > e^(i*pi)+1=3D0 From nobody Thu Mar 23 19:02:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8k42SZz41ghq; Thu, 23 Mar 2023 19:02: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 4PjF8k2K2Lz3pHW; Thu, 23 Mar 2023 19:02:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=513TyRWQYImajvk42MOr4/cLj359xjs8L41AEoneFAw=; b=BzrwZifZm75cG4tqmrOLywjLule6yOu/A6z0Kw/YdQCmoyKZpo0WeWEl8bai2djRqyvxoG ktnRV1ZE/dwHvibW7xF7ofKekeonBZ5MeyhgqL3lLPz0H6r4w29A3wrWN31euD+/17tQ7f 3hV4lMDFHoaitlh0lA+SD6XsxVpIAGUc45jqeZqIFHo2y2OJ9Q/+edQ0Ay0/ndFI6CzWdO s5sxxCBVLJQYIjWDrjEdfCbc3BMroiYlvd7wOBbhtwg9+Irp3zXqHPiJHLW/ttNj806b94 m8w/IGJyLvYsvqh/VIE+LJMpgDWdRwBAPI6+I0+EkzkMiv1wVZCMFx7qeCFLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=513TyRWQYImajvk42MOr4/cLj359xjs8L41AEoneFAw=; b=oauM+pFpAT6spD3SK5HAp4rO9VltrF5Vq6Vtmlbp1ajgSjp4+V31mle7Ny7O5Uc0lodZBI 5u1TY5th7OI0ypCd7U8GGYLVpifrXmbwd1cHYC8OH3lULVhb3Kt9YmK+qfJ70gjVE9i0QH 4g3Yss+xPIN1t+C/H0mPk1ErUrXcvm1K4G7zczQSagqfq0JSt8WlqGobu7udyhZ2I+SwC5 vD9mdLMCSKwpJEoPqx5Lwv04jpWcyaKa7fSDhuptTaxPNJMNTdk/lYL6TN3MDOgMtxION4 u0PakdSOydGHDn6/sbKqme9Jp6rfAZhQB6fbQPVq2ivTachiJqgh6dZ+0XD+lQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598166; a=rsa-sha256; cv=none; b=HkOn0G1O0/pElRWhCf8fC6Dhx+JY3ELoujrfri9Wb3tNpAf+TdJEmDUkLcvy/36NXqBjEE LcLXkkq9xazfWV7Muhx4LK3DGhbtopwM+iUqO4J645Byqau/CgQgm+BDZMC1zjqtvDgU4e j/yX/31BCKekcnvNq10i2DZFL29SY14nwH51obK0oTxERskSUQh60rm/qHbHZp9wwQ/VRk WaRLtq8+p61jzdCg7WeLwfxW5XLIcUkA0u4XIpEgp3AY75dFzKe+L5Zf05fNCwihyyIjNy y+oTxqrEMmtIFT1qbuxPGw6TAv9EXQi9vqowzOxvgjoHn3rQflahXTNsulUpeA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8k1Pyyzn4Q; Thu, 23 Mar 2023 19:02: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 32NJ2keN039309; Thu, 23 Mar 2023 19:02:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2ktY039308; Thu, 23 Mar 2023 19:02:46 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:46 GMT Message-Id: <202303231902.32NJ2ktY039308@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: 2ecbbcc7cabd - main - arm64: extend ESR/SPSR registers to 64b List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 2ecbbcc7cabdc0147e54ffa90c90efcc33afadd8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2ecbbcc7cabdc0147e54ffa90c90efcc33afadd8 commit 2ecbbcc7cabdc0147e54ffa90c90efcc33afadd8 Author: Zachary Leaf AuthorDate: 2023-02-24 08:35:08 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 arm64: extend ESR/SPSR registers to 64b For the Exception Syndrome Register, ESR_ELx, the upper 32b were previously unused, but now may contain additional exception info as of Armv8.7 (FEAT_LS64). Extend ESR from u32->u64 in exception handling code to support this. In addition, also extend Saved Program Status Register SPSR_ELx in the same way to allow for future extensions. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D38983 --- sys/arm64/arm64/db_trace.c | 6 +++--- sys/arm64/arm64/exception.S | 2 +- sys/arm64/arm64/exec_machdep.c | 2 +- sys/arm64/arm64/trap.c | 18 +++++++++--------- sys/arm64/include/frame.h | 5 +++-- sys/arm64/include/reg.h | 2 +- sys/arm64/include/ucontext.h | 3 +-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 2b47ae2a89c7..6abdd6c5ca7a 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -102,18 +102,18 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) switch (frame_type) { case FRAME_SYNC: - db_printf("--- exception, esr %#x\n", + db_printf("--- exception, esr %#lx\n", tf->tf_esr); break; case FRAME_IRQ: db_printf("--- interrupt\n"); break; case FRAME_SERROR: - db_printf("--- system error, esr %#x\n", + db_printf("--- system error, esr %#lx\n", tf->tf_esr); break; case FRAME_UNHANDLED: - db_printf("--- unhandled exception, esr %#x\n", + db_printf("--- unhandled exception, esr %#lx\n", tf->tf_esr); break; default: diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index fd55e1f39b58..e23a7868b56f 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); mrs x12, esr_el1 stp x18, lr, [sp, #(TF_SP - TF_X)]! str x10, [sp, #(TF_ELR)] - stp w11, w12, [sp, #(TF_SPSR)] + stp x11, x12, [sp, #(TF_SPSR)] mrs x18, tpidr_el1 .endm diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c index 27ee2f80858d..7ead30a05663 100644 --- a/sys/arm64/arm64/exec_machdep.c +++ b/sys/arm64/arm64/exec_machdep.c @@ -457,7 +457,7 @@ int set_mcontext(struct thread *td, mcontext_t *mcp) { struct trapframe *tf = td->td_frame; - uint32_t spsr; + uint64_t spsr; spsr = mcp->mc_gpregs.gp_spsr; if ((spsr & PSR_M_MASK) != PSR_M_EL0t || diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 1b33d7aa60c4..50f6e9de874b 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -212,7 +212,7 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr, if (!lower) { print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("Misaligned access from kernel space!"); } @@ -329,7 +329,7 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, WARN_GIANTOK, NULL, "Kernel page fault") != 0) { print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("data abort in critical section or under mutex"); } @@ -370,7 +370,7 @@ bad_far: printf("Fatal data abort:\n"); print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); #ifdef KDB if (debugger_on_trap) { @@ -429,7 +429,7 @@ print_registers(struct trapframe *frame) printf(" sp: %16lx\n", frame->tf_sp); print_gp_register(" lr", frame->tf_lr); print_gp_register("elr", frame->tf_elr); - printf("spsr: %8x\n", frame->tf_spsr); + printf("spsr: %16lx\n", frame->tf_spsr); } #ifdef VFP @@ -496,7 +496,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #endif { print_registers(frame); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("VFP exception in the kernel"); } break; @@ -510,7 +510,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) } else { print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("Unhandled EL1 %s abort: %x", exception == EXCP_INSN_ABORT ? "instruction" : "data", dfsc); @@ -624,7 +624,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame, uint64_t far) else { print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("Unhandled EL0 %s abort: %x", exception == EXCP_INSN_ABORT_L ? "instruction" : "data", dfsc); @@ -716,7 +716,7 @@ do_serror(struct trapframe *frame) print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("Unhandled System Error"); } @@ -730,6 +730,6 @@ unhandled_exception(struct trapframe *frame) print_registers(frame); print_gp_register("far", far); - printf(" esr: %.8lx\n", esr); + printf(" esr: %.16lx\n", esr); panic("Unhandled exception"); } diff --git a/sys/arm64/include/frame.h b/sys/arm64/include/frame.h index 0a8b53ebb01e..91ed6dbce920 100644 --- a/sys/arm64/include/frame.h +++ b/sys/arm64/include/frame.h @@ -45,8 +45,9 @@ struct trapframe { uint64_t tf_sp; uint64_t tf_lr; uint64_t tf_elr; - uint32_t tf_spsr; - uint32_t tf_esr; + uint64_t tf_spsr; + uint64_t tf_esr; + uint64_t pad; /* struct must be 16B aligned */ uint64_t tf_x[30]; }; diff --git a/sys/arm64/include/reg.h b/sys/arm64/include/reg.h index 44b2e2b21b72..4e8ca4f4e834 100644 --- a/sys/arm64/include/reg.h +++ b/sys/arm64/include/reg.h @@ -40,7 +40,7 @@ struct reg { __uint64_t lr; __uint64_t sp; __uint64_t elr; - __uint32_t spsr; + __uint64_t spsr; }; struct reg32 { diff --git a/sys/arm64/include/ucontext.h b/sys/arm64/include/ucontext.h index a81fdf9ad724..edb4cf8e63e3 100644 --- a/sys/arm64/include/ucontext.h +++ b/sys/arm64/include/ucontext.h @@ -38,8 +38,7 @@ struct gpregs { __register_t gp_lr; __register_t gp_sp; __register_t gp_elr; - __uint32_t gp_spsr; - int gp_pad; + __uint64_t gp_spsr; }; struct fpregs { From nobody Thu Mar 23 19:02:47 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8l4fPtz41h6f; Thu, 23 Mar 2023 19:02: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 4PjF8l3K7xz3pKk; Thu, 23 Mar 2023 19:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6mQIdqrm8xpdUM9jmazHVHUGv18hOH1QolSOuwn86us=; b=DhKWdw/flyM9xy9TlpnOqbiex9VT5uFGz0otA5Zau3BxOxSK/dAI6E8IbOCflf2yZ00RVU N0ggxKsn1meRfAYJVqitqOnqIKRjx6z1cqCzkGL3h8qDMoUBZMIcqMPoYHiYF9JowriSBT jQXQcGu5IpeaSqZojrO7M0YRZnvmYfzLLBNIIs4ZCJKnszZb4N8NVUMGq0wyrMheupGqbN uS7CvTZsB3J5vbLal/rwQuk/+bx6ef6JVyk/y8cO7mhwdVNvxZcU6TzlG6dLKhxzKe2R0R GXvB4O50NzeJeu7U9vzFaQaMJQ3EXo8YApuHxaMKokJ+sESlGvj0QvtrX/JWLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6mQIdqrm8xpdUM9jmazHVHUGv18hOH1QolSOuwn86us=; b=extOb+IMRqRQ1ZxZqZzo8G2PsmZDjokXlD+ic04VLsig4uTDWOQ9G5aZTIK7gBp4eTyGpS RHY4itkehR9/PPgj8LMmAWgBqqRz5DiK7+4PMjKuCThrtyVmIYFRDy3mGmJHsMcb2pQqOY 1oXUfplXo7OWCx81AIPkbQ+6HoZlLjG7wy0tCqW7p3ApiMf8eJbV5GpEkqCUKZlTljae7Y N+ByKePF2v2mx2vPnrQfnP9BulStIOBDsUi97b2FQoPVmEwXDZ2vo+dNDEHGDK4wVrEitO IxL9sP1JTUpqFAA+ij2Z99xVZF6NezO1ndW7Ai3LCqHFKkfjmmtZvwownCyDBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598167; a=rsa-sha256; cv=none; b=jRYzDWdqWhgxyQ/KN+bPrVSRwhJetlHNmeA0yRdQqMr0zbIlSp34rxoYpbfjhLE1oLHyeQ SJoAX1iLSnJ5U9cLFADE9Xu6HnxxlX9+omw3/pSQpzL+iTPCj3KReQHC2bBLTb0eMuVhUw WzECUrHSDmm7oBbOlIJNTiAHtXM+Rncvc4uZYWRysUu9+6ooPtSds+SWGhedQycx3e0Df7 21FMLu/Y8dBulVdhIdnyLNQgxyndFkORqqRhaZs9JfjN8pEiHivMwsTxgzk9ST8tZfxVfM ZUF6u8gMeBHX988s/wezCGIPDOAj6L+vIiJQ1K+h0DItP5EqXRscF2qDiuEyRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8l2L1qzn4R; Thu, 23 Mar 2023 19:02: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 32NJ2l7G039328; Thu, 23 Mar 2023 19:02:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2l9Q039327; Thu, 23 Mar 2023 19:02:47 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:47 GMT Message-Id: <202303231902.32NJ2l9Q039327@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: f4036a92346e - main - arm64: add fault address to trapframe List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: f4036a92346e9f7c70a9db88352f172e198e3402 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f4036a92346e9f7c70a9db88352f172e198e3402 commit f4036a92346e9f7c70a9db88352f172e198e3402 Author: Zachary Leaf AuthorDate: 2023-03-02 14:15:54 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 arm64: add fault address to trapframe It was previously possible for the fault address register to get clobbered before it was saved. This small window occurred when an additional exception was encountered inside the exception handler, overwriting the previous value. Commit f29942229d24 ("Read the arm64 far early in el0 exceptions") patched this issue, but avoided changing the trapframe since this could be considered a KBI change in FreeBSD 13. Revert the above fix and save the fault address in the trapframe instead. This saves the fault address even earlier in the exception handling process, and is a more robust and simple fix. Reviewed by: andrew, jhb, jrtc27 Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D38984 --- sys/arm64/arm64/exception.S | 20 +++----------------- sys/arm64/arm64/genassym.c | 1 + sys/arm64/arm64/trap.c | 17 +++++++++-------- sys/arm64/include/frame.h | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index e23a7868b56f..c82b8307ab17 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -65,9 +65,10 @@ __FBSDID("$FreeBSD$"); mrs x10, elr_el1 mrs x11, spsr_el1 mrs x12, esr_el1 + mrs x13, far_el1 stp x18, lr, [sp, #(TF_SP - TF_X)]! - str x10, [sp, #(TF_ELR)] - stp x11, x12, [sp, #(TF_SPSR)] + stp x10, x11, [sp, #(TF_ELR)] + stp x12, x13, [sp, #(TF_ESR)] mrs x18, tpidr_el1 .endm @@ -211,25 +212,10 @@ ENTRY(handle_el1h_irq) END(handle_el1h_irq) ENTRY(handle_el0_sync) - /* - * Read the fault address early. The current thread structure may - * be transiently unmapped if it is part of a memory range being - * promoted or demoted to/from a superpage. As this involves a - * break-before-make sequence there is a short period of time where - * an access will raise an exception. If this happens the fault - * address will be changed to the kernel address so a later read of - * far_el1 will give the wrong value. - * - * The earliest memory access that could trigger a fault is in a - * function called by the save_registers macro so this is the latest - * we can read the userspace value. - */ - mrs x19, far_el1 save_registers 0 ldr x0, [x18, #PC_CURTHREAD] mov x1, sp str x1, [x0, #TD_FRAME] - mov x2, x19 bl do_el0_sync do_ast restore_registers 0 diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index 3d88835c0f8e..db07f1714f5a 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -77,4 +77,5 @@ ASSYM(TF_SIZE, sizeof(struct trapframe)); ASSYM(TF_SP, offsetof(struct trapframe, tf_sp)); ASSYM(TF_ELR, offsetof(struct trapframe, tf_elr)); ASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr)); +ASSYM(TF_ESR, offsetof(struct trapframe, tf_esr)); ASSYM(TF_X, offsetof(struct trapframe, tf_x)); diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 50f6e9de874b..1b7d945ff115 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); /* Called from exception.S */ void do_el1h_sync(struct thread *, struct trapframe *); -void do_el0_sync(struct thread *, struct trapframe *, uint64_t far); +void do_el0_sync(struct thread *, struct trapframe *); void do_el0_error(struct trapframe *); void do_serror(struct trapframe *); void unhandled_exception(struct trapframe *); @@ -465,6 +465,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) uint64_t esr, far; int dfsc; + far = frame->tf_far; /* Read the esr register to get the exception details */ esr = frame->tf_esr; exception = ESR_ELx_EXCEPTION(esr); @@ -502,7 +503,6 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) break; case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: - far = READ_SPECIALREG(far_el1); dfsc = esr & ISS_DATA_DFSC_MASK; if (dfsc < nitems(abort_handlers) && abort_handlers[dfsc] != NULL) { @@ -541,7 +541,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) case EXCP_FPAC: /* We can see this if the authentication on PAC fails */ print_registers(frame); - printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); + print_gp_register("far", far); panic("FPAC kernel exception"); break; case EXCP_UNKNOWN: @@ -552,18 +552,18 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) /* FALLTHROUGH */ default: print_registers(frame); - print_gp_register("far", READ_SPECIALREG(far_el1)); + print_gp_register("far", far); panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } } void -do_el0_sync(struct thread *td, struct trapframe *frame, uint64_t far) +do_el0_sync(struct thread *td, struct trapframe *frame) { pcpu_bp_harden bp_harden; uint32_t exception; - uint64_t esr; + uint64_t esr, far; int dfsc; /* Check we have a sane environment when entering from userland */ @@ -571,6 +571,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame, uint64_t far) ("Invalid pcpu address from userland: %p (tpidr %lx)", get_pcpu(), READ_SPECIALREG(tpidr_el1))); + far = frame->tf_far; esr = frame->tf_esr; exception = ESR_ELx_EXCEPTION(esr); if (exception == EXCP_INSN_ABORT_L && far > VM_MAXUSER_ADDRESS) { @@ -711,7 +712,7 @@ do_serror(struct trapframe *frame) { uint64_t esr, far; - far = READ_SPECIALREG(far_el1); + far = frame->tf_far; esr = frame->tf_esr; print_registers(frame); @@ -725,7 +726,7 @@ unhandled_exception(struct trapframe *frame) { uint64_t esr, far; - far = READ_SPECIALREG(far_el1); + far = frame->tf_far; esr = frame->tf_esr; print_registers(frame); diff --git a/sys/arm64/include/frame.h b/sys/arm64/include/frame.h index 91ed6dbce920..fc10f8574161 100644 --- a/sys/arm64/include/frame.h +++ b/sys/arm64/include/frame.h @@ -47,7 +47,7 @@ struct trapframe { uint64_t tf_elr; uint64_t tf_spsr; uint64_t tf_esr; - uint64_t pad; /* struct must be 16B aligned */ + uint64_t tf_far; uint64_t tf_x[30]; }; From nobody Thu Mar 23 19:02:48 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8m52xmz41gnc; Thu, 23 Mar 2023 19:02: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 4PjF8m4YHBz3pQh; Thu, 23 Mar 2023 19:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=COFY3xL4UpT2kPeafiTY0WxiT+9XDHkDZpMXnmASB/U=; b=eBlfkBE4PFTyH/BrnGRIwQfGm6i5wlNZ2DjlX7IForqihjh6Mrbu+aiPdDlsMs/5pQmy1j FZO4Ddjk4u83lwz0tK2Gd3EI6aOr8HHvFsiNsLMpgBcd8YreZ3uwuR3z2zp+vJQHnXH1yV tzoQ6CvxP2YHtHk17MezU7r1tUbd6pzARPVMZk6q58tPNjYYTLPFcIxxKGgBbb+IICARtH SejO4ufnIPrd7iaNrphBhzeHkXsL+nMNjKMjjWRejBHz9/MrpOLndBNtd8JzMGaQdljCa/ eug3JeJekZQkC1tEfsZCNiWtQIFFdsT/nqYcNMUol67DWruojLosbsKJ/2zEdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=COFY3xL4UpT2kPeafiTY0WxiT+9XDHkDZpMXnmASB/U=; b=NbATiRW9q0h3sQNf6xM1NSNnFME3tHAyvActd2fIqRlCwfYzCngLmw/a4UlhDKrxqfytGP LygRiPkbGId7AJASkj2PyU+FeSnooxQF9LFSX1HAQI4hlp1pnbV3mSkq38UuEdNL60Fmh8 wY5MCawMTuNj/RiVmqEqpvrirHX1f78xkODmT1sEgm85IHTEs4YvQ0yRgChaISRNP9UIpd kMleV1MpEVYU7ob8fmNNg2wkS13EyhJrOguZJ8mclp6cjRS1XB4IYjNqZI8+8cKRFKSpwQ 3TRQ3FPvwQVIsza0AWcLS8jSQxB6DKXBzccy82THi+OzcTyyPZTOXmBELAKTtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598168; a=rsa-sha256; cv=none; b=n4EYrPtOBj0tTiEGsfWZleD5X7s+nKY512koDW1/Rg7kGOqFxBYbp5hyKzfyQSyWyJSKjH B/dfslF25uZssHDKuzKiNZe3DJZp2dsEc0bD9xIEq6DktJyXhruUZmSygcZNw3wNxdtyx6 Mx79qFicvhiTY5657mx6RpbZLTgAVNDXiqYlV+030/yUmZimxiTG3yLQJLea/YGh5KgJNE kGxYpb97F69zmMfreprBg9PvyjR+SnOij/UFGwaFStbY+RCbjL6t17GdOZVS6JqR1Bvs9v Z/Yoe+iu3WQnG7v9SZaUxVzWYMZHMWL66iOiuO7zfBqcHBLObrDQnUzLOuSB5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8m3FytznXG; Thu, 23 Mar 2023 19:02: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 32NJ2mdf039347; Thu, 23 Mar 2023 19:02:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2mS3039346; Thu, 23 Mar 2023 19:02:48 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:48 GMT Message-Id: <202303231902.32NJ2mS3039346@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: 4a06b28a15ad - main - Add compat support for struct reg on arm64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 4a06b28a15ad2e33cc2b8c16ce2b946a517d758a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4a06b28a15ad2e33cc2b8c16ce2b946a517d758a commit 4a06b28a15ad2e33cc2b8c16ce2b946a517d758a Author: Andrew Turner AuthorDate: 2023-03-20 17:38:39 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 Add compat support for struct reg on arm64 The size of the spsr field in struct reg has changed. Mask the bits that userspace doesn't know about out as they may be invalid. While here add a comment why we don't need compat support in set_regs. Sponsored by: Arm Ltd --- sys/arm64/arm64/exec_machdep.c | 29 ++++++++++++++++++++++++++++- sys/sys/param.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c index 7ead30a05663..a51ff3aeca86 100644 --- a/sys/arm64/arm64/exec_machdep.c +++ b/sys/arm64/arm64/exec_machdep.c @@ -125,6 +125,13 @@ set_regs(struct thread *td, struct reg *regs) #endif { frame->tf_elr = regs->elr; + /* + * frame->tf_spsr and regs->spsr on FreeBSD 13 was 32-bit + * where from 14 they are 64 bit. As PSR_SETTABLE_64 clears + * the upper 32 bits no compatibility handling is needed, + * however if this is ever not the case we will need to add + * these, similar to how it is done in set_mcontext. + */ frame->tf_spsr &= ~PSR_SETTABLE_64; frame->tf_spsr |= regs->spsr & PSR_SETTABLE_64; /* Enable single stepping if userspace asked fot it */ @@ -456,10 +463,22 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) int set_mcontext(struct thread *td, mcontext_t *mcp) { +#define PSR_13_MASK 0xfffffffful struct trapframe *tf = td->td_frame; uint64_t spsr; spsr = mcp->mc_gpregs.gp_spsr; +#ifdef COMPAT_FREEBSD13 + if (td->td_proc->p_osrel < P_OSREL_ARM64_SPSR) { + /* + * Before FreeBSD 14 gp_spsr was 32 bit. The size of mc_gpregs + * was identical because of padding so mask of the upper bits + * that may be invalid on earlier releases. + */ + spsr &= PSR_13_MASK; + } +#endif + if ((spsr & PSR_M_MASK) != PSR_M_EL0t || (spsr & PSR_AARCH32) != 0 || (spsr & PSR_DAIF) != (td->td_frame->tf_spsr & PSR_DAIF)) @@ -470,7 +489,14 @@ set_mcontext(struct thread *td, mcontext_t *mcp) tf->tf_sp = mcp->mc_gpregs.gp_sp; tf->tf_lr = mcp->mc_gpregs.gp_lr; tf->tf_elr = mcp->mc_gpregs.gp_elr; - tf->tf_spsr = mcp->mc_gpregs.gp_spsr; +#ifdef COMPAT_FREEBSD13 + if (td->td_proc->p_osrel < P_OSREL_ARM64_SPSR) { + /* Keep the upper 32 bits of spsr on older releases */ + tf->tf_spsr &= ~PSR_13_MASK; + tf->tf_spsr |= spsr; + } else +#endif + tf->tf_spsr = spsr; if ((tf->tf_spsr & PSR_SS) != 0) { td->td_pcb->pcb_flags |= PCB_SINGLE_STEP; @@ -481,6 +507,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) set_fpcontext(td, mcp); return (0); +#undef PSR_13_MASK } static void diff --git a/sys/sys/param.h b/sys/sys/param.h index a613dbf7f2b1..d3bdca7c42e7 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -108,6 +108,7 @@ #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 #define P_OSREL_TIDPID 1400079 +#define P_OSREL_ARM64_SPSR 1400084 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif From nobody Thu Mar 23 19:02:49 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8n5zg0z41gnk; Thu, 23 Mar 2023 19:02: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 4PjF8n54wgz3pSf; Thu, 23 Mar 2023 19:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CsP9SqTRF70uuSYgvwofa9jHO9+qHitfKDiTPkD4sCk=; b=M7efwJTL4mUtw9Wps1BfU+hg5UIH6VrONYiFZQbIQ8G4ayuTJin2yKzOG67UjTrvVo047G rlqEXgEUNX/KsarcPPDSdzwcD8SjPSbx8wabGI9PalCzasJixfKXKQ2/f5ohU2tqqKpefM f8beS2Xx62Hr7ymiYY3Xh3Qhn7EsDYopRtDfOSOcT6gtkRB7E8X6CZVhogLNxW4HweEC76 oQQIEz3Hj66ohOqX/nvx72o8NaADlRszpdnUGpUAkJUMfCevbXwy7fLTJM/eoslTBNan7t ol+tGOXZ5lAVnJrZsMBT56/X5lDDzehKJWSPJO0BFBsEFYpuNYqOjGNytCyi2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CsP9SqTRF70uuSYgvwofa9jHO9+qHitfKDiTPkD4sCk=; b=oIoJeOxbvuJ1HKJhBWQyHwpjsf0vejXI32IpD3OVASKTfIo86RS24M6NhozR6WFB1c7Ayf KdNYbkx3nGDukAzOsXCSkpPrxt9JXNJh96AoThMQBLgv7hymyqqGPeFygGAf2jA+JktPWU pSB8puySeAYEJzXE2mhv7FFK32ZJ/CXs+REEc2IiAKc7aZIjOVjLsxOdpIJ1uGouwmpi4a xOJ0Lrh0wYmkTHayUrJC6IkEaf0yfkG1bVO882ulh1FVcDi95uLT3pb2+5p+UFKf48dqcu 7LBeNvDx2DM68XeVjdY8Abo5k4oSP7ZOPfSF0cRixgPogdSe1InymtaL2iONmA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598169; a=rsa-sha256; cv=none; b=RyZNqkC2Ny1OhKfKBHEEc+QQ5aKsJ2zZXtIZl0W1iBjafxBkoC8mh0x4VHLqZBIHncGkf+ G4AFePx2Mw5XcnjgrmTmFaR0Gi1q3B0FuleziqV3DApv0Psbgfr06J2hD2mhAj/ZGNIgXK X5JFgs8EupDao8amdQBr1Eu1edkPHpjwg0jqkfg8KGaXfRaOtUmQ9HTNeCa/u/lW8mew+I f4epUI3cD9A8SpdwFYUVG/o378LaFs6G+rLT0+Fi2u0CR8cDDyoQuBMusBXGv/OYQ5N43L yCLzpr4AVEPhR0QMimSREcvVCXciRsbzK5UW+e6qkL/MZUM170c4jypXCFjg0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8n4Bh2zncM; Thu, 23 Mar 2023 19:02: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 32NJ2n4Q039372; Thu, 23 Mar 2023 19:02:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2nj3039371; Thu, 23 Mar 2023 19:02:49 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:49 GMT Message-Id: <202303231902.32NJ2nj3039371@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: 1c1f31a5e517 - main - Remove unused registes from the arm pcb List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 1c1f31a5e517ebb940c752c3468b03cdc687c5c7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1c1f31a5e517ebb940c752c3468b03cdc687c5c7 commit 1c1f31a5e517ebb940c752c3468b03cdc687c5c7 Author: Andrew Turner AuthorDate: 2023-03-22 12:33:05 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 Remove unused registes from the arm pcb These were kept for ABI reasons. Remove them and bump __FreeBSD_version so debuggers can be updated to use the new layout. Reviewed by: jhb Sponsored by: Arm Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35378 --- sys/arm64/arm64/db_trace.c | 2 +- sys/arm64/arm64/gdb_machdep.c | 12 ++++++------ sys/arm64/arm64/genassym.c | 1 - sys/arm64/arm64/machdep.c | 6 +++--- sys/arm64/arm64/stack_machdep.c | 2 +- sys/arm64/arm64/vm_machdep.c | 4 ++-- sys/arm64/include/db_machdep.h | 4 ++-- sys/arm64/include/gdb_machdep.h | 1 + sys/arm64/include/pcb.h | 14 ++++++++------ 9 files changed, 24 insertions(+), 22 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 6abdd6c5ca7a..42230f273716 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -145,7 +145,7 @@ db_trace_thread(struct thread *thr, int count) ctx = kdb_thr_ctx(thr); frame.fp = (uintptr_t)ctx->pcb_x[PCB_FP]; - frame.pc = (uintptr_t)ctx->pcb_lr; + frame.pc = (uintptr_t)ctx->pcb_x[PCB_LR]; db_stack_trace_cmd(thr, &frame); } else db_trace_self(); diff --git a/sys/arm64/arm64/gdb_machdep.c b/sys/arm64/arm64/gdb_machdep.c index b27e1edb3d7f..fed8a8b5e9d4 100644 --- a/sys/arm64/arm64/gdb_machdep.c +++ b/sys/arm64/arm64/gdb_machdep.c @@ -60,10 +60,10 @@ gdb_cpu_getreg(int regnum, size_t *regsz) switch (regnum) { case GDB_REG_SP: return (&kdb_thrctx->pcb_sp); case GDB_REG_PC: /* FALLTHROUGH */ - case GDB_REG_LR: return (&kdb_thrctx->pcb_lr); + case GDB_REG_LR: return (&kdb_thrctx->pcb_x[PCB_LR]); default: - if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) - return (&kdb_thrctx->pcb_x[regnum]); + if (regnum >= GDB_REG_X19 && regnum <= GDB_REG_X29) + return (&kdb_thrctx->pcb_x[regnum - GDB_REG_X19]); break; } @@ -89,11 +89,11 @@ gdb_cpu_setreg(int regnum, void *val) } switch (regnum) { case GDB_REG_PC: /* FALLTHROUGH */ - case GDB_REG_LR: kdb_thrctx->pcb_lr = regval; break; + case GDB_REG_LR: kdb_thrctx->pcb_x[PCB_LR] = regval; break; case GDB_REG_SP: kdb_thrctx->pcb_sp = regval; break; default: - if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) { - kdb_thrctx->pcb_x[regnum] = regval; + if (regnum >= GDB_REG_X19 && regnum <= GDB_REG_X29) { + kdb_thrctx->pcb_x[regnum - GDB_REG_X19] = regval; } break; } diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index db07f1714f5a..2bc0804aef27 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -57,7 +57,6 @@ ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); ASSYM(PCB_X19, PCB_X19); -ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 0659602a9ded..31e7568a0605 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -356,10 +356,10 @@ makectx(struct trapframe *tf, struct pcb *pcb) int i; for (i = 0; i < nitems(pcb->pcb_x); i++) - pcb->pcb_x[i] = tf->tf_x[i]; + pcb->pcb_x[i] = tf->tf_x[i + PCB_X_START]; - /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */ - pcb->pcb_lr = tf->tf_elr; + /* NB: pcb_x[PCB_LR] is the PC, see PC_REGS() in db_machdep.h */ + pcb->pcb_x[PCB_LR] = tf->tf_elr; pcb->pcb_sp = tf->tf_sp; } diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c index 8a3e8ce7dbc7..9fdb3da211cd 100644 --- a/sys/arm64/arm64/stack_machdep.c +++ b/sys/arm64/arm64/stack_machdep.c @@ -69,7 +69,7 @@ stack_save_td(struct stack *st, struct thread *td) return (EOPNOTSUPP); frame.fp = td->td_pcb->pcb_x[PCB_FP]; - frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_lr); + frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_x[PCB_LR]); stack_capture(td, st, &frame); return (0); diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index dee42a8b568d..e111995f09b0 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -107,7 +107,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Set the return value registers for fork() */ td2->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return; td2->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td2; - td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; + td2->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; vfp_new_thread(td2, td1, true); @@ -185,7 +185,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return; td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td; - td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; + td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; /* Update VFP state for the new thread */ diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index 9ec0b6402a91..88cebee8fc30 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -44,7 +44,7 @@ typedef vm_offset_t db_addr_t; typedef long db_expr_t; -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_lr) +#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_x[PCB_LR]) #define BKPT_INST (0xd4200000) #define BKPT_SIZE (4) @@ -52,7 +52,7 @@ typedef long db_expr_t; #define BKPT_SKIP do { \ kdb_frame->tf_elr += BKPT_SIZE; \ - kdb_thrctx->pcb_lr += BKPT_SIZE; \ + kdb_thrctx->pcb_x[PCB_LR] += BKPT_SIZE; \ } while (0) #define db_clear_single_step kdb_cpu_clear_singlestep diff --git a/sys/arm64/include/gdb_machdep.h b/sys/arm64/include/gdb_machdep.h index 17b46edd1a27..82354f52bd5e 100644 --- a/sys/arm64/include/gdb_machdep.h +++ b/sys/arm64/include/gdb_machdep.h @@ -34,6 +34,7 @@ #define GDB_BUFSZ 4096 #define GDB_NREGS 68 #define GDB_REG_X0 0 +#define GDB_REG_X19 19 #define GDB_REG_X29 29 #define GDB_REG_LR 30 #define GDB_REG_SP 31 diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h index 8767a9e4dba3..8ffe6f2d483e 100644 --- a/sys/arm64/include/pcb.h +++ b/sys/arm64/include/pcb.h @@ -36,14 +36,16 @@ struct trapframe; -#define PCB_X19 19 -#define PCB_X20 20 -#define PCB_FP 29 +/* The first register in pcb_x is x19 */ +#define PCB_X_START 19 + +#define PCB_X19 0 +#define PCB_X20 1 +#define PCB_FP 10 +#define PCB_LR 11 struct pcb { - uint64_t pcb_x[30]; - uint64_t pcb_lr; - uint64_t _reserved; /* Was pcb_pc */ + uint64_t pcb_x[12]; /* These two need to be in order as we access them together */ uint64_t pcb_sp; uint64_t pcb_tpidr_el0; From nobody Thu Mar 23 19:02:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8p6CH5z41gtQ; Thu, 23 Mar 2023 19:02: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 4PjF8p5ZPPz3pYR; Thu, 23 Mar 2023 19:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HHB4K3D/28Sd1IbKpyyGC/QE95qyHosNIHnqjAuzITk=; b=c2Op+LtMXAjri5zmB59R8KAoUABYEDnKkjrW4supDURQieOVHwMy8Xs2XqtcNud+mfDi0Z MEYTh9ZgUR9Aq7WSf+fY2VT3+VBbXf/Meo8WZ346R9Lse5a4z51Op9UTOQNx/dXOJeeEdd ASZH59RJjvT04Yoo70zeIknbBYm18mPU02gM6KlJCzhMWjOoxy2oHb9paE/K7qBSYMPCma u/jqi/vWpp9VfxAHpzTCeuPZ1JPvoSR9IRmWiImxUTVFvq5nSDz5tc7SxSAXaKc8mCoqMx vJcGlmloCjJaKwqucUagbWxkAAMmeaA3UdJ4dbxnmgzauKUxqM1npJ+YJ2V4nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HHB4K3D/28Sd1IbKpyyGC/QE95qyHosNIHnqjAuzITk=; b=ZqXcZ8s7e0Q/H7IvAuXXvmXtAYaMAOkHxCYQh1R46rJIuSGcFdpnaZP8LWKmr0ZHAmmFXx rXowSIrU+Amx8m2rE49c+eG2dB4d2K0qy06mVzCYWWlsN6bsWnpr/ZqJDuGAN0e1spc0hm 4r85XDQEhXdfVkyykJeiQqCcL1cQAUgUweAkqtOWrXabT1qA+mZWeLS86L0WX5fhhGHEM1 WQGaekSyek/OPswOKVj6o8e1ogSRw7HSGjuXnTi+20fFpf6K4O8nAQ/kL3ro2H8MeUvPx2 VmVYBRDnJOjiiCHxqnbUbGsYGMAHETpw0OMVQwD3vp1Dz1K9txJWQRzF0McbPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598170; a=rsa-sha256; cv=none; b=wCEvOE332nsfbJbOH4MFrpMtoprzC8wXFCxC1MaeHoOCNMk/CNvvRrnXnNdjtCv738Njr7 JE7nCLtsrIIsY7BfeIvtA+0uyIXkL3fXnoLBLACk/EsSa7Pf1pXc98byFDn5PpN/EsB5N2 2rdJ/7R/VAfYMT9HoFQUAExOfiDaiCz5uv4nHOoLjh26Bnjc9TutYh7xBeZ6b3rIT5uokD pXocCfFB6Lu0waP2O/16ZQThbo/reat311DKxzNHd3Gh88sjyjaWXPKqadwDbXi+G23iox 9L/5dALdIhbzN9KxQZn8r/ZLA5NwZDlqEtPD1JwkYogGTb6Fo2j1jQuXBMhHTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8p4gxlznZ0; Thu, 23 Mar 2023 19:02: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 32NJ2or3039392; Thu, 23 Mar 2023 19:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2oBj039391; Thu, 23 Mar 2023 19:02:50 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:50 GMT Message-Id: <202303231902.32NJ2oBj039391@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: ea3061526e9c - main - Bump __FreeBSD_version for changing spsr on arm64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: ea3061526e9ce5d3b65932c1d3e4437abd556d65 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ea3061526e9ce5d3b65932c1d3e4437abd556d65 commit ea3061526e9ce5d3b65932c1d3e4437abd556d65 Author: Andrew Turner AuthorDate: 2023-03-22 11:59:36 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 Bump __FreeBSD_version for changing spsr on arm64 This changed a few structures, bump __FreeBSD_version for kgdb and userspace consumers. Sponsored by: Arm Ltd --- 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 d3bdca7c42e7..cf8755f2ac99 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 1400083 +#define __FreeBSD_version 1400084 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Thu Mar 23 19:02:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjF8r06rBz41ghw; Thu, 23 Mar 2023 19:02: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 4PjF8q6JD2z3pX2; Thu, 23 Mar 2023 19:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HeM3gxHHEcKFJHx8piI+PvcrEMBLbzEqJ+oL6fqIM+8=; b=iDddJ8IopB8xvaJ5kPy8c1R/YGQffOjbowtD9iT1C+MdifUc2qOVS+yPrNuj4o1exAQV6B nHv13GpMiFeX2Llss0k30DaSYlBKdcRHWMnPhKVtVA6QFBArcGiwxPuuHkzN1QUMdHNLq9 XHLQeInbMCCcFBcjHUPmu9ZQXRv6pU4tWO1BE+krIXxHjE6/ePtUsf2gU3gB5/F8h+LOVE QQeNaavIoB2LEmU3Rhd4iclGfzfFtpkkLb2wLKc+145yC5Ml25aEvjDBKXF2iBITTw4T33 /HIb9613OYeUacqFRlBIT/dPSEVNlQzzNvPVY8AsECh4ZqWvXJLGxx6TZ7UDbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679598171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HeM3gxHHEcKFJHx8piI+PvcrEMBLbzEqJ+oL6fqIM+8=; b=K8b3O84u+nN5FyhRUIRB47EVHTRpRtwdo+u+eSrqWB4AWWTUGy5xe7vyhAfAN+LkjSynGl eLQRLAdu0UyOOkfB8gcxVMxmXn+eI7br8YWEBKNPNkhHvhwXwNOs48cc66YyX11z+pnY8/ yCjeWC0/VKOqRAZ+jZkXNRbKnFPLjQpS4ZLeakgM7KznAE5CMp/IwlBjkx3l/6tsfRqjqa O4eEMAh5W0FJ7cK8vzgL1U0EvkJVpvkHO8pea/+BzIzUcI5g+JA9gLuN7NMB5WHHx7wnDK cq9G3yqY36KZNSTWCpqg4dqyExBi2/7UgSLVR++/drgydbPa9EhaGzZU9VTO9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679598171; a=rsa-sha256; cv=none; b=e0RLKywYOGdux6cotuJYoEOx1rXGPYta2VxBAzmSea2qwCQKhi0UBSWs8QcHjMNdgHtkPu 2UaP9v6zE5RdDNXOMp0cCxCtttaNe2dbFVE899R6hJBrfMulYh2JGxO+YBm6h/gCv7adKE eTm03njDxNL/djdAcHFrI2q2OL2TeBnZQ/4F5M7m7zNut45hAvdEQv3ATRmS5PyAkYTEqc Qq336guCzi0V34lILkDUhTfAea9ACCbA1TMkXFHy7JVdqs9IkuiAJ8q+2Hn6T4i8gVm4WB Zpvw55doYTH0SCWJBbfWwWc3nY2msPJOdfWc62AINdMGrL4EhoKgw0PwcRr+yA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjF8q5KqBzncN; Thu, 23 Mar 2023 19:02: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 32NJ2pN1039415; Thu, 23 Mar 2023 19:02:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJ2p0Q039414; Thu, 23 Mar 2023 19:02:51 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:02:51 GMT Message-Id: <202303231902.32NJ2p0Q039414@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: 6a4f5fdd19d6 - main - Mark the arm64 PSR register fields with UL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 6a4f5fdd19d6de8612998eb7c62273fd8b8c3908 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=6a4f5fdd19d6de8612998eb7c62273fd8b8c3908 commit 6a4f5fdd19d6de8612998eb7c62273fd8b8c3908 Author: Andrew Turner AuthorDate: 2023-03-22 16:46:25 +0000 Commit: Andrew Turner CommitDate: 2023-03-23 18:56:26 +0000 Mark the arm64 PSR register fields with UL These are for a 64 bit register. Make them 64 bit values on arm64. Sponsored by: Arm Ltd --- sys/arm64/include/armreg.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 6ecd791fd87b..45f6145de8bd 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1778,32 +1778,32 @@ * 0: always SP0 * 1: current ELs SP */ -#define PSR_M_EL0t 0x00000000 -#define PSR_M_EL1t 0x00000004 -#define PSR_M_EL1h 0x00000005 -#define PSR_M_EL2t 0x00000008 -#define PSR_M_EL2h 0x00000009 -#define PSR_M_64 0x00000000 -#define PSR_M_32 0x00000010 -#define PSR_M_MASK 0x0000000f - -#define PSR_T 0x00000020 - -#define PSR_AARCH32 0x00000010 -#define PSR_F 0x00000040 -#define PSR_I 0x00000080 -#define PSR_A 0x00000100 -#define PSR_D 0x00000200 +#define PSR_M_EL0t 0x00000000UL +#define PSR_M_EL1t 0x00000004UL +#define PSR_M_EL1h 0x00000005UL +#define PSR_M_EL2t 0x00000008UL +#define PSR_M_EL2h 0x00000009UL +#define PSR_M_64 0x00000000UL +#define PSR_M_32 0x00000010UL +#define PSR_M_MASK 0x0000000fUL + +#define PSR_T 0x00000020UL + +#define PSR_AARCH32 0x00000010UL +#define PSR_F 0x00000040UL +#define PSR_I 0x00000080UL +#define PSR_A 0x00000100UL +#define PSR_D 0x00000200UL #define PSR_DAIF (PSR_D | PSR_A | PSR_I | PSR_F) /* The default DAIF mask. These bits are valid in spsr_el1 and daif */ #define PSR_DAIF_DEFAULT (PSR_F) -#define PSR_IL 0x00100000 -#define PSR_SS 0x00200000 -#define PSR_V 0x10000000 -#define PSR_C 0x20000000 -#define PSR_Z 0x40000000 -#define PSR_N 0x80000000 -#define PSR_FLAGS 0xf0000000 +#define PSR_IL 0x00100000UL +#define PSR_SS 0x00200000UL +#define PSR_V 0x10000000UL +#define PSR_C 0x20000000UL +#define PSR_Z 0x40000000UL +#define PSR_N 0x80000000UL +#define PSR_FLAGS 0xf0000000UL /* PSR fields that can be set from 32-bit and 64-bit processes */ #define PSR_SETTABLE_32 PSR_FLAGS #define PSR_SETTABLE_64 (PSR_FLAGS | PSR_SS) From nobody Thu Mar 23 19:31:33 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjFny20L7z41jDH; Thu, 23 Mar 2023 19: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 4PjFny1VtCz3tbT; Thu, 23 Mar 2023 19:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679599894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1e6O4hkVV+cbnSG891vq+qbFGz6uIBTpFbb79TpOctU=; b=HmMTQwaX1BLV7lFtaKo9xtgg7bMep94lLifI0DDpDM/zGz/qJ/hzf9/oehR8RWBY4SdYVR dG8PoNMfk8RvXfKmcNsiHDU34kU2ER8AzOGog8tuiOMsN/bcWRtlo4qCCXhd0zAoUjAype Rr1iV9bvo9U6PLg+HekeUsnBZumglxe7mbYZAlEM29h2OD01q8tthQAfLbmL1pvaLNLdmA /5vIC3KwDLHbFRUzRJLK7FiKtdp4BjhwtZD69PB1hL2KacTvvvYxPvpEfNTa3XVTNsnoXZ qBWTVH9AqNw0ruXNku9VEiA6YSKaRhmHt43e5423e69yvCqMc6cBir0zbUa51w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679599894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1e6O4hkVV+cbnSG891vq+qbFGz6uIBTpFbb79TpOctU=; b=Co00whujNp7GN08lZBnfJcOoUTpsURrgOqMzyLv5IvlB5aCwKbMvc49BJFAoQSf57fMB9f QQP4xAnxSJJDFni1tVDAQR1fXcEXzbvuFvF9VDNlIKARMzTXPQEfQ8UjpD2/g4f53jiRF8 E8AoEn6Qx63Vu7pf1ZdnJxPuy5AKX5pQlB0nXi3b8uqSUTf40E7cjFV6luyWZpUA5nBRnx P2mveqgvib9mXaSTNJhrFxCvQcdJb6vM3ZCji9FycEvq6/fvswunn84Bkabm022hPVq7Fb +w3evCEsmDgR9pPEfZeyHVCdaaF5v7j+i0/I0vn80rf9JDzB99ARQ2oSmBT+sA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679599894; a=rsa-sha256; cv=none; b=MmUBRf1uKww3JM43mphCBJmVsXpg94WYWd5bV5IFzQ5ycA04aiH8BPDRoSWTlt+UPvmCgl dGmFrKuwSFsKqJbl0SOYewdqxzhu5bajl+HXn5UWpRESanPTVlC+yNLV1pYiZThl9ucYis t1z6gr/BGWcl6GQuUgPL8SBBKVXhrQMaHOXiV4YDGtHJMDkKD7h9UUZSI6FS9sZb+V3bIt e3UDvXZzShcCa7Zd67HKXRlpUBg7BJUUkaKs4T6r7STPDLUdhdjy9KAO2dE8/Y13VflyRp PWxbV9a0oR9ddaB5dlFav0C1mJK7HBZC7vsr5USQDgDKC92g+Bd5kkMwMTcbRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjFny0YwFzp13; Thu, 23 Mar 2023 19: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 32NJVXOF083771; Thu, 23 Mar 2023 19: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 32NJVXqM083756; Thu, 23 Mar 2023 19:31:33 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:31:33 GMT Message-Id: <202303231931.32NJVXqM083756@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: c16c4ea6d399 - main - vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: c16c4ea6d399332d4a023df6e423be61fdb875a5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c16c4ea6d399332d4a023df6e423be61fdb875a5 commit c16c4ea6d399332d4a023df6e423be61fdb875a5 Author: Mateusz Guzik AuthorDate: 2023-03-23 19:19:48 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-23 19:31:18 +0000 vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups Reported by: Oliver Kiddle PR: 270419 MFC: 3 days --- sys/kern/vfs_cache.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3ae2b663fffb..e716113e6085 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5065,6 +5065,12 @@ cache_fplookup_dot(struct cache_fpl *fpl) int error; MPASS(!seqc_in_modify(fpl->dvp_seqc)); + + if (__predict_false(fpl->dvp->v_type != VDIR)) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + /* * Just re-assign the value. seqc will be checked later for the first * non-dot path component in line and/or before deciding to return the @@ -5127,6 +5133,11 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } + if (__predict_false(dvp->v_type != VDIR)) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + ncp = atomic_load_consume_ptr(&dvp->v_cache_dd); if (ncp == NULL) { return (cache_fpl_aborted(fpl)); From nobody Thu Mar 23 20:05:24 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjGY04qkkz41lB9; Thu, 23 Mar 2023 20:05: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 4PjGY04G8Mz40KP; Thu, 23 Mar 2023 20:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679601924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pOIR2/Ahw0YpduzGSWBl6gnfI6vpGSJnxck/BV2o0U8=; b=Fvl92d3XcdT3BLU0tZZdCc2CGxATJNYYRp2OmBWcSim7MeOzk6QcNu1Z10NP0bNBBl6W/B J+GtrKuyTbp+1a+mm6rr8UUu+Bp+j8U27jrB7Q4bCmzZucoX8i2zia+I/E50GclIi/Es1i d9yDwfAjDf1RkZ6KNyppHMLu/9Tdvc9u/lDvvhEHD0rsvc/BaJ1eY+cd/we30S/3xDGwvm scyAgFTg2EtQa5pOTLILV01TDM8IiaUyRL/apCqEV6nsFEVf6wSkBpM7H1nBqQQuF6pVJ8 RP/yjTuNjeKJ/zh4tRTjagw9JkaokGO7AKcrG4pZbjDCYgT7Lkg5ngOQC9kyvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679601924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pOIR2/Ahw0YpduzGSWBl6gnfI6vpGSJnxck/BV2o0U8=; b=FmEdjqxE0gQdyff9QTrlnnm0cVgO+CF96LjJgIXv+UoQpH2Zuq/TVEdCmgY6ddOKkRkoq9 SEfSWHG8g1KRPPvjwrlqjzMVp358DT94aq17944v2aZBQNXfti3LJBpExCJcHkIaktYc64 cN0+YuIf5bp72iUJNN8p1ckNeDcmJVN5YfppwEjAlSvDPkQmuusmr8Nv/r7Z8bCuFQhQzZ tp3XCp09OBGJ+1NCsO4JkCKkakme970XsRyKb93xGMRkwFNOOAIL4mcxkbTntnepIIMRZg MBldeObyWtj0MPGt1wZH3Lf0mohoEgY8f3VRQS8kM0E+vXnXeLZ5zjRTDEKQag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679601924; a=rsa-sha256; cv=none; b=xuNX+bYkWFfqBr3KhRG3QWzOFtMd0y+9vS4rQ5dAyrkgBVIC6MzZkQPYyoKGQhIrNkE7Nb Gfg3DUgbPum2IQtx90bE+ZGayY7Dyvo4oWph7gQP6JHMAQQMILkRdHlVTUpLKDTkiQiDcF Ic3hr7mfXj04CFooO0mqLMSavkHtH1+4IbYAO21YlonewN60E6ksY5OqgSizbIj2aclz+Q IWWnrRJotspwkkr7zVG/z6GudAJm/XhPdjhBt5VdnloEqWkylA8c3KSB3/fmpZjoYdJIZe rv9g0Nk8nsZjc6adkQ0nHHRd3hfNjgoJn+QTMoKZL9eXPctuTwXErgpJSIsjUQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjGY03MFnzq2n; Thu, 23 Mar 2023 20:05: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 32NK5Ov4037780; Thu, 23 Mar 2023 20:05:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NK5OaG037779; Thu, 23 Mar 2023 20:05:24 GMT (envelope-from git) Date: Thu, 23 Mar 2023 20:05:24 GMT Message-Id: <202303232005.32NK5OaG037779@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: 42c82aad327d - main - Improve chance of finding an alternate superblock in sbsearch(3). List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42c82aad327d28cddba70ccd86986a5e5910ca0d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=42c82aad327d28cddba70ccd86986a5e5910ca0d commit 42c82aad327d28cddba70ccd86986a5e5910ca0d Author: Kirk McKusick AuthorDate: 2023-03-23 20:03:20 +0000 Commit: Kirk McKusick CommitDate: 2023-03-23 20:04:52 +0000 Improve chance of finding an alternate superblock in sbsearch(3). When requesting a superblock read for the sole purpose of getting the parameters needed to find if backup parameters have been stored, specify UFS_NOCSUM as only the base superblock is needed. This change reduces the number of checks that the superblock must pass. MFC after: 1 week --- sys/ufs/ffs/ffs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 1d4d98fcb67d..ba1d8c5c13c9 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -682,7 +682,7 @@ ffs_sbsearch(void *devfd, struct fs **fsp, int reqflags, */ if (msg) printf("Attempted recovery for standard superblock: failed\n"); - flags = UFS_FSRONLY | UFS_NOHASHFAIL | UFS_NOMSG; + flags = UFS_FSRONLY | UFS_NOHASHFAIL | UFS_NOCSUM | UFS_NOMSG; if (ffs_sbget(devfd, &protofs, UFS_STDSB, flags, filltype, readfunc) == 0) { if (msg) From nobody Thu Mar 23 21:03:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjHrM2Czjz40KMp; Thu, 23 Mar 2023 21:03: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 4PjHrM1SgRz49fX; Thu, 23 Mar 2023 21:03:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679605427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QUS02U1fedDC4lA+DAv4wVfo4lImXuSqoOe+bEkxDKM=; b=kKBNrX1SaqnxyELCAKi0hWtQBRA2wGbl51V+UWG6AcdaU1BhMKmCbW2tJ0sZqb9JJG7bBr Niv5q9usx36y7dP7KJqak+DlWV1rlcCukrqKNGNEHSPtX+nOwqw4UqYqL4DUtA/A2YfjwD 6DbuuLyIL49wExXDJGT+5pkR/OK54/tDbetCJVIn6U7/QDnYC+QUhwzHUFRk8Akn7h9Lgt XQghYG3I0rWwU4qYhUKa20eCT9T0b9rqsZue1DKg7nJucMyQEelDsiCoKCAhsq71wRGFy9 wGnuo0JmOD6zq5YIjDweuuV3R1m96oAt9T2PwM+5H2pRBUy/zPXajPSGhTarXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679605427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QUS02U1fedDC4lA+DAv4wVfo4lImXuSqoOe+bEkxDKM=; b=smSwtBu5SodbxKFF7dopHBdzWdqHIcnyWBzoNKpLJx62CY9uhfL6jTyVQzneLS/61w7sJD EGW4gxEmIzilM5JBvg8VMrVN3Vse/o6/AGz827CiHeOwXrP9t22KNXfixkbkzaZOLcZNJK LVOXinMJs0moKTlslTlRdDskiMGd6HuAFTvOQcyIMLTwcPzemEDZ5HuWdwZUEX82Ef61OI 9SRgyeGsR362rCmDpzHIRjYoNjeI4nABB+5UkuoILsgHv7BUVvbnWHEsnipwTuvwOkPln4 WFsdSkGkzEMDKzPgREc8y8CbairYJzMgMz1Tqez8nvpW+P9m8KN5NDaueUjldQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679605427; a=rsa-sha256; cv=none; b=LrSwyysbzETU7DiVPCr2bZX7iV7CmL6oR3K2zAlCXmS8SDAokDdGWveBy/LPXo/bIaaLsl fPEIFsspMO8NIm3fLsYfQfrADjCdQpFVx4sOPTDTUyY7+LTxNrldGCAtq34QoI1gxoWTXN 77yREToxXheN/jIdt7cUXLIvagBrTaZAaPCGxTsNiqqZ/DCLx1Q2A+Y78zb7gUb6hXd+5b XPSciLCqhN0ELkG9so5vkkQySqYH+VwFfqgYL4O03njs6ZW6VExp10t+21zHDghFSpaYzU 6vnZLHLIM5rehN/zGZ+BfkX0zvghbxnLBV6xJRjimJaglZvpL6yf2y0ce64XoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjHrM0VtKzr2s; Thu, 23 Mar 2023 21:03: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 32NL3l5Q036639; Thu, 23 Mar 2023 21:03:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NL3kcU036638; Thu, 23 Mar 2023 21:03:46 GMT (envelope-from git) Date: Thu, 23 Mar 2023 21:03:46 GMT Message-Id: <202303232103.32NL3kcU036638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: f63aaffebc4b - main - acpi(4): Fix a typo in a kernel message List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f63aaffebc4b93791030d759e319bbb038e5575f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=f63aaffebc4b93791030d759e319bbb038e5575f commit f63aaffebc4b93791030d759e319bbb038e5575f Author: Gordon Bergling AuthorDate: 2023-03-23 21:03:31 +0000 Commit: Gordon Bergling CommitDate: 2023-03-23 21:03:31 +0000 acpi(4): Fix a typo in a kernel message - s/enitialization/initialization/ MFC afer: 5 days --- sys/dev/acpica/acpi_cmbat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c index 407b6dace5d4..14b8878cdfe8 100644 --- a/sys/dev/acpica/acpi_cmbat.c +++ b/sys/dev/acpica/acpi_cmbat.c @@ -533,7 +533,7 @@ acpi_cmbat_init_battery(void *arg) dev = (device_t)arg; ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), - "battery enitialization start\n"); + "battery initialization start\n"); /* * Try repeatedly to get valid data from the battery. Since the From nobody Thu Mar 23 21:29:29 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjJQ21FwRz40M0k; Thu, 23 Mar 2023 21:29: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 4PjJQ20hkNz4GCD; Thu, 23 Mar 2023 21:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679606970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZuDsEfqQ9Ql+IB+cf2tQWgOMQ3XHlwMOUD8t3qjE/Dc=; b=iWzfo6ZrBUb/Z1ITQ8A2B9Ahwj+Fa6UW3u6p1MR+sSvdYQu2EzSZku+CTQOjyZl9U2uyVZ JTYUJMA9KjdrhZhiYh5kB6ZU/GW1Ozx7CgFfs0ix10PS0zYOAHSJW58nVmNyayvryj+sLq wwAIZKN0P8R3Milb/BzppmLiqxwiN3memXmh9kYFofWPXLfvEU13AdmvVc6MLiuRIdoaLh CZgAS4y2/SLviFvXXWpzrd4YqPXuiwSKyzFIS8ExMCPck2ByvnADs4/cPKz7+dPDXryo9Q 9gnS8jPwWSPYIl4Py909lddMKIR5btKrcG5Tk7dG3//iBYP2wvWYCyR483nslg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679606970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZuDsEfqQ9Ql+IB+cf2tQWgOMQ3XHlwMOUD8t3qjE/Dc=; b=bhnbxTMTQFZu4umhScmULh+/1ZrppVZR7bX6E88PVVTU1FKD2R4yfgyVPvJ9ZF0t9hammG 7msC35XGmUJ1mBZUVRDBI075BWITm2gayBY0PKrZmnnMe1D001nchi29Yeh3plzxBJn9xh 8XjjNdC0xV9YrLeREHYm+oLP24eFLMPNBDhHhLdVS+h+cIBeJ0WoeZjIGJgsFfUMFh0Xre D9W8msUosCxmOhpQxff56Ttb05nn/Dep5LmvUIRct/J+3DTKRrMmkPIeP9zdqExF+q22vX BdKzxOK2NxjKWM5/3KZC3wvjebWL9WitWEoKQorI/J4PhT9Vdq9ZOqmi7UUBSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679606970; a=rsa-sha256; cv=none; b=uhVhOHID3jjtyRLyiY9AsjVVAR8qPnqChQKhx1MsKgslqSpCCDKrcM5E8H7lxakMCtg8PN coovrxIS24qS5khspf4FVrhX+dduXTPgUsGLTVHnNULU+vr4M2M5e43SDwM6vCw7mnN8Iq LWYYJKcebjFF2WBbjnvXCfaboAF7i4JNeqmA8jtiU6ZAGRrCZBARuHzQ7OjWOpKjCg71cO XmU1qC0IL0SS4NPDWarbvg+o/tOmdWDZsFwJl3MAiMppkjtjmjQ/EKrP+sckkKWeI5JKCb aG97kY9ba1JHjzgxvhQXlWcEcT/JeCP/8SuKu6+DCw048IFQn8+fDQoW1xAkTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjJQ16Whmzrn0; Thu, 23 Mar 2023 21:29: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 32NLTT4s070068; Thu, 23 Mar 2023 21:29:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NLTTCA070067; Thu, 23 Mar 2023 21:29:29 GMT (envelope-from git) Date: Thu, 23 Mar 2023 21:29:29 GMT Message-Id: <202303232129.32NLTTCA070067@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: d2dab20c2ade - main - ktls: Drop all the INET and INET6 compile-time guards. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2dab20c2ade644337430856248ccb54a0a543c4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d2dab20c2ade644337430856248ccb54a0a543c4 commit d2dab20c2ade644337430856248ccb54a0a543c4 Author: John Baldwin AuthorDate: 2023-03-23 21:29:07 +0000 Commit: John Baldwin CommitDate: 2023-03-23 21:29:07 +0000 ktls: Drop all the INET and INET6 compile-time guards. Consistent with 9fd0d9b16e93ff2a3bd375a98763dca0150dcee0, KERN_TLS is not supported on kernels without any INET support. Reviewed by: gallatin, hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39232 --- sys/kern/uipc_ktls.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index c82864f379b8..4639355b1558 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -66,10 +66,8 @@ __FBSDID("$FreeBSD$"); #endif #include #include -#if defined(INET) || defined(INET6) #include #include -#endif #include #ifdef TCP_OFFLOAD #include @@ -302,14 +300,11 @@ SYSCTL_COUNTER_U64(_kern_ipc_tls_toe, OID_AUTO, chacha20, CTLFLAG_RD, static MALLOC_DEFINE(M_KTLS, "ktls", "Kernel TLS"); -#if defined(INET) || defined(INET6) static void ktls_reset_receive_tag(void *context, int pending); static void ktls_reset_send_tag(void *context, int pending); -#endif static void ktls_work_thread(void *ctx); static void ktls_alloc_thread(void *ctx); -#if defined(INET) || defined(INET6) static u_int ktls_get_cpu(struct socket *so) { @@ -340,7 +335,6 @@ ktls_get_cpu(struct socket *so) cpuid = ktls_cpuid_lookup[inp->inp_flowid % ktls_number_threads]; return (cpuid); } -#endif static int ktls_buffer_import(void *arg, void **store, int count, int domain, int flags) @@ -505,7 +499,6 @@ start: return (error); } -#if defined(INET) || defined(INET6) static int ktls_create_session(struct socket *so, struct tls_enable *en, struct ktls_session **tlsp, int direction) @@ -1826,7 +1819,6 @@ ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate) return (mst->sw->snd_tag_modify(mst, ¶ms)); } #endif -#endif static void ktls_destroy_help(void *context, int pending __unused) @@ -3265,7 +3257,6 @@ ktls_work_thread(void *ctx) } } -#if defined(INET) || defined(INET6) static void ktls_disable_ifnet_help(void *context, int pending __unused) { @@ -3354,4 +3345,3 @@ ktls_disable_ifnet(void *arg) TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); } -#endif From nobody Thu Mar 23 21:56:58 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjK1k3n4fz40NQK; Thu, 23 Mar 2023 21:56: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 4PjK1k3CHLz4Hlh; Thu, 23 Mar 2023 21:56:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679608618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Eb7JYRkMujqtKzrRQ5ZQ5BN8slPIHzGKG2JefYHmBs=; b=g3VQJ2q+iJVRT6OxuRj56CezQh7sJgjbMNiXJ3/XEpwr0yg76aGUuH76zF3I0LsrbPzVXk UrnEnZJ/dm8y+QrdMvb+/cKmfEsRvAVNU4smN1YuU6kSEcm57Hopa+c4mS0VyL7Y/KNewb kaM6Y0w3/x8oLu34OF6H/Wwyd4hQveCRP89OWi9gaxZWaROe3fqXNzDusucJA/H1cZt5bW mWeshjrAxwmoCpssbNyo/r2cgpbBygGZ7FFtinbsySSGwQueTLTUS4m9BoImlyyC0jvRQu Y/zvmcCCOX7eBqK3y04gfUtrAQcS8yBSIlZSc/Nr1XD1t6i5Zk9nqCpfGXKDwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679608618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Eb7JYRkMujqtKzrRQ5ZQ5BN8slPIHzGKG2JefYHmBs=; b=xuowrnhROiRuy/KirmHExSSc9hProgrxwmgy+ydSOA7dr6hH3S4tyjYjEfLwQrXzhubNB0 gvgFx5YpBxyD8QDdGHJHM7Ymkh9sKKSyzw3L7xHQ148hxjuiioqWqkPwGIVcHCXP2zbKuC PrTVp/vMqjgzoBSP5yI2PUjG1XnlXmBbHJbk/zFoFVQNDHcd4+mg8B2CJPc/tU0pg4W9Tt HFfshBC0JM/UyiDFP0V+EqyZU3RZE5yFmJPRL+PZXUj9+GbxleZQXXf5X/FQebb3nQoyQ6 Qc9JqvB3L4mQRkW2S9hTyF+CkvmBUZZlmQhxuDJL/c7o26SWFZcNKKe1OGo/pQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679608618; a=rsa-sha256; cv=none; b=rB0fhBlRDl+rYfPfXcN21lAuuLXwM1XQukFNCh5eBpymL2CK7g6BwX8+SXqJ0WJXjaTvSr Jd7xpLh8WHHS6kOM9w3u2IADJTnLAoocPsBt/kwHgYDTPtl9hmGtzfhoc20KC1D1weuTaB xSorU/Ar87dqOM5Y6tKukx85dVFWrWoivbMCK1j1Daw5MJ3xEN5bBp7XR1R71SSXLotcY7 2CdorxFXhofhW4c891Rhuf1zG/GQBL58M23HY6Xm+/Z7JoW7G3oxx/XbxKbaBQMyEAlFjT klkuwVUVG+nGvOYxmF8EdMRu6nZ6ZVsygkxFIDRImF9ByFZN95Tx4P5J6dWx8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjK1k2CyhzsND; Thu, 23 Mar 2023 21:56: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 32NLuwXr018297; Thu, 23 Mar 2023 21:56:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NLuw9U018296; Thu, 23 Mar 2023 21:56:58 GMT (envelope-from git) Date: Thu, 23 Mar 2023 21:56:58 GMT Message-Id: <202303232156.32NLuw9U018296@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: 9f2a52536047 - main - makefs: correct El Torito bood record List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f2a525360473a778f91021e3be58fd4bfd72ee5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2a525360473a778f91021e3be58fd4bfd72ee5 commit 9f2a525360473a778f91021e3be58fd4bfd72ee5 Author: Ed Maste AuthorDate: 2023-03-23 17:02:44 +0000 Commit: Ed Maste CommitDate: 2023-03-23 21:56:33 +0000 makefs: correct El Torito bood record The boot catalog pointer is a DWord, but we previously populated it via cd9660_bothendian_dword which overwrote four unused bytes following it. See El Torito 1.0 (1995) Figure 7 for details. PR: 203531 Reported by: Coverity Scan Reported by: Thomas Schmitt Reviewed by: kevans CID: 977470 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39231 --- usr.sbin/makefs/cd9660/cd9660_eltorito.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c index 3628a798db4c..b60e63ee1b53 100644 --- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c +++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c @@ -377,8 +377,8 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int first_sector) /* Point to catalog: For now assume it consumes one sector */ ELTORITO_DPRINTF(("Boot catalog will go in sector %d\n", first_sector)); diskStructure->boot_catalog_sector = first_sector; - cd9660_bothendian_dword(first_sector, - diskStructure->boot_descriptor->boot_catalog_pointer); + cd9660_731(first_sector, + diskStructure->boot_descriptor->boot_catalog_pointer); /* Step 1: Generate boot catalog */ /* Step 1a: Validation entry */ From nobody Thu Mar 23 21:59:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjK5D5MNmz40NwH; Thu, 23 Mar 2023 22:00:00 +0000 (UTC) (envelope-from jlduran@gmail.com) Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 4PjK5D2XJGz4KhL; Thu, 23 Mar 2023 22:00:00 +0000 (UTC) (envelope-from jlduran@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-oi1-x229.google.com with SMTP id bj20so7850085oib.3; Thu, 23 Mar 2023 15:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679608799; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=g+U+F3EVQA6x9HkRjJMIVzozRcge5PDPFQXKkoARiXw=; b=TJEjy2b9qwZT9Ccn/H4Rca5meQHsUpuK72jAsMwfc4RUXu4ZklR9hph5jBY845ISpw qutgkhnsSmr0HxHhmNYkAgS4VGLKcLgOJTJZ+CgZxONozx3DX3taRiTvBYyWayZplMQZ CTjg+e88dIn05TB2zhHMJT8TLi/XcXrMCs3tZQt2B4kqD3w9B4yNQQ+864DLDMZanzBf um2lhAgrbvOLQlYg5GXPBCmSDs67CWAe/CoB2m3F3EZjZftCkHuyWwveYzy3geUptAqE K/qmTP0K+wvb77N/gZc7/FuvHRYXjeXG5grpbyKgsKCqKuTWpgEepoqYjax2fo6Hbjt+ cs7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679608799; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g+U+F3EVQA6x9HkRjJMIVzozRcge5PDPFQXKkoARiXw=; b=E7p9rYRxZr2WUNd0J4tG3JUW6DoHV70VW0TIdtVpNENy7t1guiwmQ3jkYjCIHZ0RKl 5M5tMkYQnLuuL2EZu7t5Ii9MyWdurVz7Stn8d0vuKds/TxBVu/P8oglsnlDCnbt5howo NYBklZ3AZCXvk1Zh/NqyyP0jOUm4nGQYCO1QFUAd3HWzSQtYcy6RIfNlCe2EXEA03FOv n3+ak6uCdTyYtXlMzQChqU0qc5Hcs1i7OBI0/li1uv+MfYI/bU9kSKW0GNU6pf9aKOVW /zSTvg+1A5UubHQ1S2skEjGI4yUqsf6+jitx8f80OuJ8ZBK0M5icil8VvN3vMDKSZ5r0 YBtg== X-Gm-Message-State: AO0yUKUqBAbt5Nk6EZcjMffbQzVh7V9E4IYwThjB2yLqzLfiHeSIRwJW baWKzXFxRVJwjuL50TVBWe/X2CTs6qo= X-Google-Smtp-Source: AK7set9ntN4+0Mv4vte/EBRrYNr3Bohar3fkj4+EiQm1K7NCZIi6b09i1cWsE/gq4+TaZe8hLWzIfQ== X-Received: by 2002:a05:6808:424e:b0:384:2a24:bd7e with SMTP id dp14-20020a056808424e00b003842a24bd7emr63884oib.44.1679608799109; Thu, 23 Mar 2023 14:59:59 -0700 (PDT) Received: from smtpclient.apple (mlsrj200152099p037.mls.com.br. [200.152.99.37]) by smtp.gmail.com with ESMTPSA id q6-20020acad906000000b003876369bd0asm917390oig.19.2023.03.23.14.59.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2023 14:59:58 -0700 (PDT) From: =?utf-8?B?Sm9zw6kgTHVpcyBEdXLDoW4=?= Message-Id: <8FFC2AAC-A06E-4791-9C33-AF0D3A26529F@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_93831C93-95ED-479E-BA26-94F08F218FFC" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: git: 20b41303140e - main - ping: Print the IP options of the original packet Date: Thu, 23 Mar 2023 18:59:45 -0300 In-Reply-To: <20230323090520.30554030@slippy> Cc: Mark Johnston , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Cy Schubert References: <202303191633.32JGXPov003163@gitrepo.freebsd.org> <20230323090520.30554030@slippy> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Rspamd-Queue-Id: 4PjK5D2XJGz4KhL X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_93831C93-95ED-479E-BA26-94F08F218FFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Mar 23, 2023, at 1:05 PM, Cy Schubert = wrote: >=20 > On Sun, 19 Mar 2023 16:33:25 GMT > Mark Johnston wrote: >=20 >> The branch main has been updated by markj: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D20b41303140eee4dfb896558fb83600c= 5f013d39 >>=20 >> commit 20b41303140eee4dfb896558fb83600c5f013d39 >> Author: Jose Luis Duran >> AuthorDate: 2023-02-09 15:47:53 +0000 >> Commit: Mark Johnston >> CommitDate: 2023-03-19 16:23:06 +0000 >>=20 >> ping: Print the IP options of the original packet >>=20 >> When an ICMP packet contains an IP packet in its payload, and that >> original IP packet contains options, these options were not = displayed >> accordingly in pr_iph(). >>=20 >> pr_iph() is a function that prints the original "quoted packet" IP >> header, with only an IP struct as an argument. The IP struct does = not >> contain IP options, and it is not guaranteed that the options will = be >> contiguous in memory to the IP struct after >> d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52. >>=20 >> Pass the raw ICMP data along with the IP struct, in order to print = the >> options, if any. >>=20 >> Reviewed by: markj >> MFC after: 1 week >> Differential Revision: https://reviews.freebsd.org/D38469 >> --- >> sbin/ping/ping.c | 19 ++++++++++--------- >> sbin/ping/tests/ping_test.sh | 2 +- >> sbin/ping/tests/test_ping.py | 1 - >> 3 files changed, 11 insertions(+), 11 deletions(-) >>=20 >> diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c >> index fe319bfb70a5..b1721ad72a5c 100644 >> --- a/sbin/ping/ping.c >> +++ b/sbin/ping/ping.c >> @@ -225,7 +225,7 @@ static void pinger(void); >> static char *pr_addr(struct in_addr); >> static char *pr_ntime(n_time); >> static void pr_icmph(struct icmp *, struct ip *, const u_char = *const); >> -static void pr_iph(struct ip *); >> +static void pr_iph(struct ip *, const u_char *); >> static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct = timespec *); >> static void pr_retip(struct ip *, const u_char *); >> static void status(int); >> @@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> struct ip oip; >> u_char oip_header_len; >> struct icmp oicmp; >> - const u_char *oicmp_raw; >>=20 >> /* >> * Get size of IP header of the received packet. >> @@ -1355,8 +1354,6 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> } >>=20 >> memcpy(&oip, icmp_data_raw, sizeof(struct ip)); >> - oicmp_raw =3D icmp_data_raw + oip_header_len; >> - memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); >=20 > Coverity is complaining about uninitialized oicmp due to the deletion > of the above two lines. >=20 >>=20 >> if (((options & F_VERBOSE) && uid =3D=3D 0) || >> (!(options & F_QUIET2) && >> @@ -1366,7 +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct = sockaddr_in *from, struct timespec *tv) >> (oicmp.icmp_id =3D=3D ident))) { >> (void)printf("%zd bytes from %s: ", cc, >> pr_addr(from->sin_addr)); >> - pr_icmph(&icp, &oip, oicmp_raw); >> + pr_icmph(&icp, &oip, icmp_data_raw); >> } else >> return; >> } >> @@ -1663,14 +1660,13 @@ pr_icmph(struct icmp *icp, struct ip *oip, = const u_char *const oicmp_raw) >> * Print an IP header with options. >> */ >> static void >> -pr_iph(struct ip *ip) >> +pr_iph(struct ip *ip, const u_char *cp) >> { >> struct in_addr ina; >> - u_char *cp; >> int hlen; >>=20 >> hlen =3D ip->ip_hl << 2; >> - cp =3D (u_char *)ip + sizeof(struct ip); /* point = to options */ >> + cp =3D cp + sizeof(struct ip); /* point to options */ >>=20 >> (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src = Dst\n"); >> (void)printf(" %1x %1x %02x %04x %04x", >> @@ -1723,7 +1719,12 @@ pr_addr(struct in_addr ina) >> static void >> pr_retip(struct ip *ip, const u_char *cp) >> { >> - pr_iph(ip); >> + int8_t hlen; >> + >> + pr_iph(ip, cp); >> + >> + hlen =3D ip->ip_hl << 2; >> + cp =3D cp + hlen; >>=20 >> if (ip->ip_p =3D=3D 6) >> (void)printf("TCP: from port %u, to port %u = (decimal)\n", >> diff --git a/sbin/ping/tests/ping_test.sh = b/sbin/ping/tests/ping_test.sh >> index 9f821ed96360..53383f2fb7bc 100644 >> --- a/sbin/ping/tests/ping_test.sh >> +++ b/sbin/ping/tests/ping_test.sh >> @@ -178,7 +178,7 @@ inject_pip_head() >> } >> inject_pip_body() >> { >> - atf_check -s exit:2 -o match:"Destination Host Unreachable" -o = not-match:"01010101" python3 $(atf_get_srcdir)/injection.py pip >> + atf_check -s exit:2 -o match:"Destination Host Unreachable" -o = match:"(01){40}" python3 $(atf_get_srcdir)/injection.py pip >> } >> inject_pip_cleanup() >> { >> diff --git a/sbin/ping/tests/test_ping.py = b/sbin/ping/tests/test_ping.py >> index a9b760ff7aca..79fd332f1c18 100644 >> --- a/sbin/ping/tests/test_ping.py >> +++ b/sbin/ping/tests/test_ping.py >> @@ -893,7 +893,6 @@ Vr HL TOS Len ID Flg off TTL Pro cks = Src Dst >> "stderr": "", >> "redacted": False, >> }, >> - marks=3Dpytest.mark.skip("XXX currently failing"), >> id=3D"_3_1_opts_NOP_40", >> ), >> pytest.param( >>=20 >=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org >=20 > e^(i*pi)+1=3D0 It has been submitted under https://reviews.freebsd.org/D39233= --Apple-Mail=_93831C93-95ED-479E-BA26-94F08F218FFC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On Mar 23, 2023, = at 1:05 PM, Cy Schubert <Cy.Schubert@cschubert.com> = wrote:

On Sun, 19 = Mar 2023 16:33:25 GMT
Mark Johnston <markj@FreeBSD.org> = wrote:

The branch main has been updated = by markj:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3D20b41303140eee4dfb896558fb83600c= 5f013d39

commit = 20b41303140eee4dfb896558fb83600c5f013d39
Author: =     Jose Luis Duran = <jlduran@gmail.com>
AuthorDate: 2023-02-09 15:47:53 = +0000
Commit:     Mark Johnston = <markj@FreeBSD.org>
CommitDate: 2023-03-19 16:23:06 = +0000

   ping: Print the IP options of the = original packet

   When an ICMP packet contains = an IP packet in its payload, and that
   original IP = packet contains options, these options were not displayed
=    accordingly in pr_iph().

=    pr_iph() is a function that prints the original = "quoted packet" IP
   header, with only an IP struct = as an argument.  The IP struct does not
=    contain IP options, and it is not guaranteed that the = options will be
   contiguous in memory to the IP = struct after
=    d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52.

=    Pass the raw ICMP data along with the IP struct, in = order to print the
   options, if any.

=    Reviewed by:    markj
=    MFC after:      1 week
=    Differential Revision: =  https://reviews.freebsd.org/D38469
---
sbin/ping/ping.c =             | = 19 ++++++++++---------
sbin/ping/tests/ping_test.sh |  2 +-
= sbin/ping/tests/test_ping.py |  1 -
3 files changed, 11 = insertions(+), 11 deletions(-)

diff --git a/sbin/ping/ping.c = b/sbin/ping/ping.c
index fe319bfb70a5..b1721ad72a5c 100644
--- = a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -225,7 +225,7 @@ = static void pinger(void);
static char *pr_addr(struct in_addr);
= static char *pr_ntime(n_time);
static void pr_icmph(struct icmp *, = struct ip *, const u_char *const);
-static void pr_iph(struct ip = *);
+static void pr_iph(struct ip *, const u_char *);
static void = pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *);
= static void pr_retip(struct ip *, const u_char *);
static void = status(int);
@@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, = struct sockaddr_in *from, struct timespec *tv)
struct ip = oip;
= u_char oip_header_len;
struct icmp oicmp;
- const = u_char *oicmp_raw;

/*
* Get = size of IP header of the received packet.
@@ -1355,8 +1354,6 @@ = pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec = *tv)
= = }

= = memcpy(&oip, icmp_data_raw, sizeof(struct ip));
- oicmp_raw = =3D icmp_data_raw + oip_header_len;
- memcpy(&oicmp, oicmp_raw, = sizeof(struct icmp));

Coverity is complaining about = uninitialized oicmp due to the deletion
of the above two = lines.


if = (((options & F_VERBOSE) && uid =3D=3D 0) ||
=    (!(options & F_QUIET2) &&
@@ -1366,7 = +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, = struct timespec *tv)
=     (oicmp.icmp_id =3D=3D ident))) {
=    (void)printf("%zd bytes from %s: ", cc,
= pr_addr(from->sin_addr));
- =    pr_icmph(&icp, &oip, oicmp_raw);
+ =    pr_icmph(&icp, &oip, icmp_data_raw);
} = else
= =    return;
}
@@ -1663,14 +1660,13 @@ = pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const = oicmp_raw)
 * Print an IP header with = options.
 */
static void
-pr_iph(struct ip = *ip)
+pr_iph(struct ip *ip, const u_char *cp)
{
struct = in_addr ina;
-= u_char *cp;
int hlen;

hlen =3D = ip->ip_hl << 2;
- cp =3D (u_char *)ip + = sizeof(struct ip); /* point to options */
+ cp =3D cp = + sizeof(struct ip); /* point to options */

= = (void)printf("Vr HL TOS  Len   ID Flg  off = TTL Pro  cks      Src =      Dst\n");
(void)printf(" %1x  %1x =  %02x %04x %04x",
@@ -1723,7 +1719,12 @@ pr_addr(struct in_addr = ina)
static void
pr_retip(struct ip *ip, const u_char *cp)
= {
- = pr_iph(ip);
+ int8_t hlen;
+
+ = pr_iph(ip, cp);
+
+ hlen =3D ip->ip_hl << = 2;
+ = cp =3D cp + hlen;

if (ip->ip_p =3D=3D 6)
= = = (void)printf("TCP: from port %u, to port %u (decimal)\n",
diff = --git a/sbin/ping/tests/ping_test.sh = b/sbin/ping/tests/ping_test.sh
index 9f821ed96360..53383f2fb7bc = 100644
--- a/sbin/ping/tests/ping_test.sh
+++ = b/sbin/ping/tests/ping_test.sh
@@ -178,7 +178,7 @@ = inject_pip_head()
}
inject_pip_body()
{
- atf_check = -s exit:2 -o match:"Destination Host Unreachable" -o = not-match:"01010101" python3 $(atf_get_srcdir)/injection.py = pip
+ = atf_check -s exit:2 -o match:"Destination Host Unreachable" -o = match:"(01){40}" python3 $(atf_get_srcdir)/injection.py pip
}
= inject_pip_cleanup()
{
diff --git a/sbin/ping/tests/test_ping.py = b/sbin/ping/tests/test_ping.py
index a9b760ff7aca..79fd332f1c18 = 100644
--- a/sbin/ping/tests/test_ping.py
+++ = b/sbin/ping/tests/test_ping.py
@@ -893,7 +893,6 @@ Vr HL TOS =  Len   ID Flg  off TTL Pro  cks =      Src      Dst
=             &n= bsp;   "stderr": "",
=             &n= bsp;   "redacted": False,
=             },=
- =            marks=3D= pytest.mark.skip("XXX currently failing"),
=             id= =3D"_3_1_opts_NOP_40",
=         ),
=         pytest.param(




--
Cheers,
Cy Schubert = <Cy.Schubert@cschubert.com>
FreeBSD UNIX: =  <cy@FreeBSD.org>   Web: =  https://FreeBSD.org
NTP: =           <cy@nwtime.= org>    Web:  https://nwtime.org

= e^(i*pi)+1=3D0

It has = been submitted under https://reviews.freebsd.org/D3= 9233
= --Apple-Mail=_93831C93-95ED-479E-BA26-94F08F218FFC-- From nobody Thu Mar 23 22:08:15 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjKGl3hGGz40PLB; Thu, 23 Mar 2023 22: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 4PjKGl38Jnz4N3v; Thu, 23 Mar 2023 22:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679609295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s9rdeTVJAEkmUqZpQq7nskDbcFnD1LfG7badwhYNGc0=; b=xi4sTlckx7fotG991sYQ81dyUSg4sd7QdKlf37IWiqorMSGZh8sI1wODB6zYx9hWkpkSJO j44g1sctZ4Z9X6g+OJt4vPJCQZh3SN57ohlYMN50fGmmp5Snuu0HLXaNgxiVyqYi8SWXUz 68VvdTUsJOHpaUBUnSUf9UaUCdOff4imEzcGIQubd3uP/te4z7cK8c5etJ1pCq4lipD33m LTJMj51pIt3kZ1YMqr9+KKZViZisCCpFL+bMIj/g0oG14ynt7VJSyD9QUg3hZKgKzn8nRB EG3/YHj+oSkTY6eF6DRansUggtCBvMlHfmVBMu73rDgM1iCR2EP6D15zjCKQnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679609295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s9rdeTVJAEkmUqZpQq7nskDbcFnD1LfG7badwhYNGc0=; b=DCehk6UiYQ2ThbJ1rGiW73jtfAK0ucI62LfaFyooLV+1IHvDPrcaxnW+bBZQVe3rm+JxtM eLnXzXRerGLgbiMFSS+5up4rPewt/sX3zVcmRgnq0ET6qkG/kEvtTJuqsAChHJunO02nNN xoUY/NyFrL2A7yYxTvPRuQQtWEhyKz+ky8mDZU9HQZnDo9Qq1QlfSpSeZ3yZeXaz0U6U0Q t9kfGS4TMMRONPRKmErTKQa+EYnB6xcwg83neRx4qV4Vrt2duIXe8KPc7RT2vg95m9HFTz Uud3mznkcxcrSS2JC97eKUKcgPCOS6+90mMjZqUKZOyeW08R81UA7bJHFM0zJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679609295; a=rsa-sha256; cv=none; b=bU+hcsCH7U3Hjk/jX9PABQBTISSj0YF5YH65rhfTVp7WJOkUgrIfrmA39KFuPfpihTOdto vaHY6dzppM8u8IKwdq2wZhNypfU18S4bF/Y4mJ3it6hl8cLxVT5MK6TeBs9nZvH+M3+243 ucK0T1FaaCuupvCMm84kQTDrWQJQJxlgw8lFM7SQV9jeSPsbT/prAm3LUpDwjCCZkn1KQG jHwJ/PdFberOfjmO43XYBxavTmeEhxoKBKEbZZnyWzg9UwX3uyVKmgniqhIqaiXd7iEfvQ BmDkSb0SsOBwgl9AqxHRFnsszddsq9QOU5nVnbWPHqkVsThKcG7sELFD2oyB8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjKGl2B6Tzsm5; Thu, 23 Mar 2023 22: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 32NM8FYM036366; Thu, 23 Mar 2023 22: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 32NM8Fnp036365; Thu, 23 Mar 2023 22:08:15 GMT (envelope-from git) Date: Thu, 23 Mar 2023 22:08:15 GMT Message-Id: <202303232208.32NM8Fnp036365@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: 698dbd66fed2 - main - arm64: add a GENERIC-KASAN config List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 698dbd66fed21e0acabf02a07be5080d016efa5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=698dbd66fed21e0acabf02a07be5080d016efa5c commit 698dbd66fed21e0acabf02a07be5080d016efa5c Author: Mitchell Horne AuthorDate: 2023-03-23 21:26:06 +0000 Commit: Kyle Evans CommitDate: 2023-03-23 21:34:33 +0000 arm64: add a GENERIC-KASAN config Reviewed by: andrew, markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D36702 --- sys/arm64/conf/GENERIC-KASAN | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/arm64/conf/GENERIC-KASAN b/sys/arm64/conf/GENERIC-KASAN new file mode 100644 index 000000000000..232e8cb27fcd --- /dev/null +++ b/sys/arm64/conf/GENERIC-KASAN @@ -0,0 +1,5 @@ +include GENERIC + +ident GENERIC-KASAN + +options KASAN From nobody Thu Mar 23 22:08:16 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjKGm4KS7z40PWK; Thu, 23 Mar 2023 22:08: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 4PjKGm3mxnz4N4R; Thu, 23 Mar 2023 22:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679609296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wKdc3fTs7YUGztcPNh4dUOqwd2Lbp/JCyYqJ1IOm/Ps=; b=oxji5CCsIGom5kHgQtOg4DJxhEZHrmvkvVGRNz33UOvRMGLzA5SUNn0p6N+s035ubxNzkd GfJeD3q6jyuAmuyzTIxO67dwcdYuvy9LjZ0n4FkTIXgXUY1bbNY9kMLlL6FUHUpFgOQRS/ dm9TotKatcSrVzES5WoWxYd7/PyX8NRrecIaWo/1xs5ccMdzX08YcE3+2AGGTJLaLLkeYC JW+bTo8Ul8ZHJ6yuMnrRST9HNDWF2nlJR3Wz72Wz2Pr0IVPvX9Dj2OkJMN53vi6pioEK40 N8kWug3Qg/dCqEpOjn0+0MAL9v6DKQi7NNq91L5LGT/vhzLhaZLwfmAOZ698dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679609296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wKdc3fTs7YUGztcPNh4dUOqwd2Lbp/JCyYqJ1IOm/Ps=; b=dZm1akW4a6qAFC6Z1Spcp+VueszE6za4n1neeO8CuLBOFSDD8ToOk8MJZjB/nTP/82f/xq oaz90visVNVrd6HdsDpUAOMiHBh4TjM/MzffqTA38Ht7zItXwAh3TWrDEWWtN9x2zK2GzZ /gtq+XEZebMK2V3/DwUXxWMpwT3eOi8sILDrPwAQa5i2sa0Yn/WscU1wG0AWPMbQuwSC/n udLYBkQ7NDtSdjtsuSDjuvvsJGM65vzaJo0xHhUKv/UiFwHx/P9i9IHv4C7DYCCamJVhnC egDWApcOU93VNbtKpeW3kPxPiBxhJY9Vw6okaammWrbAsNrfd3Bn4WIIzYwqyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679609296; a=rsa-sha256; cv=none; b=puXudyTJ/K3o9/IT8+n3C8F5nZUdvUiQ/I5rJLtTPpBciBGSeYlH/KJavXWQ2zIzPBbSz6 RGUwL500SRVouUPgWKOoUWinJgfIZtB3dzhsm+ThGsJIZDw9rz6vdhYdSIkwdRBPAhG6La 42I6updf6Qt9IgTxThb+1mLnTEVhjzCRgQkGHtAldJ0Xxzp8NZ+x2bv6QiwpIaqpHHl5hl kSDWOBioA005+g4TpcduGrn2SgoNUL5y8dpnscrHSCbulyab47z1HnBWW79kKYAQO1R2It DDS0rmvCaQwSnOlz9hwX2+ThgbmucaS1g1D2YtHdhtbQ6E9hp/DUmWoW6mtJgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjKGm2tHmzsm6; Thu, 23 Mar 2023 22: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 32NM8GVV036385; Thu, 23 Mar 2023 22: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 32NM8Gbu036384; Thu, 23 Mar 2023 22:08:16 GMT (envelope-from git) Date: Thu, 23 Mar 2023 22:08:16 GMT Message-Id: <202303232208.32NM8Gbu036384@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: 89c52f9d59fa - main - arm64: add KASAN support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89c52f9d59fa796cc6cce44d34c93ec802abb15a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=89c52f9d59fa796cc6cce44d34c93ec802abb15a commit 89c52f9d59fa796cc6cce44d34c93ec802abb15a Author: Kyle Evans AuthorDate: 2023-03-23 21:26:06 +0000 Commit: Kyle Evans CommitDate: 2023-03-23 21:34:33 +0000 arm64: add KASAN support This entails: - Marking some obvious candidates for __nosanitizeaddress - Similar trap frame markings as amd64, for similar reasons - Shadow map implementation The shadow map implementation is roughly similar to what was done on amd64, with some exceptions. Attempting to use available space at preinit_map_va + PMAP_PREINIT_MAPPING_SIZE (up to the end of that range, as depicted in the physmap) results in odd failures, so we instead search the physmap for free regions that we can carve out, fragmenting the shadow map as necessary to try and fit as much as we need for the initial kernel map. pmap_bootstrap_san() is thus after pmap_bootstrap(), which still included some technically reserved areas of the memory map that needed to be included in the DMAP. The odd failure noted above may be a bug, but I haven't investigated it all that much. Initial work by mhorne with additional fixes from kevans and markj. Reviewed by: andrew, markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D36701 --- sys/arm64/arm64/db_trace.c | 6 +- sys/arm64/arm64/locore.S | 11 ++ sys/arm64/arm64/machdep.c | 14 +++ sys/arm64/arm64/pmap.c | 266 ++++++++++++++++++++++++++++++++++++++++++++ sys/arm64/arm64/trap.c | 5 + sys/arm64/include/asan.h | 68 +++++++++++ sys/arm64/include/atomic.h | 5 +- sys/arm64/include/param.h | 4 + sys/arm64/include/pmap.h | 8 ++ sys/arm64/include/vmparam.h | 11 +- sys/conf/files.arm64 | 3 +- sys/conf/kern.pre.mk | 11 ++ sys/kern/subr_intr.c | 3 + 13 files changed, 409 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 42230f273716..612cea5f41cf 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -56,7 +56,7 @@ db_md_list_watchpoints(void) dbg_show_watchpoint(); } -static void +static void __nosanitizeaddress db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) { c_db_sym_t sym; @@ -135,7 +135,7 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) } } -int +int __nosanitizeaddress db_trace_thread(struct thread *thr, int count) { struct unwind_state frame; @@ -152,7 +152,7 @@ db_trace_thread(struct thread *thr, int count) return (0); } -void +void __nosanitizeaddress db_trace_self(void) { struct unwind_state frame; diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 1080ebc6217e..a73941a01492 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -148,6 +148,17 @@ virtdone: str x23, [x0, #BP_BOOT_EL] str x4, [x0, #BP_HCR_EL2] +#ifdef KASAN + /* Save bootparams */ + mov x19, x0 + + /* Bootstrap an early shadow map for the boot stack. */ + bl pmap_san_bootstrap + + /* Restore bootparams */ + mov x0, x19 +#endif + /* trace back starts here */ mov fp, #0 /* Branch to C code */ diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 31e7568a0605..b87c635048de 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -955,6 +956,18 @@ initarm(struct arm64_bootparams *abp) /* Do the same for reserve entries in the EFI MEMRESERVE table */ if (efi_systbl_phys != 0) exclude_efi_memreserve(efi_systbl_phys); + + /* + * We carefully bootstrap the sanitizer map after we've excluded + * absolutely everything else that could impact phys_avail. There's not + * always enough room for the initial shadow map after the kernel, so + * we'll end up searching for segments that we can safely use. Those + * segments also get excluded from phys_avail. + */ +#if defined(KASAN) + pmap_bootstrap_san(KERNBASE - abp->kern_delta); +#endif + physmem_init_kernel_globals(); devmap_bootstrap(0, NULL); @@ -998,6 +1011,7 @@ initarm(struct arm64_bootparams *abp) pan_enable(); kcsan_cpu_init(0); + kasan_init(); env = kern_getenv("kernelname"); if (env != NULL) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 17abce473c17..b62673f999e6 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -108,6 +108,7 @@ __FBSDID("$FreeBSD$"); #include "opt_vm.h" #include +#include #include #include #include @@ -146,6 +147,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -190,6 +192,9 @@ __FBSDID("$FreeBSD$"); #define pmap_l1_pindex(v) (NUL2E + ((v) >> L1_SHIFT)) #define pmap_l2_pindex(v) ((v) >> L2_SHIFT) +#define PMAP_SAN_PTE_BITS (ATTR_DEFAULT | ATTR_S1_XN | \ + ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK) | ATTR_S1_AP(ATTR_S1_AP_RW)) + struct pmap_large_md_page { struct rwlock pv_lock; struct md_page pv_page; @@ -1211,6 +1216,54 @@ pmap_bootstrap_l3(vm_offset_t va) pmap_bootstrap_l2_table(&bs_state); } +#ifdef KASAN +static void +pmap_bootstrap_allocate_kasan_l2(vm_paddr_t start_pa, vm_paddr_t end_pa, + vm_offset_t *start_va, int *nkasan_l2) +{ + int i; + vm_paddr_t pa; + vm_offset_t va; + pd_entry_t *l2; + + va = *start_va; + pa = rounddown2(end_pa - L2_SIZE, L2_SIZE); + l2 = pmap_l2(kernel_pmap, va); + + for (i = 0; pa >= start_pa && i < *nkasan_l2; + i++, va += L2_SIZE, pa -= L2_SIZE, l2++) { + /* + * KASAN stack checking results in us having already allocated + * part of our shadow map, so we can just skip those segments. + */ + if ((pmap_load(l2) & ATTR_DESCR_VALID) != 0) { + pa += L2_SIZE; + continue; + } + + pmap_store(l2, (pa & ~Ln_TABLE_MASK) | PMAP_SAN_PTE_BITS | + L2_BLOCK); + } + + /* + * Ended the allocation due to start_pa constraint, rather than because + * we allocated everything. Adjust back up to the start_pa and remove + * the invalid L2 block from our accounting. + */ + if (pa < start_pa) { + va += L2_SIZE; + i--; + pa = start_pa; + } + + bzero((void *)PHYS_TO_DMAP(pa), i * L2_SIZE); + physmem_exclude_region(pa, i * L2_SIZE, EXFLAG_NOALLOC); + + *nkasan_l2 -= i; + *start_va = va; +} +#endif + /* * Bootstrap the system enough to run with virtual memory. */ @@ -1312,6 +1365,68 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) cpu_tlb_flushID(); } +#if defined(KASAN) +/* + * Finish constructing the initial shadow map: + * - Count how many pages from KERNBASE to virtual_avail (scaled for + * shadow map) + * - Map that entire range using L2 superpages. + */ +void +pmap_bootstrap_san(vm_paddr_t kernstart) +{ + vm_offset_t va; + int i, shadow_npages, nkasan_l2; + + /* + * Rebuild physmap one more time, we may have excluded more regions from + * allocation since pmap_bootstrap(). + */ + bzero(physmap, sizeof(physmap)); + physmap_idx = physmem_avail(physmap, nitems(physmap)); + physmap_idx /= 2; + + shadow_npages = (virtual_avail - VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE; + shadow_npages = howmany(shadow_npages, KASAN_SHADOW_SCALE); + nkasan_l2 = howmany(shadow_npages, Ln_ENTRIES); + + /* Map the valid KVA up to this point. */ + va = KASAN_MIN_ADDRESS; + + /* + * Find a slot in the physmap large enough for what we needed. We try to put + * the shadow map as high up as we can to avoid depleting the lower 4GB in case + * it's needed for, e.g., an xhci controller that can only do 32-bit DMA. + */ + for (i = (physmap_idx * 2) - 2; i >= 0 && nkasan_l2 > 0; i -= 2) { + vm_paddr_t plow, phigh; + + /* L2 mappings must be backed by memory that is L2-aligned */ + plow = roundup2(physmap[i], L2_SIZE); + phigh = physmap[i + 1]; + if (plow >= phigh) + continue; + if (kernstart >= plow && kernstart < phigh) + phigh = kernstart; + if (phigh - plow >= L2_SIZE) + pmap_bootstrap_allocate_kasan_l2(plow, phigh, &va, + &nkasan_l2); + } + + if (nkasan_l2 != 0) + panic("Could not find phys region for shadow map"); + + /* + * Done. We should now have a valid shadow address mapped for all KVA + * that has been mapped so far, i.e., KERNBASE to virtual_avail. Thus, + * shadow accesses by the kasan(9) runtime will succeed for this range. + * When the kernel virtual address range is later expanded, as will + * happen in vm_mem_init(), the shadow map will be grown as well. This + * is handled by pmap_san_enter(). + */ +} +#endif + /* * Initialize a vm_page's machine-dependent fields. */ @@ -2580,6 +2695,8 @@ pmap_growkernel(vm_offset_t addr) addr = roundup2(addr, L2_SIZE); if (addr - 1 >= vm_map_max(kernel_map)) addr = vm_map_max(kernel_map); + if (kernel_vm_end < addr) + kasan_shadow_map(kernel_vm_end, addr - kernel_vm_end); while (kernel_vm_end < addr) { l0 = pmap_l0(kernel_pmap, kernel_vm_end); KASSERT(pmap_load(l0) != 0, @@ -7556,6 +7673,151 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr_t mode) return (mode >= VM_MEMATTR_DEVICE && mode <= VM_MEMATTR_WRITE_THROUGH); } +#if defined(KASAN) +static vm_paddr_t pmap_san_early_kernstart; +static pd_entry_t *pmap_san_early_l2; + +void __nosanitizeaddress +pmap_san_bootstrap(struct arm64_bootparams *abp) +{ + + pmap_san_early_kernstart = KERNBASE - abp->kern_delta; + kasan_init_early(abp->kern_stack, KSTACK_PAGES * PAGE_SIZE); +} + +#define SAN_BOOTSTRAP_L2_SIZE (1 * L2_SIZE) +#define SAN_BOOTSTRAP_SIZE (2 * PAGE_SIZE) +static vm_offset_t __nosanitizeaddress +pmap_san_enter_bootstrap_alloc_l2(void) +{ + static uint8_t bootstrap_data[SAN_BOOTSTRAP_L2_SIZE] __aligned(L2_SIZE); + static size_t offset = 0; + vm_offset_t addr; + + if (offset + L2_SIZE > sizeof(bootstrap_data)) { + panic("%s: out of memory for the bootstrap shadow map L2 entries", + __func__); + } + + addr = (uintptr_t)&bootstrap_data[offset]; + offset += L2_SIZE; + return (addr); +} + +/* + * SAN L1 + L2 pages, maybe L3 entries later? + */ +static vm_offset_t __nosanitizeaddress +pmap_san_enter_bootstrap_alloc_pages(int npages) +{ + static uint8_t bootstrap_data[SAN_BOOTSTRAP_SIZE] __aligned(PAGE_SIZE); + static size_t offset = 0; + vm_offset_t addr; + + if (offset + (npages * PAGE_SIZE) > sizeof(bootstrap_data)) { + panic("%s: out of memory for the bootstrap shadow map", + __func__); + } + + addr = (uintptr_t)&bootstrap_data[offset]; + offset += (npages * PAGE_SIZE); + return (addr); +} + +static void __nosanitizeaddress +pmap_san_enter_bootstrap(void) +{ + vm_offset_t freemempos; + + /* L1, L2 */ + freemempos = pmap_san_enter_bootstrap_alloc_pages(2); + bs_state.freemempos = freemempos; + bs_state.va = KASAN_MIN_ADDRESS; + pmap_bootstrap_l1_table(&bs_state); + pmap_san_early_l2 = bs_state.l2; +} + +static vm_page_t +pmap_san_enter_alloc_l3(void) +{ + vm_page_t m; + + 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__); + return (m); +} + +static vm_page_t +pmap_san_enter_alloc_l2(void) +{ + return (vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, + Ln_ENTRIES, 0, ~0ul, L2_SIZE, 0, VM_MEMATTR_DEFAULT)); +} + +void __nosanitizeaddress +pmap_san_enter(vm_offset_t va) +{ + pd_entry_t *l1, *l2; + pt_entry_t *l3; + vm_page_t m; + + if (virtual_avail == 0) { + vm_offset_t block; + int slot; + bool first; + + /* Temporary shadow map prior to pmap_bootstrap(). */ + first = pmap_san_early_l2 == NULL; + if (first) + pmap_san_enter_bootstrap(); + + l2 = pmap_san_early_l2; + slot = pmap_l2_index(va); + + if ((pmap_load(&l2[slot]) & ATTR_DESCR_VALID) == 0) { + MPASS(first); + block = pmap_san_enter_bootstrap_alloc_l2(); + pmap_store(&l2[slot], pmap_early_vtophys(block) | + PMAP_SAN_PTE_BITS | L2_BLOCK); + dmb(ishst); + } + + return; + } + + mtx_assert(&kernel_map->system_mtx, MA_OWNED); + l1 = pmap_l1(kernel_pmap, va); + MPASS(l1 != NULL); + if ((pmap_load(l1) & ATTR_DESCR_VALID) == 0) { + m = pmap_san_enter_alloc_l3(); + pmap_store(l1, (VM_PAGE_TO_PHYS(m) & ~Ln_TABLE_MASK) | + L1_TABLE); + } + l2 = pmap_l1_to_l2(l1, va); + if ((pmap_load(l2) & ATTR_DESCR_VALID) == 0) { + m = pmap_san_enter_alloc_l2(); + if (m != NULL) { + pmap_store(l2, VM_PAGE_TO_PHYS(m) | PMAP_SAN_PTE_BITS | + L2_BLOCK); + } else { + m = pmap_san_enter_alloc_l3(); + pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); + } + dmb(ishst); + } + if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK) + return; + l3 = pmap_l2_to_l3(l2, va); + if ((pmap_load(l3) & ATTR_DESCR_VALID) != 0) + return; + m = pmap_san_enter_alloc_l3(); + pmap_store(l3, VM_PAGE_TO_PHYS(m) | PMAP_SAN_PTE_BITS | L3_PAGE); + dmb(ishst); +} +#endif /* KASAN */ + /* * Track a range of the kernel's virtual address space that is contiguous * in various mapping attributes. @@ -7724,6 +7986,10 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "\nDirect map:\n"); else if (i == pmap_l0_index(VM_MIN_KERNEL_ADDRESS)) sbuf_printf(sb, "\nKernel map:\n"); +#ifdef KASAN + else if (i == pmap_l0_index(KASAN_MIN_ADDRESS)) + sbuf_printf(sb, "\nKASAN shadow map:\n"); +#endif l0e = kernel_pmap->pm_l0[i]; if ((l0e & ATTR_DESCR_VALID) == 0) { diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 1b7d945ff115..367a31cbe1de 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -465,6 +466,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) uint64_t esr, far; int dfsc; + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); far = frame->tf_far; /* Read the esr register to get the exception details */ esr = frame->tf_esr; @@ -571,6 +573,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame) ("Invalid pcpu address from userland: %p (tpidr %lx)", get_pcpu(), READ_SPECIALREG(tpidr_el1))); + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); far = frame->tf_far; esr = frame->tf_esr; exception = ESR_ELx_EXCEPTION(esr); @@ -712,6 +715,7 @@ do_serror(struct trapframe *frame) { uint64_t esr, far; + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); far = frame->tf_far; esr = frame->tf_esr; @@ -726,6 +730,7 @@ unhandled_exception(struct trapframe *frame) { uint64_t esr, far; + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); far = frame->tf_far; esr = frame->tf_esr; diff --git a/sys/arm64/include/asan.h b/sys/arm64/include/asan.h new file mode 100644 index 000000000000..3bea6847a297 --- /dev/null +++ b/sys/arm64/include/asan.h @@ -0,0 +1,68 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed 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 are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _MACHINE_ASAN_H_ +#define _MACHINE_ASAN_H_ + +#ifdef KASAN + +#include +#include +#include +#include + +static inline vm_offset_t +kasan_md_addr_to_shad(vm_offset_t addr) +{ + return (((addr - VM_MIN_KERNEL_ADDRESS) >> KASAN_SHADOW_SCALE_SHIFT) + + KASAN_MIN_ADDRESS); +} + +static inline bool +kasan_md_unsupported(vm_offset_t addr) +{ + return (addr < VM_MIN_KERNEL_ADDRESS || addr >= virtual_end); +} + +static inline void +kasan_md_init(void) +{ + +} + +static inline void +kasan_md_init_early(vm_offset_t bootstack, size_t size) +{ + + kasan_shadow_map(bootstack, size); +} + +#endif /* KASAN */ +#endif /* !_MACHINE_ASAN_H_ */ diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 0c750f00379c..b14cd303da3a 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -53,6 +53,10 @@ #define wmb() dmb(st) /* Full system memory barrier store */ #define rmb() dmb(ld) /* Full system memory barrier load */ +#ifdef _KERNEL +extern _Bool lse_supported; +#endif + #if defined(SAN_NEEDS_INTERCEPTORS) && !defined(SAN_RUNTIME) #include #else @@ -60,7 +64,6 @@ #include #ifdef _KERNEL -extern bool lse_supported; #ifdef LSE_ATOMICS #define _ATOMIC_LSE_SUPPORTED 1 diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h index d34667788938..c94b797f8cca 100644 --- a/sys/arm64/include/param.h +++ b/sys/arm64/include/param.h @@ -99,8 +99,12 @@ #define MAXPAGESIZES 3 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES +#if defined(KASAN) || defined(KMSAN) +#define KSTACK_PAGES 6 +#else #define KSTACK_PAGES 4 /* pages of kernel stack (with pcb) */ #endif +#endif #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ #define PCPU_PAGES 1 diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index eb72f46668c3..2847fa8dd439 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -183,6 +183,14 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) return (0); } +#if defined(KASAN) || defined(KMSAN) +struct arm64_bootparams; + +void pmap_bootstrap_san(vm_paddr_t); +void pmap_san_enter(vm_offset_t); +void pmap_san_bootstrap(struct arm64_bootparams *); +#endif + #endif /* _KERNEL */ #endif /* !LOCORE */ diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index e3f48e61b78c..b28a79256453 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -125,7 +125,10 @@ * Upper region: 0xffffffffffffffff Top of virtual memory * * 0xfffffeffffffffff End of DMAP - * 0xfffffa0000000000 Start of DMAP + * 0xffffa00000000000 Start of DMAP + * + * 0xffff009fffffffff End of KASAN shadow map + * 0xffff008000000000 Start of KASAN shadow map * * 0xffff007fffffffff End of KVA * 0xffff000000000000 Kernel base address & start of KVA @@ -156,6 +159,10 @@ #define VM_MIN_KERNEL_ADDRESS (0xffff000000000000UL) #define VM_MAX_KERNEL_ADDRESS (0xffff008000000000UL) +/* 128 GiB KASAN shadow map */ +#define KASAN_MIN_ADDRESS (0xffff008000000000UL) +#define KASAN_MAX_ADDRESS (0xffff00a000000000UL) + /* The address bits that hold a pointer authentication code */ #define PAC_ADDR_MASK (0xff7f000000000000UL) @@ -239,7 +246,9 @@ #define VM_INITIAL_PAGEIN 16 #endif +#if !defined(KASAN) && !defined(KMSAN) #define UMA_MD_SMALL_ALLOC +#endif #ifndef LOCORE diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 22dd267b2b42..da63564eba7e 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -80,7 +80,8 @@ arm64/arm64/trap.c standard arm64/arm64/uio_machdep.c standard arm64/arm64/uma_machdep.c standard arm64/arm64/undefined.c standard -arm64/arm64/unwind.c optional ddb | kdtrace_hooks | stack +arm64/arm64/unwind.c optional ddb | kdtrace_hooks | stack \ + compile-with "${NORMAL_C:N-fsanitize*}" arm64/arm64/vfp.c standard arm64/arm64/vm_machdep.c standard diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index ec5c1d331533..e401a652bf97 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -102,6 +102,17 @@ SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kasan \ -mllvm -asan-use-after-scope=true \ -mllvm -asan-instrumentation-with-call-threshold=0 \ -mllvm -asan-instrument-byval=false + +.if ${MACHINE_CPUARCH} == "aarch64" +# KASAN/ARM64 TODO: -asan-mapping-offset is calculated from: +# (VM_KERNEL_MIN_ADDRESS >> KASAN_SHADOW_SCALE_SHIFT) + $offset = KASAN_MIN_ADDRESS +# +# This is different than amd64, where we have a different +# KASAN_MIN_ADDRESS, and this offset value should eventually be +# upstreamed similar to: https://reviews.llvm.org/D98285 +# +SAN_CFLAGS+= -mllvm -asan-mapping-offset=0xdfff208000000000 +.endif .endif KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index a95d2adbed04..cbacdf677ee6 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -345,6 +346,8 @@ intr_irq_handler(struct trapframe *tf) KASSERT(irq_root_filter != NULL, ("%s: no filter", __func__)); + kasan_mark(tf, sizeof(*tf), sizeof(*tf), 0); + VM_CNT_INC(v_intr); critical_enter(); td = curthread; From nobody Thu Mar 23 22:12:03 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjKMD1cXqz40Pv7; Thu, 23 Mar 2023 22:12:08 +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 4PjKMC6bdvz4NpQ; Thu, 23 Mar 2023 22:12:07 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id fPnIpYmikuZMSfTAEpNl0g; Thu, 23 Mar 2023 22:12:06 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id fTACpvzk7cyvufTADpMqDC; Thu, 23 Mar 2023 22:12:06 +0000 X-Authority-Analysis: v=2.4 cv=VbHkgXl9 c=1 sm=1 tr=0 ts=641cceb6 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=k__wU0fu6RkA:10 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=BgOcHarDN3n17w1KK4kA:9 a=QEXdDO2ut3YA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 6BE852549; Thu, 23 Mar 2023 15:12:04 -0700 (PDT) Received: from slippy (localhost [IPv6:::1]) by slippy.cwsent.com (Postfix) with ESMTP id 36759842; Thu, 23 Mar 2023 15:12:04 -0700 (PDT) Date: Thu, 23 Mar 2023 15:12:03 -0700 From: Cy Schubert To: =?ISO-8859-1?Q?Jos=E9?= Luis =?ISO-8859-1?Q?Dur=E1n?= Cc: Mark Johnston , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 20b41303140e - main - ping: Print the IP options of the original packet Message-ID: <20230323151203.20f31a9f@slippy> In-Reply-To: <8FFC2AAC-A06E-4791-9C33-AF0D3A26529F@gmail.com> References: <202303191633.32JGXPov003163@gitrepo.freebsd.org> <20230323090520.30554030@slippy> <8FFC2AAC-A06E-4791-9C33-AF0D3A26529F@gmail.com> Organization: KOMQUATS X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-CMAE-Envelope: MS4xfA84GHqgtH9mgAJYWm61p+q+eSqT2laGQio4ZFnRflCjKzzPWrU3haQHADt1/jcLbVtfoR5zIHwdfegcCqZZHlJunMpZkHWRQMy4NGXfZRtYQ+AFwxJG t1abcX+KUxV6iLUX9b5lVltekDHQf+s1mfWvAA6EbWEK7VC3vCZi2pXLNcyKPuGsg2/dh8UbE8hyRoEbhAq0+KhE7yrtivLWIXYxSWFOVQxq4sw9w9xjxz2g uViuxUAH3OhbYiFMZhgENCgYVf0bMBZYKi3M68IyhAUQmxLt74/VJqh112+21z5uelYxdiBofnn69KhW6M7Wnwl8Cp4sAM430GBJc01CYDBpF0m7B1WvdgGO bN4TLafg X-Rspamd-Queue-Id: 4PjKMC6bdvz4NpQ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Thu, 23 Mar 2023 18:59:45 -0300 Jos=C3=A9 Luis Dur=C3=A1n wrote: > > On Mar 23, 2023, at 1:05 PM, Cy Schubert wr= ote: > >=20 > > On Sun, 19 Mar 2023 16:33:25 GMT > > Mark Johnston wrote: > > =20 > >> The branch main has been updated by markj: > >>=20 > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D20b41303140eee4dfb89655= 8fb83600c5f013d39 > >>=20 > >> commit 20b41303140eee4dfb896558fb83600c5f013d39 > >> Author: Jose Luis Duran > >> AuthorDate: 2023-02-09 15:47:53 +0000 > >> Commit: Mark Johnston > >> CommitDate: 2023-03-19 16:23:06 +0000 > >>=20 > >> ping: Print the IP options of the original packet > >>=20 > >> When an ICMP packet contains an IP packet in its payload, and that > >> original IP packet contains options, these options were not display= ed > >> accordingly in pr_iph(). > >>=20 > >> pr_iph() is a function that prints the original "quoted packet" IP > >> header, with only an IP struct as an argument. The IP struct does = not > >> contain IP options, and it is not guaranteed that the options will = be > >> contiguous in memory to the IP struct after > >> d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52. > >>=20 > >> Pass the raw ICMP data along with the IP struct, in order to print = the > >> options, if any. > >>=20 > >> Reviewed by: markj > >> MFC after: 1 week > >> Differential Revision: https://reviews.freebsd.org/D38469 > >> --- > >> sbin/ping/ping.c | 19 ++++++++++--------- > >> sbin/ping/tests/ping_test.sh | 2 +- > >> sbin/ping/tests/test_ping.py | 1 - > >> 3 files changed, 11 insertions(+), 11 deletions(-) > >>=20 > >> diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c > >> index fe319bfb70a5..b1721ad72a5c 100644 > >> --- a/sbin/ping/ping.c > >> +++ b/sbin/ping/ping.c > >> @@ -225,7 +225,7 @@ static void pinger(void); > >> static char *pr_addr(struct in_addr); > >> static char *pr_ntime(n_time); > >> static void pr_icmph(struct icmp *, struct ip *, const u_char *const); > >> -static void pr_iph(struct ip *); > >> +static void pr_iph(struct ip *, const u_char *); > >> static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct time= spec *); > >> static void pr_retip(struct ip *, const u_char *); > >> static void status(int); > >> @@ -1157,7 +1157,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_i= n *from, struct timespec *tv) > >> struct ip oip; > >> u_char oip_header_len; > >> struct icmp oicmp; > >> - const u_char *oicmp_raw; > >>=20 > >> /* > >> * Get size of IP header of the received packet. > >> @@ -1355,8 +1354,6 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_i= n *from, struct timespec *tv) > >> } > >>=20 > >> memcpy(&oip, icmp_data_raw, sizeof(struct ip)); > >> - oicmp_raw =3D icmp_data_raw + oip_header_len; > >> - memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); =20 > >=20 > > Coverity is complaining about uninitialized oicmp due to the deletion > > of the above two lines. > > =20 > >>=20 > >> if (((options & F_VERBOSE) && uid =3D=3D 0) || > >> (!(options & F_QUIET2) && > >> @@ -1366,7 +1363,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_i= n *from, struct timespec *tv) > >> (oicmp.icmp_id =3D=3D ident))) { > >> (void)printf("%zd bytes from %s: ", cc, > >> pr_addr(from->sin_addr)); > >> - pr_icmph(&icp, &oip, oicmp_raw); > >> + pr_icmph(&icp, &oip, icmp_data_raw); > >> } else > >> return; > >> } > >> @@ -1663,14 +1660,13 @@ pr_icmph(struct icmp *icp, struct ip *oip, con= st u_char *const oicmp_raw) > >> * Print an IP header with options. > >> */ > >> static void > >> -pr_iph(struct ip *ip) > >> +pr_iph(struct ip *ip, const u_char *cp) > >> { > >> struct in_addr ina; > >> - u_char *cp; > >> int hlen; > >>=20 > >> hlen =3D ip->ip_hl << 2; > >> - cp =3D (u_char *)ip + sizeof(struct ip); /* point to options */ > >> + cp =3D cp + sizeof(struct ip); /* point to options */ > >>=20 > >> (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src = Dst\n"); > >> (void)printf(" %1x %1x %02x %04x %04x", > >> @@ -1723,7 +1719,12 @@ pr_addr(struct in_addr ina) > >> static void > >> pr_retip(struct ip *ip, const u_char *cp) > >> { > >> - pr_iph(ip); > >> + int8_t hlen; > >> + > >> + pr_iph(ip, cp); > >> + > >> + hlen =3D ip->ip_hl << 2; > >> + cp =3D cp + hlen; > >>=20 > >> if (ip->ip_p =3D=3D 6) > >> (void)printf("TCP: from port %u, to port %u (decimal)\n", > >> diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.= sh > >> index 9f821ed96360..53383f2fb7bc 100644 > >> --- a/sbin/ping/tests/ping_test.sh > >> +++ b/sbin/ping/tests/ping_test.sh > >> @@ -178,7 +178,7 @@ inject_pip_head() > >> } > >> inject_pip_body() > >> { > >> - atf_check -s exit:2 -o match:"Destination Host Unreachable" -o not-m= atch:"01010101" python3 $(atf_get_srcdir)/injection.py pip > >> + atf_check -s exit:2 -o match:"Destination Host Unreachable" -o match= :"(01){40}" python3 $(atf_get_srcdir)/injection.py pip > >> } > >> inject_pip_cleanup() > >> { > >> diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.= py > >> index a9b760ff7aca..79fd332f1c18 100644 > >> --- a/sbin/ping/tests/test_ping.py > >> +++ b/sbin/ping/tests/test_ping.py > >> @@ -893,7 +893,6 @@ Vr HL TOS Len ID Flg off TTL Pro cks Src= Dst > >> "stderr": "", > >> "redacted": False, > >> }, > >> - marks=3Dpytest.mark.skip("XXX currently failing"), > >> id=3D"_3_1_opts_NOP_40", > >> ), > >> pytest.param( > >> =20 > >=20 > >=20 > >=20 > > --=20 > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: https://FreeBSD.org > > NTP: Web: https://nwtime.org > >=20 > > e^(i*pi)+1=3D0 =20 >=20 > It has been submitted under https://reviews.freebsd.org/D39233 Thanks. I got the email from phabricator and left a commment. --=20 Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=3D0 From nobody Thu Mar 23 23:51:40 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjMZ515tQz40VrC; Thu, 23 Mar 2023 23:51: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 4PjMZ50bcRz3GVn; Thu, 23 Mar 2023 23:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679615501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jY+W7nay6aSihpHuiZ8d/QB475R3rhk6Ufhl1pNMdnA=; b=lpN+JTybuYj9ftklXSQm0UM15FP52fCzsRrg9ppFz6ZLfhlDVoteFRfbWZZ61qWKDrwWLS 0AJblFajO1kiVp2uBqGb/utVzrjsYPaq2VbpZPzKad2diH31O2vsvfNZsDbAkNmFkLb8EI a095lAi7ut6wkmGRwzvRnkKqjFu9pd0xaAbCgS+i7vOBBW0/x7DT3ljfmgHjfiNx0iZTNG Wppu82a+V0VTT18dXnhjOL3bv8hzmJpsCWOAbNwAdlhtopW3FQMDfHh/mJhCN4mTbvup2T yyrA/nZem19wH1f8FGEHiv6L5ou85vZfJrypkHdZ/wj/Utac5e5RBFi0EatePA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679615501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jY+W7nay6aSihpHuiZ8d/QB475R3rhk6Ufhl1pNMdnA=; b=CHxmDWe5A/+faiAYyX1LMLMKHoSWmWHsnvUdgtOfErcgMhJWo/3pjwApQpONlisccy0TI5 wTW0gzG9YNOJkSZzsUS10TmU+xqKV3Rns1ChyFBsyJQ/6wdzzUdadX4PPMw+zMCOLGemHl Sj+xV9zl7U/ztECQ+w46inn/f0uvM0cZdBX53Eg0+QgwG9UP4h9icaOKk8iFeNEygNeCnC NWU6Z3MdW980L7BJVvgKNkcUKKtefZSPJwTaLKX2bMzghztv0d7VX5bSS0VMt5wsH9r3wg WVmFtp928+I9MauKWLK3DUDoNBDVRNvsofRdv0OsaQWIWME/ZWt0G9E90Dntvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679615501; a=rsa-sha256; cv=none; b=Z207TyTxncWYBump7dB/gdJK2iv5D84u2EoqvrIZmQ3thpyCVGXRJb9t0q7pP9DNcCjFDg p2KUwSOT1GshqYsaLZFtPdgYdlEYt2uVyCR5L1myBpUri8wwGmNQC4lhkRa11He8KTO9G+ dscKfCvtG8Z+ztdIqGxgOul4//WZdv8EKAFPG/woDYdjydis5Uji5w0uNdNzjACLnoT3hv ghom0bg5QAaQ8jlT9Rc6gXgFy3z+edd57HtvA4QbKIvJXKPKd2uv9Qn//PIWKuAq8Y2rpx V4pmcTNycVC1bKTm3teHfdjWLY/wc985U3h8PZcyg7yHYsXHKUaneuTakeYvvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjMZ46mgZzvlX; Thu, 23 Mar 2023 23:51: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 32NNpexw012709; Thu, 23 Mar 2023 23:51:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NNpeF9012707; Thu, 23 Mar 2023 23:51:40 GMT (envelope-from git) Date: Thu, 23 Mar 2023 23:51:40 GMT Message-Id: <202303232351.32NNpeF9012707@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: bfb202c4554a - main - WPA: driver_bsd.c: backout upstream IFF_ change and add logging List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfb202c4554a72383202a1a401d80721935b8c95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bfb202c4554a72383202a1a401d80721935b8c95 commit bfb202c4554a72383202a1a401d80721935b8c95 Author: Bjoern A. Zeeb AuthorDate: 2023-03-23 22:37:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-03-23 23:51:24 +0000 WPA: driver_bsd.c: backout upstream IFF_ change and add logging This reverts the state to our old supplicant logic setting or clearing IFF_UP if needed. In addition this adds logging for the cases in which we do (not) change the interface state. Depending on testing this seems to help bringing WiFi up or not log any needed changes (which would be the expected wpa_supplicant logic now). People should look out for ``(changed)`` log entries (at least if debugging the issue; this way we will at least have data points). There is a hypothesis still pondered that the entire IFF_UP toggling only exploits a race in net80211 (see further discssussions for more debugging and alternative solutions see D38508 and D38753). That may also explain why the changes to the rc startup script [1] only helped partially for some people to no longer see the continuous CTRL-EVENT-SCAN-FAILED. It is highly likely that we will want further changes and until we know for sure that people are seeing ''(changed)'' events this should stay local. Should we need to upstream this we'll likely need #ifdef __FreeBSD__ around this code. [1] 5fcdc19a81115d975e238270754e28557a2fcfc5 and d06d7eb09131edea666bf049d6c0c55672726f76 Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: cy, enweiwu (earlier) Differential Revision: https://reviews.freebsd.org/D38807 --- contrib/wpa/src/drivers/driver_bsd.c | 50 ++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/contrib/wpa/src/drivers/driver_bsd.c b/contrib/wpa/src/drivers/driver_bsd.c index 345bbb892ecf..d5ff51cee456 100644 --- a/contrib/wpa/src/drivers/driver_bsd.c +++ b/contrib/wpa/src/drivers/driver_bsd.c @@ -294,8 +294,9 @@ bsd_send_mlme_param(void *priv, const u8 op, const u16 reason, const u8 *addr) } static int -bsd_get_iface_flags(struct bsd_driver_data *drv) +bsd_ctrl_iface(void *priv, int enable) { + struct bsd_driver_data *drv = priv; struct ifreq ifr; os_memset(&ifr, 0, sizeof(ifr)); @@ -307,6 +308,33 @@ bsd_get_iface_flags(struct bsd_driver_data *drv) return -1; } drv->flags = ifr.ifr_flags; + + + if (enable) { + if (ifr.ifr_flags & IFF_UP) + goto nochange; + ifr.ifr_flags |= IFF_UP; + } else { + if (!(ifr.ifr_flags & IFF_UP)) + goto nochange; + ifr.ifr_flags &= ~IFF_UP; + } + + if (ioctl(drv->global->sock, SIOCSIFFLAGS, &ifr) < 0) { + wpa_printf(MSG_ERROR, "ioctl[SIOCSIFFLAGS]: %s", + strerror(errno)); + return -1; + } + + wpa_printf(MSG_DEBUG, "%s: if %s (changed) enable %d IFF_UP %d ", + __func__, drv->ifname, enable, ((ifr.ifr_flags & IFF_UP) != 0)); + + drv->flags = ifr.ifr_flags; + return 0; + +nochange: + wpa_printf(MSG_DEBUG, "%s: if %s (no change) enable %d IFF_UP %d ", + __func__, drv->ifname, enable, ((ifr.ifr_flags & IFF_UP) != 0)); return 0; } @@ -526,7 +554,7 @@ bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params) __func__); return -1; } - return 0; + return bsd_ctrl_iface(priv, 1); } static void @@ -1030,7 +1058,8 @@ bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params) if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr)) goto bad; - if (bsd_get_iface_flags(drv) < 0) + /* mark down during setup */ + if (bsd_ctrl_iface(drv, 0) < 0) goto bad; if (bsd_set_mediaopt(drv, IFM_OMASK, IFM_IEEE80211_HOSTAP) < 0) { @@ -1055,12 +1084,13 @@ bsd_deinit(void *priv) { struct bsd_driver_data *drv = priv; + if (drv->ifindex != 0) + bsd_ctrl_iface(drv, 0); if (drv->sock_xmit != NULL) l2_packet_deinit(drv->sock_xmit); os_free(drv); } - static int bsd_set_sta_authorized(void *priv, const u8 *addr, unsigned int total_flags, unsigned int flags_or, @@ -1309,7 +1339,7 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params) * NB: interface must be marked UP for association * or scanning (ap_scan=2) */ - if (bsd_get_iface_flags(drv) < 0) + if (bsd_ctrl_iface(drv, 1) < 0) return -1; os_memset(&mlme, 0, sizeof(mlme)); @@ -1354,11 +1384,8 @@ wpa_driver_bsd_scan(void *priv, struct wpa_driver_scan_params *params) } /* NB: interface must be marked UP to do a scan */ - if (!(drv->flags & IFF_UP)) { - wpa_printf(MSG_DEBUG, "%s: interface is not up, cannot scan", - __func__); + if (bsd_ctrl_iface(drv, 1) < 0) return -1; - } #ifdef IEEE80211_IOC_SCAN_MAX_SSID os_memset(&sr, 0, sizeof(sr)); @@ -1664,7 +1691,7 @@ wpa_driver_bsd_init(void *ctx, const char *ifname, void *priv) drv->capa.key_mgmt_iftype[i] = drv->capa.key_mgmt; /* Down interface during setup. */ - if (bsd_get_iface_flags(drv) < 0) + if (bsd_ctrl_iface(drv, 0) < 0) goto fail; /* Proven to work, lets go! */ @@ -1688,6 +1715,9 @@ wpa_driver_bsd_deinit(void *priv) if (drv->ifindex != 0 && !drv->if_removed) { wpa_driver_bsd_set_wpa(drv, 0); + /* NB: mark interface down */ + bsd_ctrl_iface(drv, 0); + wpa_driver_bsd_set_wpa_internal(drv, drv->prev_wpa, drv->prev_privacy); From nobody Fri Mar 24 00:17:30 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjN7t41rbz40mkd; Fri, 24 Mar 2023 00:17: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 4PjN7t3ZrSz3MbP; Fri, 24 Mar 2023 00:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679617050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WClhbCSThABEiZklIqAJyiN79qXGQTNKYgNnk5WnAfg=; b=Eyk2OyC0vlTSMn+9l/ARhJqpjhSGVlHlcBkgWytUItgydRUNPZ9O+bmhuuy2+EU9VX2iAe 0iXL0NEk7y8BgFS9NWftjs9KanEWRI967y9MCi3IivsgVOQ2GJunpzxfZAIKXheb/RA8mR neJ0e2eJGjzjP3craO0LEIHCkxgiJ/l/BUMsxZ0IuRaNVNC2D0pYj2tEVqu6DhjGEwQht3 U3UuwNmTmFaHpJQiZXMKFwQMt+5nZ1nIwbFEzFDKgoGBC7jNw6P2mgT7ZUaBnaMFYRqrAh Pn/PnSO1wSSRPUqZpyH0eBxtcy3BL9X1j0Yh4ilsNFlWRwBbsg42rsOEb7ac9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679617050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WClhbCSThABEiZklIqAJyiN79qXGQTNKYgNnk5WnAfg=; b=D8b+gK9ZwHm1nTcq7ZiUZn0df3V/BT3A60N0G6JPN23zVmyBXOxwoiTDDFLaAeH0ja3Z43 iNgpPgciUDfJW30U2SiiJwN9e/y4Recjzh1CO3SWkrpo+ho73ND28TrgHqD21TmMYpfo3s 3J2v7J5U2SxuBhqiu07a6A35VIb9wmh1h8C1OlMBx5NL1JOU5sdx8GMd4gw+utmRUQDvXd nJaoAG6r6hCCaOu1gPBVGccwpt2MY5+znzGqLx5T7xn/rcAD38xrdAMJCVYttw4iEZCr1a H2r0RCvI2tDFRUwszHNw9udU+Tvy8Tz6gkXUHoR2ZrYoSy0U4uuaDZ1VZRQnUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679617050; a=rsa-sha256; cv=none; b=tMrrCfydT6AiRx80PEf51OdLVa2SGe6ES/dPL+nflTJrBspT1/Q98rsJF866X/idUYvtmK QbEmRbh2tWeF/HWzFVGKPn61kALfbZk7y6qVSlPKwYVcZrK2A2MmJPkma9V8NFBPUv7zov V9J/5FY6gatDJtjxrjOpWP1D2oTW0V6CoMSfNn+ImepdnpGXVDadOQOUG66Lu5DtisVojV SgN4EsPMsq8uhplgkLqQ1jClpxklA3+hV1WE1vDP4qu+2HTh5THbuZHoCTb9bETiakBqy3 5S7Pa0nemw9aE0gTg766Vl9wOR+EuuPCogdAP5AKgdjZGekXj20wc4jNus1ONg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjN7t2fLszwt1; Fri, 24 Mar 2023 00:17: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 32O0HUIf048325; Fri, 24 Mar 2023 00:17:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O0HU3l048324; Fri, 24 Mar 2023 00:17:30 GMT (envelope-from git) Date: Fri, 24 Mar 2023 00:17:30 GMT Message-Id: <202303240017.32O0HU3l048324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Danilo G. Baio" Subject: git: dfcedc15a7a7 - main - committers-doc.dot: Add myself; late entry List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/heads/main X-Git-Reftype: branch X-Git-Commit: dfcedc15a7a7b85d9999411c1f3a581ec3ba1a45 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dbaio: URL: https://cgit.FreeBSD.org/src/commit/?id=dfcedc15a7a7b85d9999411c1f3a581ec3ba1a45 commit dfcedc15a7a7b85d9999411c1f3a581ec3ba1a45 Author: Danilo G. Baio AuthorDate: 2023-03-24 00:15:53 +0000 Commit: Danilo G. Baio CommitDate: 2023-03-24 00:15:53 +0000 committers-doc.dot: Add myself; late entry --- share/misc/committers-doc.dot | 1 + 1 file changed, 1 insertion(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index dcace06b5a87..5c695d19573d 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -62,6 +62,7 @@ ceri [label="Ceri Davies\nceri@FreeBSD.org\n2002/03/17"] chinsan [label="Chinsan Huang\nchinsan@FreeBSD.org\n2006/09/20"] crees [label="Chris Rees\ncrees@FreeBSD.org\n2013/05/27"] danger [label="Daniel Gerzo\ndanger@FreeBSD.org\n2006/08/20"] +dbaio [label="Danilo G. Baio\ndbaio@FreeBSD.org\n2021/05/13"] debdrup [label="Daniel Ebdrup Jensen\ndebdrup@FreeBSD.org\n2020/07/26"] delphij [label="Xin Li\ndelphij@FreeBSD.org\n2004/09/14"] dexter [label="Michael Dexter\ndexter@FreeBSD.org\n2016/11/15"] From nobody Fri Mar 24 00:39:20 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjNd46tYmz40p7p; Fri, 24 Mar 2023 00:39: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 4PjNd46Mp0z3NdX; Fri, 24 Mar 2023 00:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679618360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CAbrpUsEtUM/mqQcnP9LyyLPfzsEE7FVfmxqE1VIIhE=; b=JqFYRUz00x1RvelPh7SmZiv8V/Jv0QSAXGDYAuE9GYsan55RFfCnPRr6io+Hp8eUe5rIra Fqbldj/nNiroOyhcco5+8/V6yAh7RzpjJBpfbOz1FKdsqxQn9yQRTkuoUIhAidtnT3Uwt+ ixTGZiOOX6mTWGqoW2e9Pc4ptpfMGQ4VlKqzrxPq57j9kXWM8SAnvY4YdUxAwhqjj5XYIi f4c0Z9/Q9J2M00sHujFY1s/G6MyHIV+ZeVDNR019tIlIYr/XGotdS6bITUD5Tjjus5rGK5 PFdFT7i8m0zuhc/KlK/6ZUqg1UkFtFCedrnUgLlxWF7JjMw1fifowSpl3NiUpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679618360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CAbrpUsEtUM/mqQcnP9LyyLPfzsEE7FVfmxqE1VIIhE=; b=av5Ca78s2w6qTLjy3P9p4JfPmsmRIStVaJq9yrfy5EQ4MSvOfULzkPI4Q0CbXao8PUOSb8 CmGcV9YxwM1REdmt8glRlL/D7WRsa4PrsUBRWvoyQpcdm8LiSjwmXYcsware8h5X1rihSa 9TBQCCzrB7bBKwQ7xNwW4tPPbLHkIEeis7a1PPt9G540QFeuX/5yi9/rwnSHyqfkZoR57i p6j3V5oOrd8lAcRvLAvh3NUle+daVqmUmIfD0frcrp/Lwv4CkoFtmyOIKw2EGQDm3fKkvY QPGak1Jg+CRkFe5v3EWFsq43Ka2/RR2O2zbwDgSoiIreSIVFS/z/DBpPW97Vqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679618360; a=rsa-sha256; cv=none; b=Wwwdzqkci0RSjSVC8UQhMERxEKDf1VXl98Hpyu1WX/wCXDvqoVW1q5Pb30CH1NKOPadf/A Col8r1hiimZBb4YbEb80BQ4kYZmT2bW06LZOTWSRX4d52WbN0c8qnr0ZEbxzlMaVVbe/MN EPEZ51LRxZcC/ZIwMgjb8TtYCxPQ6dwVNIsAPSHO4xz3n90OeKwoLIk+OdYVfUdIrpG1cO lx059IcV+T5wlx+71sSniqGDShHM3fMJAvkeQCgf1cePpCljd2K2OxmjFyygek5XvUk8An HcmS1Av4unKuApk0QeyLOHGtoUmRgALprEgKt/FHDJXJRfcU9fwZmb4evCGYbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjNd45RTczwnC; Fri, 24 Mar 2023 00:39: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 32O0dKbP081400; Fri, 24 Mar 2023 00:39:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O0dKRp081399; Fri, 24 Mar 2023 00:39:20 GMT (envelope-from git) Date: Fri, 24 Mar 2023 00:39:20 GMT Message-Id: <202303240039.32O0dKRp081399@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: 40924005c222 - main - kasan.9: Update to note arm64 support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40924005c222ae8f4c5f647e2d214eefa677af95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=40924005c222ae8f4c5f647e2d214eefa677af95 commit 40924005c222ae8f4c5f647e2d214eefa677af95 Author: Mark Johnston AuthorDate: 2023-03-24 00:37:41 +0000 Commit: Mark Johnston CommitDate: 2023-03-24 00:39:10 +0000 kasan.9: Update to note arm64 support --- share/man/man9/kasan.9 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man9/kasan.9 b/share/man/man9/kasan.9 index 051c3ee0dbbb..752ea10cb41c 100644 --- a/share/man/man9/kasan.9 +++ b/share/man/man9/kasan.9 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2021 +.Dd March 23, 2023 .Dt KASAN 9 .Os .Sh NAME @@ -52,7 +52,7 @@ kernel configuration file: .Nm is a subsystem which leverages compiler instrumentation to detect invalid memory accesses in the kernel. -Currently it is implemented only on the amd64 platform. +Currently it is implemented on the amd64 and arm64 platforms. .Pp When .Nm @@ -168,7 +168,7 @@ When .Nm is configured, the kernel memory allocators are configured to use the kernel map, but some uses of the direct map remain. -For example, on amd64, accesses to page table pages are not tracked. +For example, on amd64 and arm64, accesses to page table pages are not tracked. .Pp Some kernel memory allocators explicitly permit accesses after an object has been freed. From nobody Fri Mar 24 04:46:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjV6N6M4rz413pl; Fri, 24 Mar 2023 04:46: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 4PjV6N5qjGz41Pv; Fri, 24 Mar 2023 04:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679633196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=795Y7GOCKNLMa92N0ef2nXy2qfScSl9Z4OHqECpAecg=; b=pPOImjjoazdTACFomGpGuwSPssjfh/lX08+TzH5CJj0bAqX7A+gnFcv5P3c3TOWi5C9UxZ F55+YmiUVrQQ7d0sRK5TxpDtMeg4UADhmcCN3dZly958ld/JN+zMQWkneIvYhLOtWL12AQ BgY3UTrzvxMyyQbbHp2Of3DvSrxRUIu+H8nLaV+FAxlcBHT6ca31tEcdxAu/CxP6YvfJPU FbGbos7n8gH4z3lWwWoKLl4OmhaGhkgxHd2BtjuS9/eg6hfatJZJQ0znMt/CzSGUmvzob4 wKZrtJqAFuVZHqFSOK/JSYyorrPa1tyhZkIGQYb665BnOxUFuV+Q8l8rJJJHoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679633196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=795Y7GOCKNLMa92N0ef2nXy2qfScSl9Z4OHqECpAecg=; b=H8NKFE3YQAKA2RCCdScv3YtcOXnQy1d73V+6eE1N+LhMF9hz06KYGBqAPb9kpkXhR3uVWz 0qfM5m31tSVAI04h8Cu4ysRle3nEHBL8iTS0kCbvf2ur/td1EtBGAk/rJRibXRqfNLvaPZ 9wFdNNJRuyV/l/HLru4xjjD2uwK6yp4JwLDal9xC4k1u+JTibuQi0f+I4JZANRu8Oa9hha WgPMSy8nz8Ue/e1nEW3by2e39MkPeGPwN6ljFWhiR2g04xqEQA6XqZkJIf7seFyc0S+MSQ GKQSPSUvUmoU/4hhwQK963TydcQ86iaHvScZLvbJBne2NDlmC+Eoh5P1fuBnmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679633196; a=rsa-sha256; cv=none; b=j3Mwo4INdp+suY4MC+MfOFAb2zdoZe7EdGOo0EENJXH+ZHf2m2HxCufD3isjE5d3D2jxmS mxdRL6+4TQp4IaNuU4TSnAzay9GiNqg9Q66u2f3ghD3iXlAQd1nlYlcm/new8lgIhmZxts /60Kyzu4oT95YZ4jvzwvkIwNjemaMyTw615xZ38yz3gdKrusGNNXbNmQeXHBSzYyIEBpFZ AmqELXWuAK+5ot8CXcfDWcV9Dos+1Kj/DCDEyxTqrGTuc8FPw3VBIcGdxkRBICdIlLdHEF BTgHjhbVvRXQx2K0svHWt22NeGUzIyPbV3AeIClKQwKHiVlz5s8wBBI4rkiAuw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjV6N4tfyz142N; Fri, 24 Mar 2023 04:46: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 32O4kach092179; Fri, 24 Mar 2023 04:46:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O4kYCD092168; Fri, 24 Mar 2023 04:46:34 GMT (envelope-from git) Date: Fri, 24 Mar 2023 04:46:34 GMT Message-Id: <202303240446.32O4kYCD092168@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: 2084f6a496ce - main - contrib/tzdata: import tzdata 2023b List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2084f6a496cefb5da9dbdabad5aa99342e2fc163 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=2084f6a496cefb5da9dbdabad5aa99342e2fc163 commit 2084f6a496cefb5da9dbdabad5aa99342e2fc163 Merge: 40924005c222 4071c87100b8 Author: Philip Paeps AuthorDate: 2023-03-24 04:45:24 +0000 Commit: Philip Paeps CommitDate: 2023-03-24 04:45:24 +0000 contrib/tzdata: import tzdata 2023b Changes: https://github.com/eggert/tz/blob/2023b/NEWS MFC after: 1 day contrib/tzdata/NEWS | 11 +++++++++++ contrib/tzdata/asia | 10 +++++++++- contrib/tzdata/version | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) From nobody Fri Mar 24 05:00:14 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjVQ64kwTz4144P; Fri, 24 Mar 2023 05:00: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 4PjVQ643lGz42j1; Fri, 24 Mar 2023 05:00:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679634014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fu54WWaeEs6n8IOANTkRJZTmDjHaQrQ8U8IBLolNV1E=; b=uLM+2CNMX+nmRLqvTS36gwf0a5S/+LCVR4nBP1IfosagJNlepl62GZZnrQrxyw2AVt2S/9 MB0lwqewilNeMVRxOt3/YurTNDTcNwbXQU59Yyy2fR6OEY75wOcbgC+zRpfo02eFg+TP7n eqRwxOKXKzEn1TWkwLr/8akaxM7CaSR4hXgHQxGSkuMK+5gq4TXUzzLROSip2cYTgy3TnF T0hRC/d8ripRjMkTzVvfnPJFACwyoQdinh1vUCFinpF+mTN5T+iNUPAkx4bvQW5eTPEpVb Xx4EHJ9/yiqd4iEpo5ZH9F1VsBpljP9aXMSBcKufX6hKXW0a9If0zKxPmO8EXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679634014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fu54WWaeEs6n8IOANTkRJZTmDjHaQrQ8U8IBLolNV1E=; b=pUnVxCUlzVA96CAEtfl0wgBjjS9FRC9ySFaIzPUQsqnpexyL4AohP4Wt3B7CyAXQecYlpo U1vDCvee3+Sgu3yBojObDIfJUaKmZXqA1EKwnYnovXnKXRL7YchJWyRWP+2kMURGssXXsy QF/Azj6iBYlJ6fsiI1LjXHQyX71cHWQpBIAr0CKiZyg4rusabF9NnMxqqrsDvyOHQwWoIS iF8Rk72tGXWwdTSzwsgDqB0Q+dcsrQYGS6FWdPYF1phmqA0Hy0u1vq6OtoJqdrMtBSX7hW 7ZQS/DlxP/CvlOxJKOKhSLd0Sj1Q9WbKdCESK303+uOaRy0lYXnHyHQZLrRU2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679634014; a=rsa-sha256; cv=none; b=lM244mYyCyHos330izc+Ept76GZyXDAfYRsubZm1Cm1XE8Px0TiDppNdA0IVTnBBu3VHph 75GejsBtzbuQ7i4esA+eLxopfYXzkNkdHjJt50cSIhYEfWteVkMXuvYoaI2o4Q3giNppI/ m3S6T+96RF1pmp7qEzh/CqTi8Qg2fLslP0W5igCfM4Ky/TWRV3+vHOKSbZdVWctmymORDH tIIG4ui4runRRpUrC1FAmfIHrww6Q8/SfDA1JN4rBCpICetmpX3ks5/JRgqOYFZ/7TtfeP CzOeLVD+C2kRA8SpDGa38TP7HBXPv7DE6EIdd/HwnXHN4OhK/ptJKi2dSJPCUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjVQ637l9z14cW; Fri, 24 Mar 2023 05:00: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 32O50EDS016640; Fri, 24 Mar 2023 05:00:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O50Evk016633; Fri, 24 Mar 2023 05:00:14 GMT (envelope-from git) Date: Fri, 24 Mar 2023 05:00:14 GMT Message-Id: <202303240500.32O50Evk016633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 4630a3252ac8 - main - ping: Fix an uninitialized variable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4630a3252ac8ad2f5acddf0d1efb26795cb3190b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=4630a3252ac8ad2f5acddf0d1efb26795cb3190b commit 4630a3252ac8ad2f5acddf0d1efb26795cb3190b Author: Jose Luis Duran AuthorDate: 2023-03-24 04:53:54 +0000 Commit: Cy Schubert CommitDate: 2023-03-24 04:58:28 +0000 ping: Fix an uninitialized variable The variable oicmp, which holds the original ("quoted packet") ICMP packet in a structured way, did not have a copy of the original ICMP packet obtained from the raw data. The code was accidentally removed in 20b41303140e. Bring it back. Reported by: Coverity Scan, cy Reviewed by: cy CID: 1506960 (UNINIT) Fixes: 20b41303140eee4dfb896558fb83600c5f013d39 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39233 --- sbin/ping/ping.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 6b82fe3da9de..965b565da7b9 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1156,6 +1156,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) struct ip oip; u_char oip_header_len; struct icmp oicmp; + const u_char *oicmp_raw; /* * Get size of IP header of the received packet. @@ -1359,6 +1360,8 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) } memcpy(&oip, icmp_data_raw, sizeof(struct ip)); + oicmp_raw = icmp_data_raw + oip_header_len; + memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && From nobody Fri Mar 24 07:05:48 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjYC038fjz419yW; Fri, 24 Mar 2023 07:05: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 4PjYC02Ccpz4F9R; Fri, 24 Mar 2023 07:05:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2C/MhyzcVK2IdvYYX6FpuPXcUk/HF2y4U3Sm4ZwPfGE=; b=H1iPBXYtneqvaCdMNcLL/0yIa/3lLKvDTYcPaJhnTwLgNwqTgzoReBH/0zeEAPMWu2Wzw+ /v7DLC8Tf6wJFoPuPHbkRDOmIrXswNCDMsykF6OCoQoCXAbI0AspWSW2spsJ+/XN82AW9p RM34w2jHgrA7xcoA6Cm0kt/HgefoAtn9x9xo8YVmsxHcPgCJHPkUvygVEkOxKYZGmEXlvx +Xb+VjBemHFirgJqdpC6gtbypxZnU3QX5f/j39Uz6jnmwmb6YRQD8S+YfTZLTYI+Ye2xUm O1qtdwBwIYskHWiQBhasO7LKx6+grQ572KrMKPPAUzPAFhV9tUzpAIj2pRlaig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2C/MhyzcVK2IdvYYX6FpuPXcUk/HF2y4U3Sm4ZwPfGE=; b=efQHdDMO9YHPYoPbiicnmKcNLEnBnjqruaK9psWMZbpH7kR9WzTNJ3oY/N2bRwfT2Oyikd flt1BY9BzJMY51DKU8lBNBPXPmxDlUAXEHs5WSRmVM+XP90VH3jm63pUHbYoJ8Qgye85ap i/WxwtF6Kz0BCmrLJ2Ohz3IWAGiVjwwkQjNV2Zm3xDY25WJIhE5x7gNX8FInM4ZqrTE/a6 QQ0V7rvsQmHJmt8jVa36AoUsSn551J9z4Mjnk9ZZgwUh1S60SLiH7WiELrwopg4KjuCe1n wJYOQhuMMnMD0apkWvrKx4Wr0gjrHs9gw45r7mzGcw9ErqAPre2heTeV7zF/wQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679641548; a=rsa-sha256; cv=none; b=Wnsy0PnwDyiijj6zoWc1xHvONuSXg6sfqMqxNtOahX7TmLmdx+ukWYDAuc9pLbgWfRctP0 Laa5kWbSfOzDwRu4IUNBtZf+v21JEkgTVWtKvox9MYZ5nUcgmT5hzTtNxQMe3ojZYSWb3i NjJ061qgwW6ZpsisRoJo4yRJWMhkDr6IWGKNgr8IwxexkxM1Cl8n9XaUaLd8srDLPsO/6I 7dHYc6aTcv1ACcJPjggnpUKhjtXa1LLfZnlBp+bWw76IGRYbR/ywGLZ2hxTKpEiPzZ7GWe CHUGTJ6tfHXzqRjXs8y+PW1Hv9BfKMZxsUy3B1k4KGvg8sGqg3uSwY+/BKaUTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjYC01BN5z17pG; Fri, 24 Mar 2023 07:05: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 32O75mco023206; Fri, 24 Mar 2023 07:05:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O75mo8023205; Fri, 24 Mar 2023 07:05:48 GMT (envelope-from git) Date: Fri, 24 Mar 2023 07:05:48 GMT Message-Id: <202303240705.32O75mo8023205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 949d971f0b69 - main - ice(4): Restore old conditional overwritten by last update List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 949d971f0b697f80db3087d74688a2ff0a12a359 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=949d971f0b697f80db3087d74688a2ff0a12a359 commit 949d971f0b697f80db3087d74688a2ff0a12a359 Author: Eric Joyner AuthorDate: 2023-03-24 07:01:01 +0000 Commit: Eric Joyner CommitDate: 2023-03-24 07:05:26 +0000 ice(4): Restore old conditional overwritten by last update Commit 8923de590543 ("ice(4): Update to 1.37.7-k", 2023-02-13) unintentionally overwrote the change made in commit 52f45d8acee9 ("net: iflib: let the drivers use isc_capenable", 2021-12-28). Signed-off-by: Eric Joyner Reported by: jhibbits@ MFC after: 3 days Sponsored by: Intel Corporation --- sys/dev/ice/ice_iflib_txrx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ice/ice_iflib_txrx.c b/sys/dev/ice/ice_iflib_txrx.c index 89c85357a755..9c60f36db665 100644 --- a/sys/dev/ice/ice_iflib_txrx.c +++ b/sys/dev/ice/ice_iflib_txrx.c @@ -284,6 +284,7 @@ static int ice_ift_rxd_pkt_get(void *arg, if_rxd_info_t ri) { struct ice_softc *sc = (struct ice_softc *)arg; + if_softc_ctx_t scctx = sc->scctx; struct ice_rx_queue *rxq = &sc->pf_vsi.rx_queues[ri->iri_qsidx]; union ice_32b_rx_flex_desc *cur; u16 status0, plen, ptype; @@ -341,7 +342,7 @@ ice_ift_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Get packet type and set checksum flags */ ptype = le16toh(cur->wb.ptype_flex_flags0) & ICE_RX_FLEX_DESC_PTYPE_M; - if ((iflib_get_ifp(sc->ctx)->if_capenable & IFCAP_RXCSUM) != 0) + if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) ice_rx_checksum(rxq, &ri->iri_csum_flags, &ri->iri_csum_data, status0, ptype); From nobody Fri Mar 24 07:08:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjYGV5lzZz41Bh9; Fri, 24 Mar 2023 07:08: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 4PjYGV59dfz4FY6; Fri, 24 Mar 2023 07:08:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rbYqZ7m2oKSkXG7ofHG7fc1xA/0nofR5bv5Ze1fQYjc=; b=WU4uI4t39UHjYB67RwrZFP7yE956k/XE1qkZ5hjYTyhItYHAkrPHZbGKk+sPL0I2KtB2Le 8CqNbOvgWb5k2i4vrsjXZ20g4+0ntlp3I+aH8+8dOlfTRi1fUbV968a4jX9rCU+nUbdvaM nDHh3+4d7ESy7/jTHgToxyr4zR3dW7VBHL052RC2Q1WZlRWe/i+XYU9SDTCpSDYRN/m5Ho KgzWYD61ggWFJIEd0smiTi6lI3NcAGJ+i+k2f6s71DwxAWPDTuBkJiJNeHfAFQZNMXdlgi OHnzsMSmA3sHwSh0bPX1BaV8xNXTwOc6v2iHcEbHatcOM7gIcy9+SjmfyZ5eVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rbYqZ7m2oKSkXG7ofHG7fc1xA/0nofR5bv5Ze1fQYjc=; b=AYEk8rVOeN+R0hM3mrunFJpz98HaktJs2IrzwKHWksIFQvJrSgMqtiNk9E0cxdYzUjq8J8 wilGvPP9/J5gOysMc4K+ElIlcXJvm0c6geMlGsGi0pzH+1kyVkLnGJblUkvb6tBY2PaICs Z11jLO3JDy4r06RHNR2SYF5UVkm2WX4MkTSffs1PhapURwdduj+8dBMQ0G0tZrDlZx+iGZ Kl99sq/48Dc5osKaUFgSCQqu/FORO33CshRGFNRnQgbhQFN/ZeR0aT+B5SnzMfZj0CEWKw 7w/GaP2CIUIr+n0GvpfNOBENvIDlfFWOBAsvG301z0WJP8B4kwocz+Qmyhgxxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679641730; a=rsa-sha256; cv=none; b=N5usVnwVu1stm6bClikQg6i9Yjt9on/3tSrRg8xpAhiwI6vQ8wdHYQdfJ2NsuQZJWhHl1c MUIg1B3f4d0tyKdpiFp1sgGSDC68cd+RTWdqiOk0PNBn4AO6yhNKwH8m2UofeTfk+3qh4m dRj/djq/jN1ImjCouS0Ii3qtWSDBVXFgiOQEbQvFQUCdMYyaSk0dXgTMYljyfU577Uly5X eNrFH8Qo7cXQ9zF0LQjAg2T0iAx39sFUr1QY83TZeEKwayU8wMfGq9cCixKCzHBmNCFBf+ VHFTs62rGkNRJV+mwB61zRdXXmd5eGj3JakbeKKkoXCpYF04F4nJ7xMPDl6yrg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjYGV463Jz17Rb; Fri, 24 Mar 2023 07: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 32O78oWb023724; Fri, 24 Mar 2023 07: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 32O78oZb023723; Fri, 24 Mar 2023 07:08:50 GMT (envelope-from git) Date: Fri, 24 Mar 2023 07:08:50 GMT Message-Id: <202303240708.32O78oZb023723@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: 0ab2c922340b - main - ifconfig: free memory allocated by getaddrinfo() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ab2c922340b8848c79301fdd84548417c0c3023 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab2c922340b8848c79301fdd84548417c0c3023 commit 0ab2c922340b8848c79301fdd84548417c0c3023 Author: Kristof Provost AuthorDate: 2023-03-24 05:25:28 +0000 Commit: Kristof Provost CommitDate: 2023-03-24 07:08:19 +0000 ifconfig: free memory allocated by getaddrinfo() Reported by: emaste, Coverity Sponsored by: Rubicon Communications, LLC (Netgate) --- sbin/ifconfig/carp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index 0dc3facdaf79..126a15a230df 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -242,6 +242,7 @@ setcarp_peer6(const char *val, int d, int s, const struct afswtch *afp) memcpy(&carp_addr6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof(carp_addr6)); + freeaddrinfo(res); } static void From nobody Fri Mar 24 07:08:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjYGW6c71z41BMZ; Fri, 24 Mar 2023 07: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 4PjYGW68KWz4FSk; Fri, 24 Mar 2023 07:08:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b+pYj4Er6J+fOzOj3W3soMIFgeRUNxNLxRNlliUoVGM=; b=lKj3lU7PkjRC6mE1OnhQlvDVtOyPA81JPcEcLKJh3M/m1hQ/ctn/aK8oklipFqEALXAKiP xPAZNVxEcA7lY+WaCubFo79ftrPAkhRKuC1I81hvTVxgzDOoc/N0FrY85DoIPgZ8Y4BYat fjx0epwRbwg1dulKSyiXC0qIMG8pMdPG5FV/B3cyyfLa/oSasUB+0fa3tMZlx7MJdBhha4 k5+jz3G8v9ucNygoWe5tw0P9QA37n8RUmadvf+7TMhSrR3GyeERWljE8WKTQ+jOD3DXEGh VCwKNJrL2mSJE6BWOWKMtXJLMnM5H+goo2RskPWZpXqHAVKsmOmu7zBpH2htJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679641731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b+pYj4Er6J+fOzOj3W3soMIFgeRUNxNLxRNlliUoVGM=; b=VtF7od8HnOwVOhURKgW51KBKusFfc3BiUcpvSRtyfsKGZBWSfUw1uCllLVKojEnUJink7X h9ThUlzIxwNvV/fE7IofAXdgJVju9kAWwR/ot3GTfkGnyUSCUkZMxElAncgAkK0hmBErK6 fMSbdiMt0MrHu+7GDJnci7EanurLNosdZKLkPRGandkBsekj5fUP5pdSgEIU9GPIHzAsDn WRGHM67y6Y/amt3kGAmsC7D2jUXlAVWl0RUqs327P6TNzq0byVz6cd87C0zk/ZdWzZaXrv wPXX4wu1DxXPn0EUhVmXf0zOWtmdwybfmsCqYHypyqBLsgdQJm2dKteLPA1vnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679641731; a=rsa-sha256; cv=none; b=t3IMeXn8LrutTtZuTbNm0JJQ9qKdtndF5zGSs3iQqbGluJJWqEvhYZDK/OxhrjP24KtxwJ zoOJcpPgxJuqmIz6HBNG5P5HU3lC0drm/v9V2Oqhf55iuEVkkG1UPDkwmIWCBbpi8jzC+J FlGVqmgN027vvmJIaM6Oh7zx9Y+OOlUKtQdzXeX6COQaDFqF6iXJ/BhkTLhGF0tRD1SfxO Sc2wBJJOpOC5JNVvsacr84SSrDKdmbRcAaLkGI3eAusK12OMJy9gPHD9UIN2KVzpdcopDu ttJfY74kr/Coz4K8zWqutwxWX3ZP6kTaLhfjDeroVYTd2yQEIMOZclS2iwFoLw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjYGW58hfz17Rc; Fri, 24 Mar 2023 07:08: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 32O78piT023751; Fri, 24 Mar 2023 07:08:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O78pYi023750; Fri, 24 Mar 2023 07:08:51 GMT (envelope-from git) Date: Fri, 24 Mar 2023 07:08:51 GMT Message-Id: <202303240708.32O78pYi023750@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: ad729f8d503e - main - pf: ignore ip6_output() return value in pf_refragment6() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad729f8d503e26ddfe4dcc0fa701720c753bd3ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad729f8d503e26ddfe4dcc0fa701720c753bd3ba commit ad729f8d503e26ddfe4dcc0fa701720c753bd3ba Author: Kristof Provost AuthorDate: 2023-03-24 05:39:01 +0000 Commit: Kristof Provost CommitDate: 2023-03-24 07:08:19 +0000 pf: ignore ip6_output() return value in pf_refragment6() We can't do anything if ip6_output() fails, other than discard the packet which ip6_output() already does for us. Mark the return value as ignored. Reported by: emaste, Coverity Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/netpfil/pf/pf_norm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 8d36e72d71b2..2eb1bd69294c 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -1020,7 +1020,8 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag, MPASS(m->m_pkthdr.rcvif != NULL); ip6_forward(m, 0); } else { - ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); + (void)ip6_output(m, NULL, NULL, 0, NULL, NULL, + NULL); } else m_freem(m); From nobody Fri Mar 24 09:57:10 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjd0k6Xzwz41M9C; Fri, 24 Mar 2023 09:57: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 4Pjd0k5szTz3mdJ; Fri, 24 Mar 2023 09:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679651830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0Ii7bewP1f1Jmpde7XcvNLGzHd2sPOA2stHMWfW7DeI=; b=KDJuaLtoAtesBtNv3nGdJkuv54/h6De7J5gRyAIvFwNWgsq0n+F05kePPvcy2zeUSndBwP QQO82jw29iz3nPJ4OQ3e/liluDFPRX2VCATeznTVpTBkPPdMkneiRFDedBpnsjZmf15udB tD2fWkodtqNrjfLLEmpkAmk4/tvKZp3LCT4iRCO0axGt83KVShKTyElwSnW9GPYKvO4mWV aihcMr4td7zji89RJlEE9Cp+K3+twgDIyREqw4mYpM/hqqOWDOT75ifWgHgK7sYMvqtlf1 keRZaIxf2cYQwgqa2m8xRR9q3nAMRJdxM4nnCCpaQmMoVSiGyd0prTvMnHs8NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679651830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0Ii7bewP1f1Jmpde7XcvNLGzHd2sPOA2stHMWfW7DeI=; b=M3ZYMAlWTk4YlVAB4bSnow32UfzLggmSNhTSLMKQ+2+NrnBi+4ZA9RsKef4mKcFW2Q/xVx 0lKW+PWTUF9Bn2/JqCEacYxuWZcMzSMOMF5LCSOqe/3dee/ANV/xIl+re6UrhuvQV9HGbd v7C+TuflLPYexs4QILu9WZxVD7nw+ifIgSA/N7k/5O7qH3SuXy7A/wtUFXNlTO46Vu2lrH 2vbr2kLd+cryD9akoGxo9VbfZsZ/imROJEVEtMAbB+VGiH85KOWLK5/9XslBG5UJdkUumJ /iOUUkZ0G3ZlqKlx/cShmyuXWarCm6URyaMjwFQjAvx6dN2U06/XWaIoRPoxTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679651830; a=rsa-sha256; cv=none; b=MTYousIHw8feysowCK7Hp+dsgf4MNADBNSjUTd6VpyEkZDomnCH+VYUFPaLOApsOm0Q8pV fiKkIqK01LT2+/F0a7HfTICPt50FIq2ujZ0qFaDcvX/Is8kKBkEcrm2pgpF3G4IZYSfqGP 6cDCiaJMI5FIJxBBTTG0BY5u8hq8EA1GQILL2TVRAtPPt6vuXtUoBFkhmkgV0gSdaanQ4f RmI6Jx4gdR+dCidlBMfiwIBkuHKtZyN4K/R78IKWLfoG36hG6vOfbX9F1WXKNIkhfXtW0p rBrrFgv9htENvIn9DeEJbycxFRaP+sga+FcyZv9qn//LFzjJsEG/Ro2CwZVong== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjd0k4tRHz1Ccv; Fri, 24 Mar 2023 09:57: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 32O9vARS001538; Fri, 24 Mar 2023 09:57:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O9vAx5001537; Fri, 24 Mar 2023 09:57:10 GMT (envelope-from git) Date: Fri, 24 Mar 2023 09:57:10 GMT Message-Id: <202303240957.32O9vAx5001537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: dcd7f0bd02f4 - main - lagg: Various style fixes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcd7f0bd02f407952de42d96e1c2c01ee3460702 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd7f0bd02f407952de42d96e1c2c01ee3460702 commit dcd7f0bd02f407952de42d96e1c2c01ee3460702 Author: Zhenlei Huang AuthorDate: 2023-03-24 09:55:15 +0000 Commit: Zhenlei Huang CommitDate: 2023-03-24 09:55:15 +0000 lagg: Various style fixes MFC after: 1 week --- sys/net/if_lagg.c | 45 ++++++++++++++++++++++----------------------- sys/net/if_lagg.h | 2 +- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index a50cd995c6eb..27ebed8e135a 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -150,15 +150,15 @@ static int lagg_snd_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); static void lagg_snd_tag_free(struct m_snd_tag *); static struct m_snd_tag *lagg_next_snd_tag(struct m_snd_tag *); -static void lagg_ratelimit_query(struct ifnet *, +static void lagg_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); #endif static int lagg_setmulti(struct lagg_port *); static int lagg_clrmulti(struct lagg_port *); -static void lagg_setcaps(struct lagg_port *, int cap, int cap2); -static int lagg_setflag(struct lagg_port *, int, int, +static void lagg_setcaps(struct lagg_port *, int cap, int cap2); +static int lagg_setflag(struct lagg_port *, int, int, int (*func)(struct ifnet *, int)); -static int lagg_setflags(struct lagg_port *, int status); +static int lagg_setflags(struct lagg_port *, int status); static uint64_t lagg_get_counter(struct ifnet *ifp, ift_counter cnt); static int lagg_transmit_ethernet(struct ifnet *, struct mbuf *); static int lagg_transmit_infiniband(struct ifnet *, struct mbuf *); @@ -166,7 +166,7 @@ static void lagg_qflush(struct ifnet *); static int lagg_media_change(struct ifnet *); static void lagg_media_status(struct ifnet *, struct ifmediareq *); static struct lagg_port *lagg_link_active(struct lagg_softc *, - struct lagg_port *); + struct lagg_port *); /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); @@ -190,7 +190,7 @@ static struct mbuf *lagg_lb_input(struct lagg_softc *, struct lagg_port *, static int lagg_lb_porttable(struct lagg_softc *, struct lagg_port *); /* Broadcast */ -static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); +static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_bcast_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); @@ -477,7 +477,7 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - if (ifp->if_softc != arg) /* Not our event */ + if (ifp->if_softc != arg) /* Not our event */ return; LAGG_XLOCK(sc); @@ -496,7 +496,7 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - if (ifp->if_softc != arg) /* Not our event */ + if (ifp->if_softc != arg) /* Not our event */ return; LAGG_XLOCK(sc); @@ -535,7 +535,7 @@ lagg_clone_create(struct if_clone *ifc, char *name, size_t len, if_type = IFT_ETHER; } - sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK|M_ZERO); + sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK | M_ZERO); ifp = sc->sc_ifp = if_alloc(if_type); if (ifp == NULL) { free(sc, M_LAGG); @@ -554,7 +554,7 @@ lagg_clone_create(struct if_clone *ifc, char *name, size_t len, sc->flowid_shift = V_def_flowid_shift; /* Hash all layers by default */ - sc->sc_flags = MBUF_HASHFLAG_L2|MBUF_HASHFLAG_L3|MBUF_HASHFLAG_L4; + sc->sc_flags = MBUF_HASHFLAG_L2 | MBUF_HASHFLAG_L3 | MBUF_HASHFLAG_L4; lagg_proto_attach(sc, LAGG_PROTO_DEFAULT); @@ -803,7 +803,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) ifr.ifr_mtu = oldmtu; } - lp = malloc(sizeof(struct lagg_port), M_LAGG, M_WAITOK|M_ZERO); + lp = malloc(sizeof(struct lagg_port), M_LAGG, M_WAITOK | M_ZERO); lp->lp_softc = sc; /* Check if port is a stacked lagg */ @@ -873,7 +873,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) CK_SLIST_FOREACH(tlp, &sc->sc_ports, lp_entries) { if (tlp->lp_ifp->if_index < ifp->if_index && ( CK_SLIST_NEXT(tlp, lp_entries) == NULL || - ((struct lagg_port*)CK_SLIST_NEXT(tlp, lp_entries))->lp_ifp->if_index > + ((struct lagg_port*)CK_SLIST_NEXT(tlp, lp_entries))->lp_ifp->if_index > ifp->if_index)) break; } @@ -1088,15 +1088,15 @@ fallback: } /* - * Requests counter @cnt data. + * Requests counter @cnt data. * * Counter value is calculated the following way: - * 1) for each port, sum difference between current and "initial" measurements. + * 1) for each port, sum difference between current and "initial" measurements. * 2) add lagg logical interface counters. * 3) add data from detached_counters array. * * We also do the following things on ports attach/detach: - * 1) On port attach we store all counters it has into port_counter array. + * 1) On port attach we store all counters it has into port_counter array. * 2) On port detach we add the different between "initial" and * current counters data to detached_counters array. */ @@ -1475,7 +1475,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* Invalid combination of options specified. */ error = EINVAL; LAGG_XUNLOCK(sc); - break; /* Return from SIOCSLAGGOPTS. */ + break; /* Return from SIOCSLAGGOPTS. */ } /* @@ -1524,15 +1524,15 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); - LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) - lp->lp_state |= LACP_STATE_TIMEOUT; + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state |= LACP_STATE_TIMEOUT; LACP_UNLOCK(lsc); lsc->lsc_fast_timeout = 1; break; case -LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); - LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) - lp->lp_state &= ~LACP_STATE_TIMEOUT; + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state &= ~LACP_STATE_TIMEOUT; LACP_UNLOCK(lsc); lsc->lsc_fast_timeout = 0; break; @@ -1999,8 +1999,7 @@ lagg_setmulti(struct lagg_port *lp) IF_ADDR_WUNLOCK(scifp); return (ENOMEM); } - bcopy(ifma->ifma_addr, &mc->mc_addr, - ifma->ifma_addr->sa_len); + bcopy(ifma->ifma_addr, &mc->mc_addr, ifma->ifma_addr->sa_len); mc->mc_addr.sdl_index = ifp->if_index; mc->mc_ifma = NULL; SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries); @@ -2532,7 +2531,7 @@ lagg_fail_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) * If tmp_tp is null, we've received a packet when all * our links are down. Weird, but process it anyways. */ - if ((tmp_tp == NULL || tmp_tp == lp)) { + if (tmp_tp == NULL || tmp_tp == lp) { m->m_pkthdr.rcvif = ifp; return (m); } diff --git a/sys/net/if_lagg.h b/sys/net/if_lagg.h index 9fc6e3862712..721c5083bbd6 100644 --- a/sys/net/if_lagg.h +++ b/sys/net/if_lagg.h @@ -223,7 +223,7 @@ struct lagg_lb { struct lagg_mc { struct sockaddr_dl mc_addr; - struct ifmultiaddr *mc_ifma; + struct ifmultiaddr *mc_ifma; SLIST_ENTRY(lagg_mc) mc_entries; }; From nobody Fri Mar 24 15:49:11 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjmpv2r2bz41jfK; Fri, 24 Mar 2023 15:49: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 4Pjmpv2Vnjz4HgW; Fri, 24 Mar 2023 15:49:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hRVxqt2wJ4GNlL0r5ynBlSkay2fPHoKvePSpVGdeX/c=; b=BsS/FtOexqGJJ2/KtdzmUTNrUyEEl3S9b/Jer/DIGXcunwvNk006miYvMQiiZyI/S1+PZV 204I7NqqOuhCaQKp+rUKePpgE9txLfxGaXsJwX37t9VbXnvIfjMRA/kJgV+deS6r0aYbZf 8RzAcQj+cSxt5O8n9TuD/OS4j4xXip24xd3KS7uQGvBbXCqlb7uK+JRwvdghOsNUNBxQu+ OzQ/+jXA5tsTfnbrucz4d3yQ/HPyPXfKMfm8KnGK9iPX1Cz66Peolbxbq3jD4kIfKxRnr/ d5nKlQdxl/Kwolw9w8A7+lckyhB+q2gJH7UIwQBjzMng2fZdQ2hr7emt4RRI4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hRVxqt2wJ4GNlL0r5ynBlSkay2fPHoKvePSpVGdeX/c=; b=pTB8qmPeu8HfBXDEQXygf93QJGEdfU1oyfIM8qEE8YvxKJA3aa39M1EaOrowrgd9KRj+02 T4GL/4LYxyaAp6axz86W3UOBWceC0o4UXtkACvJjTc4jMKue1QoR5cZUZP09Q6FOjZ9FeG AlyiOni1ekgaNFUOefRX4+f2CdbabJZpem1XkxQtfBxzwDLIxoOxrf6H14TunNsqxxod0h yyHXkpdBsbdkhx4fPYLzS9iR82yzWtmn5M2O2DzyJNTumCI39jeOvqu5STeCY+jzuaU3Lq cTlqjjcj5/ehPX6fJus/Uxek4Onj5LVWn1LoPI3rTe4iZNbkwLF6KuzWkI+6Hg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679672951; a=rsa-sha256; cv=none; b=iXvSC31POqcmOxeR5YKkbRr2kNIRGcNblNpd7Zk3n/iXHXaWqpeSfLixQG6GIakfGCuC6J q0WIBJUmBBHtCyaZEz0pczWW6mSmPTG3FRdTP8ieew0ZJBXeoDzE3CW2Brtlis5hGfsPWQ Jt1gOdiEn0/jdCPwYZ1iyIiSVDKWA5yenU4ycDMf6sgCH17cCCjPXV1aXClaQYdSsYquQO 5RHlnmqYZc/sUvLkF+UtXJZDZbcSmD0+i8WdD4zt7+WMKWwAxt1O+MIk2Ti9jApGI5QCXk /q2USBXAjNskPuO9XlDjs93GAlDDDI9ZD7bGLoj4DbTunmwOuAmIh554LYeJcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjmpv1XGQzP18; Fri, 24 Mar 2023 15:49: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 32OFnBHB078716; Fri, 24 Mar 2023 15:49:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OFnB2v078715; Fri, 24 Mar 2023 15:49:11 GMT (envelope-from git) Date: Fri, 24 Mar 2023 15:49:11 GMT Message-Id: <202303241549.32OFnB2v078715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 3e142e07675b - main - ofed: Mechanically convert to IfAPI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e142e07675be6df39e4aaf5003637dca54cdcea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=3e142e07675be6df39e4aaf5003637dca54cdcea commit 3e142e07675be6df39e4aaf5003637dca54cdcea Author: Justin Hibbits AuthorDate: 2023-02-09 02:31:24 +0000 Commit: Justin Hibbits CommitDate: 2023-03-24 14:04:33 +0000 ofed: Mechanically convert to IfAPI Summary: Because of the intricacies of this code it wasn't purely scripted, but instead hand-mechanical. Reviewed by: hselasky Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38560 --- sys/ofed/drivers/infiniband/core/core_priv.h | 10 +- sys/ofed/drivers/infiniband/core/ib_addr.c | 88 +++++---- sys/ofed/drivers/infiniband/core/ib_cache.c | 26 +-- sys/ofed/drivers/infiniband/core/ib_cm.c | 6 +- sys/ofed/drivers/infiniband/core/ib_cma.c | 74 ++++---- sys/ofed/drivers/infiniband/core/ib_device.c | 12 +- sys/ofed/drivers/infiniband/core/ib_multicast.c | 2 +- .../drivers/infiniband/core/ib_roce_gid_mgmt.c | 152 +++++++++------- sys/ofed/drivers/infiniband/core/ib_sa_query.c | 6 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 10 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 36 ++-- .../drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 16 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c | 4 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 26 +-- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 201 +++++++++++---------- .../drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 20 +- .../drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 8 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 10 +- sys/ofed/include/rdma/ib_addr.h | 43 ++--- sys/ofed/include/rdma/ib_addr_freebsd.h | 12 +- sys/ofed/include/rdma/ib_cache.h | 4 +- sys/ofed/include/rdma/ib_sa.h | 4 +- sys/ofed/include/rdma/ib_verbs.h | 10 +- 23 files changed, 401 insertions(+), 379 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index ebbb46d73933..db6cbac386ba 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -82,10 +82,10 @@ void ib_cache_setup(void); void ib_cache_cleanup(void); typedef void (*roce_netdev_callback)(struct ib_device *device, u8 port, - struct ifnet *idev, void *cookie); + if_t idev, void *cookie); typedef int (*roce_netdev_filter)(struct ib_device *device, u8 port, - struct ifnet *idev, void *cookie); + if_t idev, void *cookie); void ib_enum_roce_netdev(struct ib_device *ib_dev, roce_netdev_filter filter, @@ -107,7 +107,7 @@ int ib_cache_gid_parse_type_str(const char *buf); const char *ib_cache_gid_type_str(enum ib_gid_type gid_type); void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, - struct ifnet *ndev, + if_t ndev, unsigned long gid_type_mask, enum ib_cache_gid_default_mode mode); @@ -118,8 +118,8 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port, union ib_gid *gid, struct ib_gid_attr *attr); int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, - struct ifnet *ndev); -void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev); + if_t ndev); +void ib_cache_gid_del_all_by_netdev(if_t ndev); int roce_gid_mgmt_init(void); void roce_gid_mgmt_cleanup(void); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 974860b77caf..ee5e792027d3 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -140,32 +140,34 @@ rdma_copy_addr_sub(u8 *dst, const u8 *src, unsigned min, unsigned max) memset(dst + min, 0, max - min); } -int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct ifnet *dev, +int rdma_copy_addr(struct rdma_dev_addr *dev_addr, if_t dev, const unsigned char *dst_dev_addr) { + int dev_type = if_gettype(dev); + /* check for loopback device */ - if (dev->if_flags & IFF_LOOPBACK) { + if (if_getflags(dev) & IFF_LOOPBACK) { dev_addr->dev_type = ARPHRD_ETHER; memset(dev_addr->src_dev_addr, 0, MAX_ADDR_LEN); memset(dev_addr->broadcast, 0, MAX_ADDR_LEN); memset(dev_addr->dst_dev_addr, 0, MAX_ADDR_LEN); - dev_addr->bound_dev_if = dev->if_index; + dev_addr->bound_dev_if = if_getindex(dev); return (0); - } else if (dev->if_type == IFT_INFINIBAND) + } else if (dev_type == IFT_INFINIBAND) dev_addr->dev_type = ARPHRD_INFINIBAND; - else if (dev->if_type == IFT_ETHER || dev->if_type == IFT_L2VLAN) + else if (dev_type == IFT_ETHER || dev_type == IFT_L2VLAN) dev_addr->dev_type = ARPHRD_ETHER; else dev_addr->dev_type = 0; - rdma_copy_addr_sub(dev_addr->src_dev_addr, IF_LLADDR(dev), - dev->if_addrlen, MAX_ADDR_LEN); - rdma_copy_addr_sub(dev_addr->broadcast, dev->if_broadcastaddr, - dev->if_addrlen, MAX_ADDR_LEN); + rdma_copy_addr_sub(dev_addr->src_dev_addr, if_getlladdr(dev), + if_getaddrlen(dev), MAX_ADDR_LEN); + rdma_copy_addr_sub(dev_addr->broadcast, if_getbroadcastaddr(dev), + if_getaddrlen(dev), MAX_ADDR_LEN); if (dst_dev_addr != NULL) { rdma_copy_addr_sub(dev_addr->dst_dev_addr, dst_dev_addr, - dev->if_addrlen, MAX_ADDR_LEN); + if_getaddrlen(dev), MAX_ADDR_LEN); } - dev_addr->bound_dev_if = dev->if_index; + dev_addr->bound_dev_if = if_getindex(dev); return 0; } EXPORT_SYMBOL(rdma_copy_addr); @@ -173,7 +175,7 @@ EXPORT_SYMBOL(rdma_copy_addr); int rdma_translate_ip(const struct sockaddr *addr, struct rdma_dev_addr *dev_addr) { - struct ifnet *dev; + if_t dev; int ret; if (dev_addr->bound_dev_if) { @@ -198,7 +200,7 @@ int rdma_translate_ip(const struct sockaddr *addr, if (dev != NULL) { /* disallow connections through 127.0.0.1 itself */ - if (dev->if_flags & IFF_LOOPBACK) + if (if_getflags(dev) & IFF_LOOPBACK) ret = -EINVAL; else ret = rdma_copy_addr(dev_addr, dev, NULL); @@ -241,7 +243,7 @@ static void queue_req(struct addr_req *req) } #if defined(INET) || defined(INET6) -static int addr_resolve_multi(u8 *edst, struct ifnet *ifp, struct sockaddr *dst_in) +static int addr_resolve_multi(u8 *edst, if_t ifp, struct sockaddr *dst_in) { struct sockaddr *llsa; struct sockaddr_dl sdl; @@ -250,14 +252,10 @@ static int addr_resolve_multi(u8 *edst, struct ifnet *ifp, struct sockaddr *dst_ sdl.sdl_len = sizeof(sdl); llsa = (struct sockaddr *)&sdl; - if (ifp->if_resolvemulti == NULL) { - error = EOPNOTSUPP; - } else { - error = ifp->if_resolvemulti(ifp, &llsa, dst_in); - if (error == 0) { - rdma_copy_addr_sub(edst, LLADDR((struct sockaddr_dl *)llsa), - ifp->if_addrlen, MAX_ADDR_LEN); - } + error = if_resolvemulti(ifp, &llsa, dst_in); + if (error == 0) { + rdma_copy_addr_sub(edst, LLADDR((struct sockaddr_dl *)llsa), + if_getaddrlen(ifp), MAX_ADDR_LEN); } return (error); } @@ -268,7 +266,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, const struct sockaddr_in *dst_in, struct rdma_dev_addr *addr, u8 *edst, - struct ifnet **ifpp) + if_t *ifpp) { enum { ADDR_VALID = 0, @@ -279,7 +277,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, in_port_t src_port; struct sockaddr *saddr = NULL; struct nhop_object *nh; - struct ifnet *ifp; + if_t ifp; int error; int type; @@ -332,13 +330,13 @@ static int addr4_resolve(struct sockaddr_in *src_in, if (ifp == NULL) { error = ENETUNREACH; goto done; - } else if (ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(ifp) & IFF_LOOPBACK) { /* * Source address cannot be a loopback device. */ error = EHOSTUNREACH; goto error_put_ifp; - } else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) { if (memcmp(&src_in->sin_addr, &dst_in->sin_addr, sizeof(src_in->sin_addr))) { /* @@ -364,7 +362,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, break; case ADDR_SRC_ANY: /* check for loopback device */ - if (nh->nh_ifp->if_flags & IFF_LOOPBACK) + if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) saddr = (struct sockaddr *)&dst_tmp; else saddr = nh->nh_ifa->ifa_addr; @@ -381,8 +379,8 @@ static int addr4_resolve(struct sockaddr_in *src_in, * Step 3 - resolve destination MAC address */ if (dst_tmp.sin_addr.s_addr == INADDR_BROADCAST) { - rdma_copy_addr_sub(edst, ifp->if_broadcastaddr, - ifp->if_addrlen, MAX_ADDR_LEN); + rdma_copy_addr_sub(edst, if_getbroadcastaddr(ifp), + if_getaddrlen(ifp), MAX_ADDR_LEN); error = 0; } else if (IN_MULTICAST(ntohl(dst_tmp.sin_addr.s_addr))) { bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0; @@ -391,7 +389,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, goto error_put_ifp; else if (is_gw) addr->network = RDMA_NETWORK_IPV4; - } else if (ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(ifp) & IFF_LOOPBACK) { memset(edst, 0, MAX_ADDR_LEN); error = 0; } else { @@ -440,7 +438,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, const struct sockaddr_in *dst_in, struct rdma_dev_addr *addr, u8 *edst, - struct ifnet **ifpp) + if_t *ifpp) { return -EADDRNOTAVAIL; } @@ -451,7 +449,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, const struct sockaddr_in6 *dst_in, struct rdma_dev_addr *addr, u8 *edst, - struct ifnet **ifpp) + if_t *ifpp) { enum { ADDR_VALID = 0, @@ -462,7 +460,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, in_port_t src_port; struct sockaddr *saddr = NULL; struct nhop_object *nh; - struct ifnet *ifp; + if_t ifp; int error; int type; @@ -530,13 +528,13 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, if (ifp == NULL) { error = ENETUNREACH; goto done; - } else if (ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(ifp) & IFF_LOOPBACK) { /* * Source address cannot be a loopback device. */ error = EHOSTUNREACH; goto error_put_ifp; - } else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) { if (memcmp(&src_in->sin6_addr, &dst_in->sin6_addr, sizeof(src_in->sin6_addr))) { /* @@ -562,7 +560,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, break; case ADDR_SRC_ANY: /* check for loopback device */ - if (nh->nh_ifp->if_flags & IFF_LOOPBACK) + if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) saddr = (struct sockaddr *)&dst_tmp; else saddr = nh->nh_ifa->ifa_addr; @@ -586,7 +584,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, goto error_put_ifp; else if (is_gw) addr->network = RDMA_NETWORK_IPV6; - } else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) { + } else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) { memset(edst, 0, MAX_ADDR_LEN); error = 0; } else { @@ -628,18 +626,18 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, const struct sockaddr_in6 *dst_in, struct rdma_dev_addr *addr, u8 *edst, - struct ifnet **ifpp) + if_t *ifpp) { return -EADDRNOTAVAIL; } #endif -static int addr_resolve_neigh(struct ifnet *dev, +static int addr_resolve_neigh(if_t dev, const struct sockaddr *dst_in, u8 *edst, struct rdma_dev_addr *addr) { - if (dev->if_flags & IFF_LOOPBACK) { + if (if_getflags(dev) & IFF_LOOPBACK) { int ret; /* @@ -647,7 +645,7 @@ static int addr_resolve_neigh(struct ifnet *dev, * sure the destination device address is global by * clearing the bound device interface: */ - if (addr->bound_dev_if == dev->if_index) + if (addr->bound_dev_if == if_getindex(dev)) addr->bound_dev_if = 0; ret = rdma_translate_ip(dst_in, addr); @@ -659,7 +657,7 @@ static int addr_resolve_neigh(struct ifnet *dev, } /* If the device doesn't do ARP internally */ - if (!(dev->if_flags & IFF_NOARP)) + if (!(if_getflags(dev) & IFF_NOARP)) return rdma_copy_addr(addr, dev, edst); return rdma_copy_addr(addr, dev, NULL); @@ -670,7 +668,7 @@ static int addr_resolve(struct sockaddr *src_in, struct rdma_dev_addr *addr) { struct epoch_tracker et; - struct ifnet *ndev = NULL; + if_t ndev = NULL; u8 edst[MAX_ADDR_LEN]; int ret; @@ -860,7 +858,7 @@ static void resolve_cb(int status, struct sockaddr *src_addr, int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, const union ib_gid *dgid, - u8 *dmac, struct ifnet *dev, + u8 *dmac, if_t dev, int *hoplimit) { int ret = 0; @@ -874,7 +872,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, memset(&dev_addr, 0, sizeof(dev_addr)); - dev_addr.bound_dev_if = dev->if_index; + dev_addr.bound_dev_if = if_getindex(dev); dev_addr.net = dev_net(dev); ctx.addr = &dev_addr; diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index 1f44841348fe..17b283c48e14 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -183,7 +183,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port, __releases(&table->rwlock) __acquires(&table->rwlock) { int ret = 0; - struct ifnet *old_net_dev; + if_t old_net_dev; enum ib_gid_type old_gid_type; /* in rdma_cap_roce_gid_table, this funciton should be protected by a @@ -311,12 +311,12 @@ static int find_gid(struct ib_gid_table *table, const union ib_gid *gid, return found; } -static void addrconf_ifid_eui48(u8 *eui, struct ifnet *dev) +static void addrconf_ifid_eui48(u8 *eui, if_t dev) { - if (dev->if_addrlen != ETH_ALEN) + if (if_getaddrlen(dev) != ETH_ALEN) return; - memcpy(eui, IF_LLADDR(dev), 3); - memcpy(eui + 5, IF_LLADDR(dev) + 3, 3); + memcpy(eui, if_getlladdr(dev), 3); + memcpy(eui + 5, if_getlladdr(dev) + 3, 3); /* NOTE: The scope ID is added by the GID to IP conversion */ @@ -325,7 +325,7 @@ static void addrconf_ifid_eui48(u8 *eui, struct ifnet *dev) eui[0] ^= 2; } -static void make_default_gid(struct ifnet *dev, union ib_gid *gid) +static void make_default_gid(if_t dev, union ib_gid *gid) { gid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL); addrconf_ifid_eui48(&gid->raw[8], dev); @@ -400,7 +400,7 @@ out_unlock: } int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, - struct ifnet *ndev) + if_t ndev) { struct ib_gid_table **ports_table = ib_dev->cache.gid_cache; struct ib_gid_table *table; @@ -447,8 +447,8 @@ static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index, memcpy(attr, &table->data_vec[index].attr, sizeof(*attr)); /* make sure network device is valid and attached */ if (attr->ndev != NULL && - (attr->ndev->if_flags & IFF_DYING) == 0 && - attr->ndev->if_addr != NULL) + (if_getflags(attr->ndev) & IFF_DYING) == 0 && + if_getifaddr(attr->ndev) != NULL) dev_hold(attr->ndev); else attr->ndev = NULL; @@ -490,7 +490,7 @@ static int _ib_cache_gid_table_find(struct ib_device *ib_dev, static int ib_cache_gid_find(struct ib_device *ib_dev, const union ib_gid *gid, enum ib_gid_type gid_type, - struct ifnet *ndev, u8 *port, + if_t ndev, u8 *port, u16 *index) { unsigned long mask = GID_ATTR_FIND_MASK_GID | @@ -507,7 +507,7 @@ static int ib_cache_gid_find(struct ib_device *ib_dev, int ib_find_cached_gid_by_port(struct ib_device *ib_dev, const union ib_gid *gid, enum ib_gid_type gid_type, - u8 port, struct ifnet *ndev, + u8 port, if_t ndev, u16 *index) { int local_index; @@ -672,7 +672,7 @@ static void cleanup_gid_table_port(struct ib_device *ib_dev, u8 port, } void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, - struct ifnet *ndev, + if_t ndev, unsigned long gid_type_mask, enum ib_cache_gid_default_mode mode) { @@ -899,7 +899,7 @@ EXPORT_SYMBOL(ib_get_cached_gid); int ib_find_cached_gid(struct ib_device *device, const union ib_gid *gid, enum ib_gid_type gid_type, - struct ifnet *ndev, + if_t ndev, u8 *port_num, u16 *index) { diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 45f316252b69..f7812fe4259a 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -503,7 +503,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av, unsigned long flags; int ret; u8 p; - struct ifnet *ndev = ib_get_ndev_from_path(path); + if_t ndev = ib_get_ndev_from_path(path); read_lock_irqsave(&cm.device_lock, flags); list_for_each_entry(cm_dev, &cm.device_list, list) { @@ -1819,7 +1819,7 @@ static int cm_req_handler(struct cm_work *work) &gid, &gid_attr); if (!ret) { if (gid_attr.ndev) { - work->path[0].ifindex = gid_attr.ndev->if_index; + work->path[0].ifindex = if_getindex(gid_attr.ndev); work->path[0].net = dev_net(gid_attr.ndev); dev_put(gid_attr.ndev); } @@ -1833,7 +1833,7 @@ static int cm_req_handler(struct cm_work *work) &work->path[0].sgid, &gid_attr); if (!err && gid_attr.ndev) { - work->path[0].ifindex = gid_attr.ndev->if_index; + work->path[0].ifindex = if_getindex(gid_attr.ndev); work->path[0].net = dev_net(gid_attr.ndev); dev_put(gid_attr.ndev); } diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 85af3330f08a..f8a346dac35e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -461,7 +461,7 @@ static inline void sdp_set_ip_ver(struct sdp_hh *hh, u8 ip_ver) hh->ipv_cap = (ip_ver << 4) | (hh->ipv_cap & 0xF); } -static int cma_igmp_send(struct ifnet *ndev, const union ib_gid *mgid, bool join) +static int cma_igmp_send(if_t ndev, const union ib_gid *mgid, bool join) { int retval; @@ -470,7 +470,7 @@ static int cma_igmp_send(struct ifnet *ndev, const union ib_gid *mgid, bool join rdma_gid2ip(&addr._sockaddr, mgid); - CURVNET_SET_QUIET(ndev->if_vnet); + CURVNET_SET_QUIET(if_getvnet(ndev)); if (join) retval = -if_addmulti(ndev, &addr._sockaddr, NULL); else @@ -603,7 +603,7 @@ static inline int cma_validate_port(struct ib_device *device, u8 port, const struct rdma_dev_addr *dev_addr) { const int dev_type = dev_addr->dev_type; - struct ifnet *ndev; + if_t ndev; int ret = -ENODEV; if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port)) @@ -1396,21 +1396,21 @@ static bool validate_ipv4_net_dev_addr(struct vnet *vnet, } #endif -static bool validate_ipv4_net_dev(struct ifnet *net_dev, +static bool validate_ipv4_net_dev(if_t net_dev, const struct sockaddr_in *dst_addr, const struct sockaddr_in *src_addr) { #ifdef INET __be32 daddr = dst_addr->sin_addr.s_addr, saddr = src_addr->sin_addr.s_addr; - struct ifnet *dst_dev; + if_t dst_dev; struct nhop_object *nh; bool ret; - if (validate_ipv4_net_dev_addr(net_dev->if_vnet, saddr, daddr)) + if (validate_ipv4_net_dev_addr(if_getvnet(net_dev), saddr, daddr)) return false; - dst_dev = ip_ifp_find(net_dev->if_vnet, daddr); + dst_dev = ip_ifp_find(if_getvnet(net_dev), daddr); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1424,7 +1424,7 @@ static bool validate_ipv4_net_dev(struct ifnet *net_dev, if (saddr == daddr) return true; - CURVNET_SET(net_dev->if_vnet); + CURVNET_SET(if_getvnet(net_dev)); nh = fib4_lookup(RT_DEFAULT_FIB, src_addr->sin_addr, 0, NHR_NONE, 0); if (nh != NULL) ret = (nh->nh_ifp == net_dev); @@ -1437,19 +1437,19 @@ static bool validate_ipv4_net_dev(struct ifnet *net_dev, #endif } -static bool validate_ipv6_net_dev(struct ifnet *net_dev, +static bool validate_ipv6_net_dev(if_t net_dev, const struct sockaddr_in6 *dst_addr, const struct sockaddr_in6 *src_addr) { #ifdef INET6 struct sockaddr_in6 src_tmp = *src_addr; struct sockaddr_in6 dst_tmp = *dst_addr; - struct ifnet *dst_dev; + if_t dst_dev; struct nhop_object *nh; bool ret; - dst_dev = ip6_ifp_find(net_dev->if_vnet, dst_tmp.sin6_addr, - net_dev->if_index); + dst_dev = ip6_ifp_find(if_getvnet(net_dev), dst_tmp.sin6_addr, + if_getindex(net_dev)); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1457,15 +1457,15 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev, } dev_put(dst_dev); - CURVNET_SET(net_dev->if_vnet); + CURVNET_SET(if_getvnet(net_dev)); /* * Make sure the scope ID gets embedded. */ - src_tmp.sin6_scope_id = net_dev->if_index; + src_tmp.sin6_scope_id = if_getindex(net_dev); sa6_embedscope(&src_tmp, 0); - dst_tmp.sin6_scope_id = net_dev->if_index; + dst_tmp.sin6_scope_id = if_getindex(net_dev); sa6_embedscope(&dst_tmp, 0); /* @@ -1478,7 +1478,7 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev, } else { /* non-loopback case */ nh = fib6_lookup(RT_DEFAULT_FIB, &src_addr->sin6_addr, - net_dev->if_index, NHR_NONE, 0); + if_getindex(net_dev), NHR_NONE, 0); if (nh != NULL) ret = (nh->nh_ifp == net_dev); else @@ -1491,7 +1491,7 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev, #endif } -static bool validate_net_dev(struct ifnet *net_dev, +static bool validate_net_dev(if_t net_dev, const struct sockaddr *daddr, const struct sockaddr *saddr) { @@ -1514,7 +1514,7 @@ static bool validate_net_dev(struct ifnet *net_dev, } } -static struct ifnet * +static if_t roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num, const struct ib_cm_event *ib_event) { @@ -1534,13 +1534,13 @@ roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num, return (sgid_attr.ndev); } -static struct ifnet *cma_get_net_dev(struct ib_cm_event *ib_event, +static if_t cma_get_net_dev(struct ib_cm_event *ib_event, const struct cma_req_info *req) { struct sockaddr_storage listen_addr_storage, src_addr_storage; struct sockaddr *listen_addr = (struct sockaddr *)&listen_addr_storage, *src_addr = (struct sockaddr *)&src_addr_storage; - struct ifnet *net_dev; + if_t net_dev; const union ib_gid *gid = req->has_gid ? &req->local_gid : NULL; struct epoch_tracker et; int err; @@ -1672,7 +1672,7 @@ static bool cma_protocol_roce(const struct rdma_cm_id *id) } static bool cma_match_net_dev(const struct rdma_cm_id *id, - const struct ifnet *net_dev, + const if_t net_dev, u8 port_num) { const struct rdma_addr *addr = &id->route.addr; @@ -1694,7 +1694,7 @@ static bool cma_match_net_dev(const struct rdma_cm_id *id, return !addr->dev_addr.bound_dev_if || (net_eq(dev_net(net_dev), addr->dev_addr.net) && - addr->dev_addr.bound_dev_if == net_dev->if_index); + addr->dev_addr.bound_dev_if == if_getindex(net_dev)); } static struct rdma_id_private *cma_find_listener( @@ -1702,7 +1702,7 @@ static struct rdma_id_private *cma_find_listener( const struct ib_cm_id *cm_id, const struct ib_cm_event *ib_event, const struct cma_req_info *req, - const struct ifnet *net_dev) + const if_t net_dev) { struct rdma_id_private *id_priv, *id_priv_dev; @@ -1729,7 +1729,7 @@ static struct rdma_id_private *cma_find_listener( static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event, - struct ifnet **net_dev) + if_t *net_dev) { struct cma_req_info req; struct rdma_bind_list *bind_list; @@ -1864,7 +1864,7 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) if (mc->igmp_joined) { struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; - struct ifnet *ndev = NULL; + if_t ndev = NULL; if (dev_addr->bound_dev_if) ndev = dev_get_by_index(dev_addr->net, @@ -2053,7 +2053,7 @@ out: static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id, struct ib_cm_event *ib_event, - struct ifnet *net_dev) + if_t net_dev) { struct rdma_id_private *id_priv; struct rdma_cm_id *id; @@ -2115,7 +2115,7 @@ err: static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id, struct ib_cm_event *ib_event, - struct ifnet *net_dev) + if_t net_dev) { struct rdma_id_private *id_priv; struct rdma_cm_id *id; @@ -2183,7 +2183,7 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) { struct rdma_id_private *listen_id, *conn_id = NULL; struct rdma_cm_event event; - struct ifnet *net_dev; + if_t net_dev; int offset, ret; listen_id = cma_id_from_event(cm_id, ib_event, &net_dev); @@ -2731,7 +2731,7 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms) return 0; } -static int iboe_tos_to_sl(struct ifnet *ndev, int tos) +static int iboe_tos_to_sl(if_t ndev, int tos) { /* get service level, SL, from IPv4 type of service, TOS */ int sl = (tos >> 5) & 0x7; @@ -2758,7 +2758,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) struct rdma_addr *addr = &route->addr; struct cma_work *work; int ret; - struct ifnet *ndev = NULL; + if_t ndev = NULL; work = kzalloc(sizeof *work, GFP_KERNEL); @@ -2786,8 +2786,8 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) goto err2; } - route->path_rec->net = ndev->if_vnet; - route->path_rec->ifindex = ndev->if_index; + route->path_rec->net = if_getvnet(ndev); + route->path_rec->ifindex = if_getindex(ndev); supported_gids = roce_gid_type_mask_support(id_priv->id.device, id_priv->id.port_num); route->path_rec->gid_type = @@ -2820,7 +2820,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) route->path_rec->mtu_selector = IB_SA_EQ; route->path_rec->sl = iboe_tos_to_sl(ndev, id_priv->tos); route->path_rec->traffic_class = id_priv->tos; - route->path_rec->mtu = iboe_get_mtu(ndev->if_mtu); + route->path_rec->mtu = iboe_get_mtu(if_getmtu(ndev)); route->path_rec->rate_selector = IB_SA_EQ; route->path_rec->rate = iboe_get_rate(ndev); dev_put(ndev); @@ -4083,7 +4083,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) if (!status) { struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; - struct ifnet *ndev = + if_t ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); enum ib_gid_type gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - @@ -4310,7 +4310,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; int err = 0; struct sockaddr *addr = (struct sockaddr *)&mc->addr; - struct ifnet *ndev = NULL; + if_t ndev = NULL; enum ib_gid_type gid_type; bool send_only; @@ -4345,7 +4345,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, } mc->multicast.ib->rec.rate = iboe_get_rate(ndev); mc->multicast.ib->rec.hop_limit = 1; - mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->if_mtu); + mc->multicast.ib->rec.mtu = iboe_get_mtu(if_getmtu(ndev)); if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) { if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { @@ -4456,7 +4456,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) if (mc->igmp_joined) { struct rdma_dev_addr *dev_addr = &id->route.addr.dev_addr; - struct ifnet *ndev = NULL; + if_t ndev = NULL; if (dev_addr->bound_dev_if) ndev = dev_get_by_index(dev_addr->net, diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index dc0e6a5866d2..f4ab1f945f58 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -732,12 +732,12 @@ void ib_enum_roce_netdev(struct ib_device *ib_dev, for (port = rdma_start_port(ib_dev); port <= rdma_end_port(ib_dev); port++) if (rdma_protocol_roce(ib_dev, port)) { - struct ifnet *idev = NULL; + if_t idev = NULL; if (ib_dev->get_netdev) idev = ib_dev->get_netdev(ib_dev, port); - if (idev && (idev->if_flags & IFF_DYING)) { + if (idev && (if_getflags(idev) & IFF_DYING)) { dev_put(idev); idev = NULL; } @@ -779,7 +779,7 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter, * * @ndev: Pointer to netdevice */ -void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev) +void ib_cache_gid_del_all_by_netdev(if_t ndev) { struct ib_device *ib_dev; u8 port; @@ -875,7 +875,7 @@ EXPORT_SYMBOL(ib_modify_port); * parameter may be NULL. */ int ib_find_gid(struct ib_device *device, union ib_gid *gid, - enum ib_gid_type gid_type, struct ifnet *ndev, + enum ib_gid_type gid_type, if_t ndev, u8 *port_num, u16 *index) { union ib_gid tmp_gid; @@ -959,13 +959,13 @@ EXPORT_SYMBOL(ib_find_pkey); * @addr: Contains the IP address that the request specified as its * destination. */ -struct ifnet *ib_get_net_dev_by_params(struct ib_device *dev, +if_t ib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey, const union ib_gid *gid, const struct sockaddr *addr) { - struct ifnet *net_dev = NULL; + if_t net_dev = NULL; struct ib_client_data *context; if (!rdma_protocol_ib(dev, port)) diff --git a/sys/ofed/drivers/infiniband/core/ib_multicast.c b/sys/ofed/drivers/infiniband/core/ib_multicast.c index 3784a3e5e290..b323f17a99ea 100644 --- a/sys/ofed/drivers/infiniband/core/ib_multicast.c +++ b/sys/ofed/drivers/infiniband/core/ib_multicast.c @@ -723,7 +723,7 @@ EXPORT_SYMBOL(ib_sa_get_mcmember_rec); int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num, struct ib_sa_mcmember_rec *rec, - struct ifnet *ndev, + if_t ndev, enum ib_gid_type gid_type, struct ib_ah_attr *ah_attr) { diff --git a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c index fb19f2944180..1396a4aacf3a 100644 --- a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c +++ b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c @@ -56,7 +56,7 @@ enum gid_op_type { struct roce_netdev_event_work { struct work_struct work; - struct ifnet *ndev; + if_t ndev; }; struct roce_rescan_work { @@ -91,7 +91,7 @@ unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u8 port) EXPORT_SYMBOL(roce_gid_type_mask_support); static void update_gid(enum gid_op_type gid_op, struct ib_device *ib_dev, - u8 port, union ib_gid *gid, struct ifnet *ndev) + u8 port, union ib_gid *gid, if_t ndev) { int i; unsigned long gid_type_mask = roce_gid_type_mask_support(ib_dev, port); @@ -119,9 +119,9 @@ static void update_gid(enum gid_op_type gid_op, struct ib_device *ib_dev, static int roce_gid_match_netdev(struct ib_device *ib_dev, u8 port, - struct ifnet *idev, void *cookie) + if_t idev, void *cookie) { - struct ifnet *ndev = (struct ifnet *)cookie; + if_t ndev = (if_t )cookie; if (idev == NULL) return (0); return (ndev == idev); @@ -129,7 +129,7 @@ roce_gid_match_netdev(struct ib_device *ib_dev, u8 port, static int roce_gid_match_all(struct ib_device *ib_dev, u8 port, - struct ifnet *idev, void *cookie) + if_t idev, void *cookie) { if (idev == NULL) return (0); @@ -138,7 +138,7 @@ roce_gid_match_all(struct ib_device *ib_dev, u8 port, static int roce_gid_enum_netdev_default(struct ib_device *ib_dev, - u8 port, struct ifnet *idev) + u8 port, if_t idev) { unsigned long gid_type_mask; @@ -150,32 +150,81 @@ roce_gid_enum_netdev_default(struct ib_device *ib_dev, return (hweight_long(gid_type_mask)); } +struct ipx_entry { + STAILQ_ENTRY(ipx_entry) entry; + union ipx_addr { + struct sockaddr sa[0]; + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } ipx_addr; + if_t ndev; +}; + +STAILQ_HEAD(ipx_queue, ipx_entry); + +#ifdef INET +static u_int +roce_gid_update_addr_ifa4_cb(void *arg, struct ifaddr *ifa, u_int count) +{ + struct ipx_queue *ipx_head = arg; + struct ipx_entry *entry; + + entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + if (entry == NULL) { + pr_warn("roce_gid_update_addr_callback: " + "couldn't allocate entry for IPv4 update\n"); + return (0); + } + entry->ipx_addr.v4 = *((struct sockaddr_in *)ifa->ifa_addr); + entry->ndev = ifa->ifa_ifp; + STAILQ_INSERT_TAIL(ipx_head, entry, entry); + + return (1); +} +#endif + +#ifdef INET6 +static u_int +roce_gid_update_addr_ifa6_cb(void *arg, struct ifaddr *ifa, u_int count) +{ + struct ipx_queue *ipx_head = arg; + struct ipx_entry *entry; + + entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + if (entry == NULL) { + pr_warn("roce_gid_update_addr_callback: " + "couldn't allocate entry for IPv6 update\n"); + return (0); + } + entry->ipx_addr.v6 = *((struct sockaddr_in6 *)ifa->ifa_addr); + entry->ndev = ifa->ifa_ifp; + + /* trash IPv6 scope ID */ + sa6_recoverscope(&entry->ipx_addr.v6); + entry->ipx_addr.v6.sin6_scope_id = 0; + + STAILQ_INSERT_TAIL(ipx_head, entry, entry); + + return (1); +} +#endif + static void roce_gid_update_addr_callback(struct ib_device *device, u8 port, - struct ifnet *ndev, void *cookie) + if_t ndev, void *cookie) { - struct ipx_entry { - STAILQ_ENTRY(ipx_entry) entry; - union ipx_addr { - struct sockaddr sa[0]; - struct sockaddr_in v4; - struct sockaddr_in6 v6; - } ipx_addr; - struct ifnet *ndev; *** 1566 LINES SKIPPED *** From nobody Fri Mar 24 15:49:12 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjmpw3YWLz41jkx; Fri, 24 Mar 2023 15:49: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 4Pjmpw3DKdz4Hd9; Fri, 24 Mar 2023 15:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HQrzt3kOZQfQHauQfaqZt3mS5R50cbyDIOjLZHd4mpY=; b=lG39qw98QwtMOCUuRgNjoC/e8x8YpMRHfdMzJ9492IxfHW4dg2fMvEF/S3gtFLbqgUn6Kv ZSz3d18hMoj2zDYKHEd34c7SQMq877HwgIoVe0Y0l0yI8scktFrSQRP1MypubOnRxX/r+g 0wTK8pBM/P3Szh1OPsARyAs8H1EagP9V9Wj6WElqf/9r77srYMZ3s4T7Zkjeqe4c68WECh OCpYmfFtSVL8f6+tMPGC+3TQKXtTEw4tmNqWSwWdBO+08i9lm9rc3LCnsgoYyCkC+ofaAI SOHdMyv5Bb0tT9Kr4hoHfXj7BrorX+vURxADPPV8WOVrkFoLirwcxYAXCb+3jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HQrzt3kOZQfQHauQfaqZt3mS5R50cbyDIOjLZHd4mpY=; b=DM4INbaL0aq1OIlyXv2+fddj/6hg/jR84Rga+dfd+Z/HHAak5EUb4dycp/p0RjlKCCHz8E U0p/R+C1S4PKeo9oFUCMfQKyZM0XVjBSIcPZFtPY7tJqqMAMe2sWppJ88NZeKz4STBuhaY PmpRUbB7OCyFEUAcLBiHyZgy73YCXAOEaMMmG+EQcO8dB6GjA13PlUsHADEeeDV3Zu3iGj mmV5T/Dl8JS717b0d4ZeMKr86Ry2Y+HaG05zGA6RC2pwgL0wBks8K4t2azia0WHZiKhYXY VIzGTJ3Y1wWuab9wBbh7xzEWLGL7wWOmz2liRf2hPPggXRXTgeXOiOPBqmVuQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679672952; a=rsa-sha256; cv=none; b=vF43PpI5GNBwEADi5MOOn+d6wi1CazUBSXAfA/PrGvmJEp18YZBmgaPWYct93hwOI7+sAC c8QIVcr5Mmqrx+Am83MpcloMalv/5x/WZ2kvb8cMuDtt0yduvbaGdxul3ppAgemQfTA96d d0j+nZwn8NBJIOci5Q2gtOXu6z45KK3JF9ErEgQ01namPEnLeva/L+wsErgm3zygWD5Sbw txidYD5Ww1t8LCw/NU1/XZ/CGuKSDljpjaJEnUp02H28k6GCq0Rn0xTDrnFb7CQeV+7VlC odhu9T9AGrbyTGbyarJ4UNu3rLcnfuJHn92k7Me8OCMnQA+7dqkhWTmDTTUJkg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjmpw2FTrzP19; Fri, 24 Mar 2023 15:49: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 32OFnCrA078735; Fri, 24 Mar 2023 15:49:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OFnC8d078734; Fri, 24 Mar 2023 15:49:12 GMT (envelope-from git) Date: Fri, 24 Mar 2023 15:49:12 GMT Message-Id: <202303241549.32OFnC8d078734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 727bfe3894ab - main - Mechanically convert qlnx(4) to IfAPI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 727bfe3894abaec854e580e52d352a8945f12185 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=727bfe3894abaec854e580e52d352a8945f12185 commit 727bfe3894abaec854e580e52d352a8945f12185 Author: Justin Hibbits AuthorDate: 2022-09-23 15:27:39 +0000 Commit: Justin Hibbits CommitDate: 2023-03-24 14:09:53 +0000 Mechanically convert qlnx(4) to IfAPI Reviewed By: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37856 --- sys/dev/qlnx/qlnxe/qlnx_def.h | 4 +- sys/dev/qlnx/qlnxe/qlnx_ioctl.c | 2 +- sys/dev/qlnx/qlnxe/qlnx_os.c | 203 +++++++++++++++++++-------------------- sys/dev/qlnx/qlnxr/qlnxr_cm.c | 2 +- sys/dev/qlnx/qlnxr/qlnxr_os.c | 41 +++++--- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 26 ++--- 6 files changed, 143 insertions(+), 135 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_def.h b/sys/dev/qlnx/qlnxe/qlnx_def.h index 87ef7985647d..cc8fb3f5f7eb 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_def.h +++ b/sys/dev/qlnx/qlnxe/qlnx_def.h @@ -371,7 +371,7 @@ struct qlnx_host { uint8_t dev_unit; uint16_t device_id; - struct ifnet *ifp; + if_t ifp; int if_flags; volatile int link_up; struct ifmedia media; @@ -512,7 +512,7 @@ typedef struct qlnx_host qlnx_host_t; #define QL_MIN(x, y) ((x < y) ? x : y) #define QL_RUNNING(ifp) \ - ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \ + ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \ IFF_DRV_RUNNING) #define QLNX_MAX_MTU 9000 diff --git a/sys/dev/qlnx/qlnxe/qlnx_ioctl.c b/sys/dev/qlnx/qlnxe/qlnx_ioctl.c index f87cb8b49921..aa382a1046e3 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_ioctl.c +++ b/sys/dev/qlnx/qlnxe/qlnx_ioctl.c @@ -78,7 +78,7 @@ int qlnx_make_cdev(qlnx_host_t *ha) { ha->ioctl_dev = make_dev(&qlnx_cdevsw, - ha->ifp->if_dunit, + if_getdunit(ha->ifp), UID_ROOT, GID_WHEEL, 0600, diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 9d31024c29c1..bbd4c0fe7e8c 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -89,19 +89,19 @@ static void qlnx_init_locked(qlnx_host_t *ha); static int qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi); static int qlnx_set_promisc(qlnx_host_t *ha); static int qlnx_set_allmulti(qlnx_host_t *ha); -static int qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static int qlnx_media_change(struct ifnet *ifp); -static void qlnx_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); +static int qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data); +static int qlnx_media_change(if_t ifp); +static void qlnx_media_status(if_t ifp, struct ifmediareq *ifmr); static void qlnx_stop(qlnx_host_t *ha); static int qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct mbuf **m_headp); static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); -static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp); -static int qlnx_transmit_locked(struct ifnet *ifp, struct qlnx_fastpath *fp, +static int qlnx_transmit(if_t ifp, struct mbuf *mp); +static int qlnx_transmit_locked(if_t ifp, struct qlnx_fastpath *fp, struct mbuf *mp); -static void qlnx_qflush(struct ifnet *ifp); +static void qlnx_qflush(if_t ifp); static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); static void qlnx_free_parent_dma_tag(qlnx_host_t *ha); @@ -549,7 +549,7 @@ qlnx_fp_taskqueue(void *context, int pending) { struct qlnx_fastpath *fp; qlnx_host_t *ha; - struct ifnet *ifp; + if_t ifp; fp = context; @@ -560,7 +560,7 @@ qlnx_fp_taskqueue(void *context, int pending) ifp = ha->ifp; - if(ifp->if_drv_flags & IFF_DRV_RUNNING) { + if(if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if (!drbr_empty(ifp, fp->tx_br)) { if(mtx_trylock(&fp->tx_mtx)) { #ifdef QLNX_TRACE_PERF_DATA @@ -1378,7 +1378,7 @@ qlnx_trigger_dump(qlnx_host_t *ha) int i; if (ha->ifp != NULL) - ha->ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); + if_setdrvflagbits(ha->ifp, 0, (IFF_DRV_OACTIVE | IFF_DRV_RUNNING)); QL_DPRINT2(ha, "enter\n"); @@ -2303,7 +2303,7 @@ static void qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) { uint16_t device_id; - struct ifnet *ifp; + if_t ifp; ifp = ha->ifp = if_alloc(IFT_ETHER); @@ -2315,31 +2315,30 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) device_id = pci_get_device(ha->pci_dev); if (device_id == QLOGIC_PCI_DEVICE_ID_1634) - ifp->if_baudrate = IF_Gbps(40); + if_setbaudrate(ifp, IF_Gbps(40)); else if ((device_id == QLOGIC_PCI_DEVICE_ID_1656) || (device_id == QLOGIC_PCI_DEVICE_ID_8070)) - ifp->if_baudrate = IF_Gbps(25); + if_setbaudrate(ifp, IF_Gbps(25)); else if (device_id == QLOGIC_PCI_DEVICE_ID_1654) - ifp->if_baudrate = IF_Gbps(50); + if_setbaudrate(ifp, IF_Gbps(50)); else if (device_id == QLOGIC_PCI_DEVICE_ID_1644) - ifp->if_baudrate = IF_Gbps(100); + if_setbaudrate(ifp, IF_Gbps(100)); - ifp->if_capabilities = IFCAP_LINKSTATE; + if_setcapabilities(ifp, IFCAP_LINKSTATE); - ifp->if_init = qlnx_init; - ifp->if_softc = ha; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_ioctl = qlnx_ioctl; - ifp->if_transmit = qlnx_transmit; - ifp->if_qflush = qlnx_qflush; + if_setinitfn(ifp, qlnx_init); + if_setsoftc(ifp, ha); + if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setioctlfn(ifp, qlnx_ioctl); + if_settransmitfn(ifp, qlnx_transmit); + if_setqflushfn(ifp, qlnx_qflush); - IFQ_SET_MAXLEN(&ifp->if_snd, qlnx_get_ifq_snd_maxlen(ha)); - ifp->if_snd.ifq_drv_maxlen = qlnx_get_ifq_snd_maxlen(ha); - IFQ_SET_READY(&ifp->if_snd); + if_setsendqlen(ifp, qlnx_get_ifq_snd_maxlen(ha)); + if_setsendqready(ifp); if_setgetcounterfn(ifp, qlnx_get_counter); - ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; memcpy(ha->primary_mac, qlnx_get_mac_addr(ha), ETH_ALEN); @@ -2359,33 +2358,33 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) } ether_ifattach(ifp, ha->primary_mac); - bcopy(IF_LLADDR(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN); + bcopy(if_getlladdr(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN); - ifp->if_capabilities = IFCAP_HWCSUM; - ifp->if_capabilities |= IFCAP_JUMBO_MTU; + if_setcapabilities(ifp, IFCAP_HWCSUM); + if_setcapabilitiesbit(ifp, IFCAP_JUMBO_MTU, 0); - ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; - ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTSO; - ifp->if_capabilities |= IFCAP_TSO4; - ifp->if_capabilities |= IFCAP_TSO6; - ifp->if_capabilities |= IFCAP_LRO; + if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWFILTER, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWCSUM, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTSO, 0); + if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0); + if_setcapabilitiesbit(ifp, IFCAP_TSO6, 0); + if_setcapabilitiesbit(ifp, IFCAP_LRO, 0); - ifp->if_hw_tsomax = QLNX_MAX_TSO_FRAME_SIZE - - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); - ifp->if_hw_tsomaxsegcount = QLNX_MAX_SEGMENTS - 1 /* hdr */; - ifp->if_hw_tsomaxsegsize = QLNX_MAX_TX_MBUF_SIZE; + if_sethwtsomax(ifp, QLNX_MAX_TSO_FRAME_SIZE - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); + if_sethwtsomaxsegcount(ifp, QLNX_MAX_SEGMENTS - 1); /* hdr */ + if_sethwtsomaxsegsize(ifp, QLNX_MAX_TX_MBUF_SIZE); - ifp->if_capenable = ifp->if_capabilities; + if_setcapenable(ifp, if_getcapabilities(ifp)); - ifp->if_hwassist = CSUM_IP; - ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; - ifp->if_hwassist |= CSUM_TCP_IPV6 | CSUM_UDP_IPV6; - ifp->if_hwassist |= CSUM_TSO; + if_sethwassist(ifp, CSUM_IP); + if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); + if_sethwassistbits(ifp, CSUM_TCP_IPV6 | CSUM_UDP_IPV6, 0); + if_sethwassistbits(ifp, CSUM_TSO, 0); - ifp->if_hdrlen = sizeof(struct ether_vlan_header); + if_setifheaderlen(ifp, sizeof(struct ether_vlan_header)); ifmedia_init(&ha->media, IFM_IMASK, qlnx_media_change,\ qlnx_media_status); @@ -2423,15 +2422,15 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) static void qlnx_init_locked(qlnx_host_t *ha) { - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; QL_DPRINT1(ha, "Driver Initialization start \n"); qlnx_stop(ha); if (qlnx_load(ha) == 0) { - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0); + if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); #ifdef QLNX_ENABLE_IWARP if (qlnx_vf_device(ha) != 0) { @@ -2582,7 +2581,7 @@ static int qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) { uint8_t mta[QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN]; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; u_int mcnt; if (qlnx_vf_device(ha) == 0) @@ -2631,22 +2630,22 @@ qlnx_set_allmulti(qlnx_host_t *ha) } static int -qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data) { int ret = 0, mask; struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; qlnx_host_t *ha; - ha = (qlnx_host_t *)ifp->if_softc; + ha = (qlnx_host_t *)if_getsoftc(ifp); switch (cmd) { case SIOCSIFADDR: QL_DPRINT4(ha, "SIOCSIFADDR (0x%lx)\n", cmd); if (ifa->ifa_addr->sa_family == AF_INET) { - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if_setflagbits(ifp, IFF_UP, 0); + if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { QLNX_LOCK(ha); qlnx_init_locked(ha); QLNX_UNLOCK(ha); @@ -2667,10 +2666,10 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ret = EINVAL; } else { QLNX_LOCK(ha); - ifp->if_mtu = ifr->ifr_mtu; + if_setmtu(ifp, ifr->ifr_mtu); ha->max_frame_size = - ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { qlnx_init_locked(ha); } @@ -2684,24 +2683,24 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) QLNX_LOCK(ha); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if ((ifp->if_flags ^ ha->if_flags) & + if (if_getflags(ifp) & IFF_UP) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { + if ((if_getflags(ifp) ^ ha->if_flags) & IFF_PROMISC) { ret = qlnx_set_promisc(ha); - } else if ((ifp->if_flags ^ ha->if_flags) & + } else if ((if_getflags(ifp) ^ ha->if_flags) & IFF_ALLMULTI) { ret = qlnx_set_allmulti(ha); } } else { - ha->max_frame_size = ifp->if_mtu + + ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; qlnx_init_locked(ha); } } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) qlnx_stop(ha); - ha->if_flags = ifp->if_flags; + ha->if_flags = if_getflags(ifp); } QLNX_UNLOCK(ha); @@ -2710,7 +2709,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCADDMULTI", cmd); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if (qlnx_set_multi(ha, 1)) ret = EINVAL; } @@ -2719,7 +2718,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCDELMULTI: QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCDELMULTI", cmd); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if (qlnx_set_multi(ha, 0)) ret = EINVAL; } @@ -2734,26 +2733,26 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: - mask = ifr->ifr_reqcap ^ ifp->if_capenable; + mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); QL_DPRINT4(ha, "SIOCSIFCAP (0x%lx)\n", cmd); if (mask & IFCAP_HWCSUM) - ifp->if_capenable ^= IFCAP_HWCSUM; + if_togglecapenable(ifp, IFCAP_HWCSUM); if (mask & IFCAP_TSO4) - ifp->if_capenable ^= IFCAP_TSO4; + if_togglecapenable(ifp, IFCAP_TSO4); if (mask & IFCAP_TSO6) - ifp->if_capenable ^= IFCAP_TSO6; + if_togglecapenable(ifp, IFCAP_TSO6); if (mask & IFCAP_VLAN_HWTAGGING) - ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if_togglecapenable(ifp, IFCAP_VLAN_HWTAGGING); if (mask & IFCAP_VLAN_HWTSO) - ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + if_togglecapenable(ifp, IFCAP_VLAN_HWTSO); if (mask & IFCAP_LRO) - ifp->if_capenable ^= IFCAP_LRO; + if_togglecapenable(ifp, IFCAP_LRO); QLNX_LOCK(ha); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) qlnx_init_locked(ha); QLNX_UNLOCK(ha); @@ -2819,13 +2818,13 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static int -qlnx_media_change(struct ifnet *ifp) +qlnx_media_change(if_t ifp) { qlnx_host_t *ha; struct ifmedia *ifm; int ret = 0; - ha = (qlnx_host_t *)ifp->if_softc; + ha = (qlnx_host_t *)if_getsoftc(ifp); QL_DPRINT2(ha, "enter\n"); @@ -2840,11 +2839,11 @@ qlnx_media_change(struct ifnet *ifp) } static void -qlnx_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +qlnx_media_status(if_t ifp, struct ifmediareq *ifmr) { qlnx_host_t *ha; - ha = (qlnx_host_t *)ifp->if_softc; + ha = (qlnx_host_t *)if_getsoftc(ifp); QL_DPRINT2(ha, "enter\n"); @@ -2991,7 +2990,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, } static int -qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf *mp) +qlnx_transmit_locked(if_t ifp, struct qlnx_fastpath *fp, struct mbuf *mp) { int ret = 0; struct qlnx_tx_queue *txq; @@ -3001,7 +3000,7 @@ qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf * txq = fp->txq[0]; ha = (qlnx_host_t *)fp->edev; - if ((!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || (!ha->link_up)) { + if ((!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) || (!ha->link_up)) { if(mp != NULL) ret = drbr_enqueue(ifp, fp->tx_br, mp); return (ret); @@ -3042,9 +3041,9 @@ qlnx_transmit_locked_exit: } static int -qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) +qlnx_transmit(if_t ifp, struct mbuf *mp) { - qlnx_host_t *ha = (qlnx_host_t *)ifp->if_softc; + qlnx_host_t *ha = (qlnx_host_t *)if_getsoftc(ifp); struct qlnx_fastpath *fp; int rss_id = 0, ret = 0; @@ -3092,14 +3091,14 @@ qlnx_transmit_exit: } static void -qlnx_qflush(struct ifnet *ifp) +qlnx_qflush(if_t ifp) { int rss_id; struct qlnx_fastpath *fp; struct mbuf *mp; qlnx_host_t *ha; - ha = (qlnx_host_t *)ifp->if_softc; + ha = (qlnx_host_t *)if_getsoftc(ifp); QL_DPRINT2(ha, "enter\n"); @@ -3741,10 +3740,10 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct mbuf **m_headp) static void qlnx_stop(qlnx_host_t *ha) { - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; int i; - ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); + if_setdrvflagbits(ifp, 0, (IFF_DRV_OACTIVE | IFF_DRV_RUNNING)); /* * We simply lock and unlock each fp->tx_mtx to @@ -3928,7 +3927,7 @@ qlnx_tpa_start(qlnx_host_t *ha, struct eth_fast_path_rx_tpa_start_cqe *cqe) { uint32_t agg_index; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; struct mbuf *mp; struct mbuf *mpf = NULL, *mpl = NULL, *mpc = NULL; struct sw_rx_data *sw_rx_data; @@ -4360,7 +4359,7 @@ qlnx_tpa_end(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct mbuf *mp; uint32_t agg_index; uint32_t len = 0; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; QL_DPRINT7(ha, "[%d]: enter\n \ \t type = 0x%x\n \ @@ -4511,7 +4510,7 @@ qlnx_tpa_end(qlnx_host_t *ha, struct qlnx_fastpath *fp, fp->rss_id, mp->m_pkthdr.csum_data, (uint64_t)mp->m_pkthdr.csum_flags, mp->m_len, mp->m_pkthdr.len); - (*ifp->if_input)(ifp, mp); + if_input(ifp, mp); rxq->tpa_info[agg_index].mpf = NULL; rxq->tpa_info[agg_index].mpl = NULL; @@ -4527,7 +4526,7 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, uint16_t hw_comp_cons, sw_comp_cons; int rx_pkt = 0; struct qlnx_rx_queue *rxq = fp->rxq; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; struct ecore_dev *cdev = &ha->cdev; struct ecore_hwfn *p_hwfn; @@ -4749,10 +4748,10 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, if (lro_enable) tcp_lro_queue_mbuf(lro, mp); else - (*ifp->if_input)(ifp, mp); + if_input(ifp, mp); #else - (*ifp->if_input)(ifp, mp); + if_input(ifp, mp); #endif /* #ifdef QLNX_SOFT_LRO */ @@ -4814,7 +4813,7 @@ qlnx_fp_isr(void *arg) struct qlnx_tx_queue *txq; uint16_t elem_left; - lro_enable = ha->ifp->if_capenable & IFCAP_LRO; + lro_enable = if_getcapenable(ha->ifp) & IFCAP_LRO; ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); @@ -6287,7 +6286,7 @@ static void qlnx_free_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp) { struct mbuf *mp; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; if (mtx_initialized(&fp->tx_mtx)) { if (fp->tx_br != NULL) { @@ -6632,7 +6631,7 @@ qlnx_start_queues(qlnx_host_t *ha) struct ecore_dev *cdev = &ha->cdev; struct ecore_rss_params *rss_params = &ha->rss_params; struct qlnx_update_vport_params vport_update_params; - struct ifnet *ifp; + if_t ifp; struct ecore_hwfn *p_hwfn; struct ecore_sge_tpa_params tpa_params; struct ecore_queue_start_common_params qparams; @@ -6649,10 +6648,10 @@ qlnx_start_queues(qlnx_host_t *ha) } #ifndef QLNX_SOFT_LRO - hw_lro_enable = ifp->if_capenable & IFCAP_LRO; + hw_lro_enable = if_getcapenable(ifp) & IFCAP_LRO; #endif /* #ifndef QLNX_SOFT_LRO */ - rc = qlnx_start_vport(cdev, vport_id, ifp->if_mtu, drop_ttl0_flg, + rc = qlnx_start_vport(cdev, vport_id, if_getmtu(ifp), drop_ttl0_flg, vlan_removal_en, tx_switching, hw_lro_enable); if (rc) { @@ -6662,7 +6661,7 @@ qlnx_start_queues(qlnx_host_t *ha) QL_DPRINT2(ha, "Start vport ramrod passed, " "vport_id = %d, MTU = %d, vlan_removal_en = %d\n", - vport_id, (int)(ifp->if_mtu + 0xe), vlan_removal_en); + vport_id, (int)(if_getmtu(ifp) + 0xe), vlan_removal_en); for_each_rss(i) { struct ecore_rxq_start_ret_params rx_ret_params; @@ -6800,8 +6799,8 @@ qlnx_start_queues(qlnx_host_t *ha) tpa_params.tpa_gro_consistent_flg = 0; tpa_params.tpa_max_aggs_num = ETH_TPA_MAX_AGGS_NUM; tpa_params.tpa_max_size = (uint16_t)(-1); - tpa_params.tpa_min_size_to_start = ifp->if_mtu/2; - tpa_params.tpa_min_size_to_cont = ifp->if_mtu/2; + tpa_params.tpa_min_size_to_start = if_getmtu(ifp) / 2; + tpa_params.tpa_min_size_to_cont = if_getmtu(ifp) / 2; vport_update_params.sge_tpa_params = &tpa_params; } @@ -7285,12 +7284,12 @@ qlnx_drain_soft_lro(qlnx_host_t *ha) { #ifdef QLNX_SOFT_LRO - struct ifnet *ifp; + if_t ifp; int i; ifp = ha->ifp; - if (ifp->if_capenable & IFCAP_LRO) { + if (if_getcapenable(ifp) & IFCAP_LRO) { for (i = 0; i < ha->num_rss; i++) { struct qlnx_fastpath *fp = &ha->fp_array[i]; struct lro_ctrl *lro; diff --git a/sys/dev/qlnx/qlnxr/qlnxr_cm.c b/sys/dev/qlnx/qlnxr/qlnxr_cm.c index 1f418f83ad37..569dbc6d7472 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_cm.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_cm.c @@ -332,7 +332,7 @@ int qlnxr_ll2_start(struct qlnxr_dev *dev, memset(&data, 0, sizeof(data)); data.input.conn_type = ECORE_LL2_TYPE_ROCE; - data.input.mtu = dev->ha->ifp->if_mtu; + data.input.mtu = if_getmtu(dev->ha->ifp); data.input.rx_num_desc = 8 * 1024; data.input.rx_drop_ttl0_flg = 1; data.input.rx_vlan_removal_en = 0; diff --git a/sys/dev/qlnx/qlnxr/qlnxr_os.c b/sys/dev/qlnx/qlnxr/qlnxr_os.c index aa8386808ebb..0b1a7b67cb1c 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_os.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_os.c @@ -857,25 +857,34 @@ qlnxr_build_sgid_mac(union ib_gid *sgid, unsigned char *mac_addr, static bool qlnxr_add_sgid(struct qlnxr_dev *dev, union ib_gid *new_sgid); -static void -qlnxr_add_ip_based_gid(struct qlnxr_dev *dev, struct ifnet *ifp) -{ - struct ifaddr *ifa; +struct qlnx_cb_s { + struct qlnxr_dev *dev; union ib_gid gid; +}; - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) { - QL_DPRINT12(dev->ha, "IP address : %x\n", ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr.s_addr); - ipv6_addr_set_v4mapped( - ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr.s_addr, - (struct in6_addr *)&gid); - QL_DPRINT12(dev->ha, "gid generated : %llx\n", gid); +static u_int +qlnxr_add_ip_based_gid_cb(void *arg, struct ifaddr *ifa, u_int count) +{ + struct qlnx_cb_s *cba = arg; - qlnxr_add_sgid(dev, &gid); - } - } + QL_DPRINT12(cba->dev->ha, "IP address : %x\n", ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr.s_addr); + ipv6_addr_set_v4mapped( + ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr.s_addr, + (struct in6_addr *)&cba->gid); + QL_DPRINT12(cba->dev->ha, "gid generated : %llx\n", cba->gid); + + qlnxr_add_sgid(cba->dev, &cba->gid); + return (1); +} + +static void +qlnxr_add_ip_based_gid(struct qlnxr_dev *dev, if_t ifp) +{ + struct qlnx_cb_s cba; + + if_foreach_addr_type(ifp, AF_INET, qlnxr_add_ip_based_gid_cb, &cba); for (int i = 0; i < 16; i++) { - QL_DPRINT12(dev->ha, "gid generated : %x\n", gid.raw[i]); + QL_DPRINT12(dev->ha, "gid generated : %x\n", cba.gid.raw[i]); } } @@ -981,7 +990,7 @@ qlnxr_add_default_sgid(struct qlnxr_dev *dev) static int qlnxr_addr_event (struct qlnxr_dev *dev, unsigned long event, - struct ifnet *ifp, + if_t ifp, union ib_gid *gid) { bool is_vlan = false; diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index 310ef2dc6e9f..bc2da02eae45 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -628,7 +628,7 @@ qlnxr_query_port(struct ib_device *ibdev, uint8_t port, } attr->max_mtu = IB_MTU_4096; - attr->active_mtu = iboe_get_mtu(dev->ha->ifp->if_mtu); + attr->active_mtu = iboe_get_mtu(if_getmtu(dev->ha->ifp)); attr->lid = 0; attr->lmc = 0; attr->sm_lid = 0; @@ -3449,12 +3449,12 @@ qlnxr_modify_qp(struct ib_qp *ibqp, } qp->mtu = min(ib_mtu_enum_to_int(attr->path_mtu), ib_mtu_enum_to_int( - iboe_get_mtu(dev->ha->ifp->if_mtu))); + iboe_get_mtu(if_getmtu(dev->ha->ifp)))); } if (qp->mtu == 0) { qp->mtu = ib_mtu_enum_to_int( - iboe_get_mtu(dev->ha->ifp->if_mtu)); + iboe_get_mtu(if_getmtu(dev->ha->ifp))); QL_DPRINT12(ha, "fixing zetoed MTU to qp->mtu = %d\n", qp->mtu); } @@ -3502,7 +3502,7 @@ qlnxr_modify_qp(struct ib_qp *ibqp, qp_params.mtu = qp->mtu; } else { qp_params.mtu = ib_mtu_enum_to_int( - iboe_get_mtu(dev->ha->ifp->if_mtu)); + iboe_get_mtu(if_getmtu(dev->ha->ifp))); } } @@ -4269,7 +4269,7 @@ qlnxr_post_send(struct ib_qp *ibqp, QL_DPRINT12(ha, "exit[ibqp, wr, bad_wr] = [%p, %p, %p]\n", ibqp, wr, bad_wr); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; if (qp->qp_type == IB_QPT_GSI) @@ -4629,7 +4629,7 @@ qlnxr_post_recv(struct ib_qp *ibqp, ha = dev->ha; - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; QL_DPRINT12(ha, "enter\n"); @@ -5224,7 +5224,7 @@ qlnxr_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) QL_DPRINT12(ha, "enter\n"); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; if (cq->destroyed) { @@ -5323,7 +5323,7 @@ qlnxr_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) "cp = %p cons = 0x%x cq_type = 0x%x\n", ibcq, flags, cq, cq->cq_cons, cq->cq_type); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; if (cq->destroyed) { @@ -5899,7 +5899,7 @@ qlnxr_iw_mpa_reply(void *context, QL_DPRINT12(ha, "enter\n"); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; bzero(&rtr_in, sizeof(struct ecore_iwarp_send_rtr_in)); @@ -6089,7 +6089,7 @@ qlnxr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) QL_DPRINT12(ha, "[cm_id, conn_param] = [%p, %p] " "enter \n", cm_id, conn_param); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; qp = idr_find(&dev->qpidr, conn_param->qpn); @@ -6127,7 +6127,7 @@ qlnxr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) in_params.cm_info.remote_port = ntohs(raddr->sin_port); in_params.cm_info.local_port = ntohs(laddr->sin_port); in_params.cm_info.vlan = 0; - in_params.mss = dev->ha->ifp->if_mtu - 40; + in_params.mss = if_getmtu(dev->ha->ifp) - 40; QL_DPRINT12(ha, "remote_ip = [%d.%d.%d.%d] " "local_ip = [%d.%d.%d.%d] remote_port = %d local_port = %d " @@ -6192,7 +6192,7 @@ qlnxr_iw_create_listen(struct iw_cm_id *cm_id, int backlog) QL_DPRINT12(ha, "enter\n"); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; laddr = (struct sockaddr_in *)&cm_id->local_addr; @@ -6284,7 +6284,7 @@ qlnxr_iw_accept(struct iw_cm_id *cm_id, QL_DPRINT12(ha, "enter qpid=%d\n", conn_param->qpn); - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) return -EINVAL; qp = idr_find(&dev->qpidr, conn_param->qpn); From nobody Fri Mar 24 15:49:13 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjmpx5VvFz41jl1; Fri, 24 Mar 2023 15:49: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 4Pjmpx4djCz4HkK; Fri, 24 Mar 2023 15:49:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E140O0H4VNC1zexnkemrdERcKywrYFk84XNOnWBySyc=; b=aadiE1lXKeCpomm5z7eTHzCsrY+2PlZj0hK9H+8OySFoITsIiPEdgqZl3npa+nu6zyocZk 1fhuBNAbYHZcnjP5ZjraCmNy7EcJiS+364+bE2K5LYvKA0AnURJ9hbF8uXUryoIymzIGud dzldJEabTe9UurC9vxcei/Kabh6wG//TzfljtM7OTipvohE01uZnRWtjdhFa/z8MJFfWtg wP2HqyVrj0igQPX+EoPqDLV3gWVHkSa8DzJZgo0WJmdCOByMEuMKOtIxG1euT4RSsCNsUJ AJdszYgIgPwtSsD87CcPu1zzpqiFeLU1SrtycjaC7e5pZhuNc7cWxKHGU/8Zwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E140O0H4VNC1zexnkemrdERcKywrYFk84XNOnWBySyc=; b=Qu1QbCP5s1x0pQy1na3erFWNOJucWKnCQ79b63QlJHjRk7XLHhUAlusAJnbx+vA+SAGfY4 aAkJHQyduWwlfCtzaUioNPK+vogEGL1avpmSmItpPmpKicyGuGUm5s32ARSDrbClUuW8i5 5wSAIW76/vT3pAoNoAqvxoAD9y/+N8TGkX+7IrGa75nyq6zL9SOnNuzPkTZ8MP0itTpSTh wP4wZjnHX7tz3Iw2xfR0lekdMWoeOUJwGfbuRLR3/stSilQ6MBTvwRT2jhMIRbsNbHtXV1 DzofSTVpRU7N3H56InCd/fxe0wWKbuupxwB3tqzbWQRjvOj2Xm4askJpkPKfOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679672953; a=rsa-sha256; cv=none; b=Md34ayQy/ytUl5AggHQbu9aHgcg/m1t1NoAmH8NPZB/7/nNqQUQDw7KPIj7GTH/Bg+WYs2 oyGn8RJaz7aCeDrWscEdwis+sUHkUPVHmv9uu2KoB7p8b33xiy60ksnVyRYoTyg+18f+6A tKmfoLZVGD0u4oCPgJE4YvOIBUe8vF2QQhrIDfelGLDg8lTjZUDC8IGNJbRyNrmlPgJeCx o+9sSucx28u8XHRM92HpF6GFdMd099EQy77kqxXALC1w/+SqD4muxNqLepkdO/1DVxSZ0Q L0eIdjP43jumy0k36lH5QP7W6jwD37AUIcnG5AM8nuGE9phyF78lkli4WBT6fw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjmpx2vyyzNw1; Fri, 24 Mar 2023 15:49: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 32OFnDZ3078754; Fri, 24 Mar 2023 15:49:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OFnD1c078753; Fri, 24 Mar 2023 15:49:13 GMT (envelope-from git) Date: Fri, 24 Mar 2023 15:49:13 GMT Message-Id: <202303241549.32OFnD1c078753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: bb55bb1740d2 - main - inet6: Include if_private.h in one more netstack file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb55bb1740d262ea5f4e083a9d116339932ee39a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=bb55bb1740d262ea5f4e083a9d116339932ee39a commit bb55bb1740d262ea5f4e083a9d116339932ee39a Author: Justin Hibbits AuthorDate: 2023-03-06 21:29:24 +0000 Commit: Justin Hibbits CommitDate: 2023-03-24 14:25:35 +0000 inet6: Include if_private.h in one more netstack file ip6_input() and ip6_destroy() both directly reference ifnet members. This file was missed in 3d0d5b21 Fixes: 3d0d5b21 ("IfAPI: Explicitly include ...") Sponsored by: Juniper Networks, Inc. --- sys/netinet6/ip6_input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index ff1402faac69..23550acb1fcd 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From nobody Fri Mar 24 15:49:14 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjmpy6GmXz41jHY; Fri, 24 Mar 2023 15:49: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 4Pjmpy56n5z4HSf; Fri, 24 Mar 2023 15:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sK/J/iI+We/O8j1y2i/8cBO5rMFcRgN8DhEPMd2D+GY=; b=eB9kZvXVhplJTiM4thcWR3tOJR6n0LO1k1ImWrA8ozJYf8pNf0fD8TjcQCTTo8WHy0zjok EdgLjuLElO9uCaeuTdIrFRvxVGHQoxHpueqs8L3D3lbqH6EvxiJGO7fDnNBu/eAdH0d753 EF2dbLhIfaKAj8osh3LVa53dARv4SXXi770i7oqWheCGAhHr2Bafc5F7KtZ+lraJ+b8ujI 71TzznEvVYHxCQlnfRIRyLx1HfwvCdzad2NEx+AXRNKnLpQZRhljx4uFvvnUJ71EDFVgO9 yohkjyrXlWfjG0yv2FF6CLpmjbhm20MoxNAplciok/60lInra+h3ftZMfvUGrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679672954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sK/J/iI+We/O8j1y2i/8cBO5rMFcRgN8DhEPMd2D+GY=; b=rOlk0EkumdQ+hDEJOdTS+/+l2N2etGPzk7wPj3GsreAlv+yivBLDltcVzJwxYbLt8WYJwR nnC00A1u0ehY6BNX5SC4SoEqv5ngVT2N2aUjjIPXqe2CU7md//U2qWbITtDb65Z1DaujPh kgOKvh/jwioh1KiEpaiDKvfbSO60DwWKxHh6VIzOcyRWlOI8uaimU4aOURe8l2BRTHddPt jv28fiRkieh8XfiGOg8C1Un6lY5e7O9LG5d4Pj4MGYq+09kuecNxClVnyrjQ+1tLhzj6Rf tKIkh0zjTRnokuj9Uf6JaI2ZsWtUWXyfc2mbhl/PoPtQBlYK/rO/ZRRoMjYbxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679672954; a=rsa-sha256; cv=none; b=JBAqstyCsQlCAw/5Z9PaITmnMcu5o0mVufDWCjg/vGMhxxAufIUYOsZFP4C6s6zklxE6uu uoG1I1vRuB15+k8lRekZTzfZIaaNnQylPV7HhAUvx3sSsYZeGrBe2H5nNAJeN3561AATnR 6hi4fDq2L5y70jxvXHT7FfNvMY1jw7kYonu1sJlWLXZgW4UsJirmy6C/hEttaMZ7Vve79P CNpfw11jTMe3TAvWZHmssS3oXXDamHxZxPd8QQc7/Cf4xtYlQkMJsktuDWqr4vDOx1sipO ZEgMHeit1ZvRJpBXw48xgCcSyGeBRudatp1Jt07Q8cR1tghhPcqbrcwjgN7AQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjmpy3lXtzNhD; Fri, 24 Mar 2023 15:49: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 32OFnEuU078773; Fri, 24 Mar 2023 15:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OFnEfG078772; Fri, 24 Mar 2023 15:49:14 GMT (envelope-from git) Date: Fri, 24 Mar 2023 15:49:14 GMT Message-Id: <202303241549.32OFnEfG078772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 79aa96f9ca4d - main - infiniband: Bring back M_ASSERTVALID() check in infiband_bpf_mtap() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79aa96f9ca4d57eb1b50337967704234a0ee1522 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=79aa96f9ca4d57eb1b50337967704234a0ee1522 commit 79aa96f9ca4d57eb1b50337967704234a0ee1522 Author: Justin Hibbits AuthorDate: 2023-03-15 19:40:24 +0000 Commit: Justin Hibbits CommitDate: 2023-03-24 15:04:42 +0000 infiniband: Bring back M_ASSERTVALID() check in infiband_bpf_mtap() Reported by: rpokala Fixes: adf62e83631 --- sys/net/if_infiniband.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 6764373b3d1a..6ca90ba1d8c7 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -131,6 +131,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb) if (!bpf_peers_present(ifp->if_bpf)) return; + M_ASSERTVALID(mb); if (mb->m_len < sizeof(*ibh)) return; From nobody Fri Mar 24 17:08:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjpZX0fgSz40pSf; Fri, 24 Mar 2023 17:08: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 4PjpZX05ddz4QV6; Fri, 24 Mar 2023 17:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679677716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VmR1t1bS9AQaUNAfaZperLdQFPHykPUdKzIs7pJUmh0=; b=RXTKFDI+M4t+SYVBmSMytcgaO75yJIZa9gKGD2xH5jw91Xz1RYp05Yb6BG/+w2D9DPBuD+ itrscDGp/8q2Yeiwjhqt+MCZHgbM8+vWgprSvm5N7mA4ik3B4yIn1ZK1FpvBH31uUiVz0N 4Aj9qTzfVjle8bzbrZr0420z89Stz8I5pd2OH9t/kt7VGTpMNIGxOURxDnqpZJJybPUQzj mp71byiR/jJ5InSGFBlxuNMKeUtY/+Xs1Cl9mxcmXLkRejhi7kUnFvesI7Z8E7RKiYALaT fesDg1iZb4yiHuVHl6Yzy87cxXCypTmy6covz40l5TQBoJHW5KN6CY3ftHo94w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679677716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VmR1t1bS9AQaUNAfaZperLdQFPHykPUdKzIs7pJUmh0=; b=xMl8WQVxaMhJl2PtOGkk1ozdaJev4oUNUAb74M3/CCVHiODYw4GuLOsV613yd1zIUe50gq b1kXqnuZ0PPdeR9YABbDvIML4w7oJefRhMDMpkFa6+Anv+KwhlkVcvA6aU7tXuOu90bYXF psyETEzXBj2KK+mkTA6sxeK59CxnpRko+ahRidt8Fb15hCG39UXdnRJQNm0yTDvE9i9jXH vljkTZGaUBO4B4h9MVtTdNJkEzbvPbGeFTIajmuhEgQ4OjulHwSVDRVtqRhKf6LPaT+ARc jM82JKdP68lyXGG5eZuS5cQSH706r41NZ20zIiHYcO4qIBeeOQLwHTvo3C9q9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679677716; a=rsa-sha256; cv=none; b=Xd6Xd2boDgDL29/ixgCbIZltYjb2WrNUm8UiQ1HqS89+FsuyR30Kn8ou6VDMSrTqfn43kx pryFUnxTltcO/3HhkZcU2S8F9YFP99Nj6S8mD6IS3XhzNlspV1XnlfojTn2SZkksBIYdyo x7av+T/pv3Ul7YX2yLudqDIF8vIzINw4TWw0435k//zDHVILeF2TRS9Oh4ebsiaKG374wX ClKKAJz8jU3kLqqOxj0mO0QHji/LW0PEZJ7eROFo7n44DGJSnlUmvXfU7Sm5Yt70xspcMD a4pQ0ZbXCjKFRddAwUei0Kd4Dj1D0nA23RQNNM2TF74NUW+YIgvI1w8knUIQ7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjpZW6FFwzQl7; Fri, 24 Mar 2023 17:08: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 32OH8ZQa010784; Fri, 24 Mar 2023 17:08:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OH8ZTQ010783; Fri, 24 Mar 2023 17:08:35 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:08:35 GMT Message-Id: <202303241708.32OH8ZTQ010783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 052211e08c0e - main - rc: Chase bfb202c4554a and remove ifconfig down/up for wpa_supplicant List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 052211e08c0e227277d0c4dc603bba2253eb3d73 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=052211e08c0e227277d0c4dc603bba2253eb3d73 commit 052211e08c0e227277d0c4dc603bba2253eb3d73 Author: Cy Schubert AuthorDate: 2023-03-24 14:32:41 +0000 Commit: Cy Schubert CommitDate: 2023-03-24 17:07:29 +0000 rc: Chase bfb202c4554a and remove ifconfig down/up for wpa_supplicant bfb202c4554a addresses the CTRL-EVENT-SCAN-FAILED. Upstream d807e289d caused FreeBSD regression in driver_bsd.c, which this rc.d patch worked around. As of bfb202c4554a this workaround is no longer needed. Reviewed by: bz (for wireless) MFC after: 10 days X-MFC with: bfb202c4554a Differential Revision: https://reviews.freebsd.org/D39257 --- libexec/rc/rc.d/wpa_supplicant | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant index 7a95ccb36be4..45db6b9f44dc 100755 --- a/libexec/rc/rc.d/wpa_supplicant +++ b/libexec/rc/rc.d/wpa_supplicant @@ -12,7 +12,6 @@ name="wpa_supplicant" desc="WPA/802.11i Supplicant for wireless network devices" -start_postcmd="wpa_poststart" rcvar= ifn="$2" @@ -20,11 +19,6 @@ if [ -z "$ifn" ]; then return 1 fi -wpa_poststart() { - ifconfig ${ifn} down - ifconfig ${ifn} up -} - if is_wired_interface ${ifn} ; then driver="wired" else From nobody Fri Mar 24 17:47:40 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjqRc5gz0z40s7G; Fri, 24 Mar 2023 17:47: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 4PjqRc4jtsz4T5w; Fri, 24 Mar 2023 17:47:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pKuQNiPm9/MV969v6/RAOg5AnhIBHNHrULT7o351usU=; b=pj0deP9jIfV49SB3FzA2eTnnZPtnVHaCp1e3qyWZEVppI2A9IfHkeSl6Le6nZDbWR84B1U ndV393xIogttqkI7ZM5wuaCYlzG2vDxz68jzlEcYE2IKARWqUoPuLiV15R6e+lLj87/tCO LoCP5i+nty+lNSXUp3bN44mkNY6AsOmYU7FQ5CFm4MMjXQ8XK/qSoqybUT0gQsDXYjCzuV 0OMgMI7XBZ+JxVOhJSdQxQDYWD9DkfxsY7DpaVwJ/xLuCaFCibLE/CSmHNa7Y4r2XrG/Zv jnx9HY9IkdVVu/q0LXETogs6N5kGIW9FFDKZfRtM3aJ9QuPUdmaG+wRUHvjZFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pKuQNiPm9/MV969v6/RAOg5AnhIBHNHrULT7o351usU=; b=Hdvy+F5q30NUI1IFj2Lhg5Tzxdf/E7RVuYCOOVq71pWKNTByq35zYtJKEhFojUAHjcjzOD lHGdlVIkjDf9tZ3DGst/5O7SAtT06ATbe5veGUIxZz+iqy2vww+8QMeVlvUgH0jjESvh7j 5UNjxfRDWdHpbtVCSD7inLnnoKv6Vgg8ohcATu9Xdgr/ULI1JI2EbAXkTln1wVBBMcjhEa cmPw5qRQ82unqtQjoNBc6Mkyyiyxu7pe/8F4N+r8SBz5uPAVTmJu6/dFt2U7Qs3L3GrqUc M62QfEivz4/+8/OSJpR8bEL4hnnZP6cZqDlszbwcT3BIDzN8JpfQO0rMSHtE0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679680060; a=rsa-sha256; cv=none; b=t+n8zAEbFcmt9uc3priALWEM3BYKTLMDiMh5u/knhElK9THdfV/lYnsBzT/5siUKC7R4Ja m9ERRvj9NNwmJa24PxsNlHAAhs8CUpUBPuDAixSZ1zQjVvxb5lW+FTJUAXI97Wt2I2X6tB 9jN9Y0aKNqLe2NA7yCqBMGxepkT4Zezl2pdUYvjFvvIKthuGYG/FOjLTBBzM6yOcfMXeza eE8ccw38AHBzERtE1XJks45oHijCvQ/iauQMjLeA++nkm/mrpQzrPTLH9TLTebZOJ4Miyz UtwS6lCfNbyA+gMt7RqthcNPWOP2+/jjITjQT6S8itZekOT/L4USZw8kbJC0LA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjqRc3g33zRVc; Fri, 24 Mar 2023 17:47: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 32OHleCw075454; Fri, 24 Mar 2023 17:47:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OHleTC075453; Fri, 24 Mar 2023 17:47:40 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:47:40 GMT Message-Id: <202303241747.32OHleTC075453@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: fa3ea81b77e4 - main - fdescfs: remove useless XXX comment, unwrap line List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa3ea81b77e41e3f33a611e51fd8bcbb2f4c8a95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3ea81b77e41e3f33a611e51fd8bcbb2f4c8a95 commit fa3ea81b77e41e3f33a611e51fd8bcbb2f4c8a95 Author: Konstantin Belousov AuthorDate: 2023-03-21 21:28:16 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-24 17:46:47 +0000 fdescfs: remove useless XXX comment, unwrap line Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39207 --- sys/fs/fdescfs/fdesc_vfsops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 9d8fdda47cbf..edc2cdd61847 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -90,8 +90,7 @@ fdesc_mount(struct mount *mp) if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) return (EOPNOTSUPP); - fmp = malloc(sizeof(struct fdescmount), - M_FDESCMNT, M_WAITOK); /* XXX */ + fmp = malloc(sizeof(struct fdescmount), M_FDESCMNT, M_WAITOK); /* * We need to initialize a few bits of our local mount point struct to From nobody Fri Mar 24 17:47:41 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjqRd5zm6z40sfR; Fri, 24 Mar 2023 17:47: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 4PjqRd5HHhz4T16; Fri, 24 Mar 2023 17:47:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmPd1jKZ5tGF3M973jKTIawNIiL9CdW/6++kBOAqWmk=; b=D3wpULD7ATcu47zgZzYQKvN4fJwmXo1gZhRil6ue3t61UHEyCRGdHkiz4+Hl1S+eNy+r81 pL9K3Gb4cKhq3JGst3qoAo0RRQ/PP7Jpcqf5anf17Ji36ext8P2RcYSWZrmiX9eHQR3zZx S0TIU/qMF1HnD7fKjr34XAIO8kFSkATrEqKtDZ5x9pfO1yu9EYKJfTHMD7elm2qn+Wqpxv 2RADreysun+3GQt79EshaIcGRdbtcqhIKwQjDBGJHn9ETJk13QZsDav7zvrawDoSo4SwaH fObph1X2be8/NzeKvb5zpYiigz4YujOsEZk+hXRV+weCM9Egx2CTctnFgs51tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmPd1jKZ5tGF3M973jKTIawNIiL9CdW/6++kBOAqWmk=; b=skFXDKEYSaVL8f/tQpQp6yO1xwqFcqtE4dervWw+08zaA1X1TLmvGUs5RsEuFAo+yM2hwm 4HFHVgYhY79/ERXhO7nHEa15sNu99TxleLqvAhedsB+NJSA3Sp418N8UFHnQKqgxdGRooS Ul0th+A4CzWCeoJ5IynPUwSvPM4otL+Sv8eB9LNB2BMVRoYN/ei62m17Z+MZmYP9ZmzJJb o3GrT1QdBLuK9uY5cEQMiF26kE7tHTKMXsq7Jz9W6AH7tqXZRVphladOLdbK/H3hev56ip Uw8j7kEYSmA8f69SWzwMv3m0qU/cVT6cGfnaGTbacoN3tm1HnjrsWLZP6sdUFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679680061; a=rsa-sha256; cv=none; b=SWQqlpJFTQZZ2wIqFha4N1RxGm3gTlK7EGqy0BWsaNj63R3HrudnpTQyJTRXIS+usb4ei0 jCLweedBac3SuiOJIro15ljlB42m+6MFoboW1QhqBYZH5FN30l3wyvJQQnYn3CyezR6/QL ES4S1etMKpb3OuKCUcylhgBt6KKJTrXp0BZDM03AWbvAv15E5jECbTM1QEhGJzDUR6gC4r 5pSyd4SM6ZVRofr66nzX9Bvt1EO8vYzRS6SnfhLQIKPjCRnc/oMIdy3GRRUFn7WmrWc/bb 0iftiCyShgBqcq6Lgmp/Occ/H2ifQ3sXM4zQ+tply3sP9bxDkBHzOKUuJ1Otvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjqRd4HdRzRxw; Fri, 24 Mar 2023 17:47: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 32OHlfgw075480; Fri, 24 Mar 2023 17:47:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OHlfwO075479; Fri, 24 Mar 2023 17:47:41 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:47:41 GMT Message-Id: <202303241747.32OHlfwO075479@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: 51b8ffb95c4f - main - fdesc_allocvp(): fix potential use after free List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51b8ffb95c4fe45f6825d551bd093889820a8115 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=51b8ffb95c4fe45f6825d551bd093889820a8115 commit 51b8ffb95c4fe45f6825d551bd093889820a8115 Author: Konstantin Belousov AuthorDate: 2023-03-21 21:24:06 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-24 17:46:53 +0000 fdesc_allocvp(): fix potential use after free Just owning the interlock is not enough for vget() to operate on the vnode race-free with vgone(), the vnode should be held. Use vget_prep()/vget_finish() to avoid vholding the vnode explicitly, and drop LK_INTERLOCK. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39207 --- sys/fs/fdescfs/fdesc_vnops.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index d3c7951672cf..afefaff8acf4 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -147,6 +147,7 @@ fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, struct mount *mp, struct fdhashhead *fc; struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; + enum vgetstate vgs; int error; fc = FD_NHASH(ix); @@ -166,9 +167,9 @@ loop: if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) { /* Get reference to vnode in case it's being free'd */ vp = fd->fd_vnode; - VI_LOCK(vp); + vgs = vget_prep(vp); mtx_unlock(&fdesc_hashmtx); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK)) + if (vget_finish(vp, LK_EXCLUSIVE, vgs) != 0) goto loop; *vpp = vp; return (0); @@ -218,9 +219,9 @@ loop: if (fd2->fd_ix == ix && fd2->fd_vnode->v_mount == mp) { /* Get reference to vnode in case it's being free'd */ vp2 = fd2->fd_vnode; - VI_LOCK(vp2); + vgs = vget_prep(vp2); mtx_unlock(&fdesc_hashmtx); - error = vget(vp2, LK_EXCLUSIVE | LK_INTERLOCK); + error = vget_finish(vp2, LK_EXCLUSIVE, vgs); /* Someone beat us, dec use count and wait for reclaim */ vgone(vp); vput(vp); From nobody Fri Mar 24 17:47:42 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjqRf6ZbLz40sgG; Fri, 24 Mar 2023 17:47: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 4PjqRf64jkz4Thl; Fri, 24 Mar 2023 17:47:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T6nva03Y0uappS8EXFVPPB0rQKFHxmQ+AJmF+H8VtC8=; b=xv0AQMUcdiJZkXCrGnZjs9nDgxRTrgTaiysWoVmHYKGByZCJdXszMwoCSc0Ce/KbmyuZg2 oqj2ve3gSojcpNk1nFOxau9x4LYiM2nEOoUwLC7ff5oZYln4uv3Bz428LxfL+4VvWhbDV8 EQN/qZ9201qu8sYZaMB9l+kyqjUOskhK+27AiQUGUeUps1n21bp9EmmyB71q/ufuhjUv3/ 4hHD8jXirJPsIgujMkw/9nZpQVUEZGkbmR4tosqXskMmrBJQJo5H5i8FAtprOI1GwDhJJl HQbOZh9uCWiGoNjw5+xJsSKAQ8sFB+K8wcIxnzR6DOgrL03kHdiyUMuJtxreJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T6nva03Y0uappS8EXFVPPB0rQKFHxmQ+AJmF+H8VtC8=; b=DIsU+dZtivVqSsZBFv5DDm/940WqeXZjwTQl0QBh65YWBUI50wyjxXtxjqmssafatrt6P6 s63IedC4BQuMX69N0bQs5WHH+XpNbv6aXWH00zbusY43BCYEqG/f29KRindr3lW61PBZvG WPMEPssb+lPS1bzPcJnRkOpexEN1iKjUXbbSDxc6UR3ur4CFMuy4EQFp1uu+e4Fyg+4H6G y6UHy/ztPFkcheL9F1wUZyEk3yG6z9XmqxdxLfe8KNql/yeMNwN5mZ+QsbIYb0Gace9F5T NF+1W/raJ2DJdShF4XPDJQRt0p5S30Xl8tUfVIYvaV1kG4sDgttDogrv89fMvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679680062; a=rsa-sha256; cv=none; b=vawGVTsFv9P1HFU9gEpB22rL09zuc3sfblEZpfJaxI3H2LQitME9uOgZMPGqyfjmb7eiGa OZQhxYZTdfyBnoZcJHCPqQkj8gjjYy8PBqreZnoajnhUaa6LiL2/7HAMd0CGC0GlPBQman 8kWspgJzS5kwsTmtfHRfJWxUwZtF61UcGRItXvhM0YruSIF9QyCBXkgYc6ORyORBGNCo1Z b1veJksxDeB40PRENW97/RnpISKxWkxbtjYsnCjM/pkHmtPvOIhYDMZZeKcQtD8brQHVAZ oNO25yiWP0mCR/uUtPcz8XKN9v/8FTkef0dFBByflzP4K1jsdTTOb0bgWaZkCA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjqRf5BnrzRsJ; Fri, 24 Mar 2023 17:47: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 32OHlgPk075500; Fri, 24 Mar 2023 17:47:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OHlgH0075499; Fri, 24 Mar 2023 17:47:42 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:47:42 GMT Message-Id: <202303241747.32OHlgH0075499@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: 8d97282a3942 - main - fdesc_lookup(): no need to vhold the dvp vnode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d97282a394278d29883e7afa98ed6294efab35e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8d97282a394278d29883e7afa98ed6294efab35e commit 8d97282a394278d29883e7afa98ed6294efab35e Author: Konstantin Belousov AuthorDate: 2023-03-22 13:36:00 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-24 17:47:07 +0000 fdesc_lookup(): no need to vhold the dvp vnode It is already referenced by the VOP_LOOKUP() caller, otherwise vdrop() after vn_lock() is invalid anyway. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39207 --- sys/fs/fdescfs/fdesc_vnops.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index afefaff8acf4..beef9295f11b 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -363,13 +363,11 @@ fdesc_lookup(struct vop_lookup_args *ap) * In case we're holding the last reference to the file, the dvp * will be re-acquired. */ - vhold(dvp); VOP_UNLOCK(dvp); fdrop(fp, td); fdropped = true; vn_lock(dvp, LK_RETRY | LK_EXCLUSIVE); - vdrop(dvp); fvp = dvp; if (error == 0 && VN_IS_DOOMED(dvp)) error = ENOENT; From nobody Fri Mar 24 17:47:43 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjqRh0hZ8z40sjn; Fri, 24 Mar 2023 17:47: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 4PjqRg7194z4Tg5; Fri, 24 Mar 2023 17:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wN8aQ8G1kPjkYu3JYlHSAcWH7aMO1II6TygJYGkCeU4=; b=gKiWQ58M/A2iLvquL78HuF6GicfPPvyghFyDIge/OqNTXF1zXCs77Wy2eFDM+4e1wyxrYh ruLH9DbQgnNxkDtCSuL/bUIfC7glrCpR9IlbNNSHdpHGt5axmw6XTflBqlryrYcZx2+CCv aRB8nYzNkeIYhumOoWTSyRDOxBWa5AWZ8a9h4TSv82pamMWujuvwoYF4pFwKXG0OztW4nJ pjrIqaETbEUVwOU+ClvEh1N4WL6CnAtjetgZNQk+T1rreMGrf1TK8z/ATwO0upM4Iwl90E sTaeUfGIhsL0BYpHdYt8kZKz7c9AKZRGv7C1NKAcae6+LtLuQe9QmTQyKL7KNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wN8aQ8G1kPjkYu3JYlHSAcWH7aMO1II6TygJYGkCeU4=; b=E02VVq3B9WL5ReX7HGYdSZ1sPANhsjjGiLNYTy2G08PdRi6+LxsFwGPqrD4tfm0VYuXJcd sK/cpW4fXkfkGd79s4pjlrODQGLrR41/hldFf6Q3PoYaBEC8+rV/y+Su9cqerrIvNf0jW6 vkzC8j3ap4nXh1NI79hXAQtUUsOcZ2YRAP0iPWqzLoWxYtRTkLTMkepN3ojamo7+3fLui/ 5OIdRjeHF6fcXYHcU39sba43rjLL2dEtafkYMOa9781ZsWJB5UOi0YZtMzxZzqMR7N4pCr 66v4+dwp+C8w+fDl6YgMXoB5oC4Xn0XLnWCjSnEXz7MDn8/DKG/jQaxs4Rw5Kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679680064; a=rsa-sha256; cv=none; b=LRFPZItDY1NfR0khRVJ1cFMqpGbbA7cgaHsoFkMv8Vr1kQOIgWvMqelut+FRBCGgSiMxDh xGC5rBw+fDRhpt4qGwOo+cFAG+t0FUDu1jfSCp6gQYt+nkSf+a2+GB3Vpj+3QELSbcA7AB Wxb7ohB7JnPSQtP6vmcKVXgqV8lWzGK3PzexC+VAWexWIppx0eHmczI6IjiLkNVD6ND4XY 1M1T4kOMAJDDyS2KBf/7NDFEXqf5P1Tn1EfCIbVfqORBpFARGnOK2mVyJVLl9schcvVxsf vepTxSGG3D6AzxB0GJnm9zBdTC3ueo7GJEiv8GPJ1braiVt01Ioch6AqiF0mpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjqRg66dCzRVd; Fri, 24 Mar 2023 17:47: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 32OHlhvB075524; Fri, 24 Mar 2023 17:47:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OHlhph075523; Fri, 24 Mar 2023 17:47:43 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:47:43 GMT Message-Id: <202303241747.32OHlhph075523@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: 7dca8fd1cb3f - main - fdesc_lookup(): the condition to use vn_vget_ino() is always true List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7dca8fd1cb3f91e7a3c07b7f57af6d9d43d0c71c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7dca8fd1cb3f91e7a3c07b7f57af6d9d43d0c71c commit 7dca8fd1cb3f91e7a3c07b7f57af6d9d43d0c71c Author: Konstantin Belousov AuthorDate: 2023-03-23 19:28:08 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-24 17:47:16 +0000 fdesc_lookup(): the condition to use vn_vget_ino() is always true The ix number for the fdescfs root is 1, while any fd vnode has the ix value at least 3. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39207 --- sys/fs/fdescfs/fdesc_vnops.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index beef9295f11b..2713b070426c 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -337,26 +337,24 @@ fdesc_lookup(struct vop_lookup_args *ap) goto bad; fdropped = false; - /* Make sure we're not looking up the dvp itself. */ - if (VTOFDESC(dvp)->fd_ix != FD_DESC + fd) { - /* - * Unlock our root node (dvp) when doing this, since we might - * deadlock since the vnode might be locked by another thread - * and the root vnode lock will be obtained afterwards (in case - * we're looking up the fd of the root vnode), which will be the - * opposite lock order. Vhold the root vnode first so we don't - * lose it. - */ - arg.ftype = Fdesc; - arg.fd_fd = fd; - arg.ix = FD_DESC + fd; - arg.fp = fp; - arg.td = td; - arg.fdropped = fdropped; - error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, - LK_EXCLUSIVE, &fvp); - fdropped = arg.fdropped; - } + /* + * Make sure we do not deadlock looking up the dvp itself. + * + * Unlock our root node (dvp) when doing this, since we might + * deadlock since the vnode might be locked by another thread + * and the root vnode lock will be obtained afterwards (in case + * we're looking up the fd of the root vnode), which will be the + * opposite lock order. + */ + arg.ftype = Fdesc; + arg.fd_fd = fd; + arg.ix = FD_DESC + fd; + arg.fp = fp; + arg.td = td; + arg.fdropped = fdropped; + error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, + LK_EXCLUSIVE, &fvp); + fdropped = arg.fdropped; if (!fdropped) { /* From nobody Fri Mar 24 17:47:44 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjqRj4NL2z40sjt; Fri, 24 Mar 2023 17:47: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 4PjqRj14CBz4TdQ; Fri, 24 Mar 2023 17:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=reIfZwv+VwzXOSH+DBHgbSbpZwu57xzZy83/keAWYCY=; b=oewpoj2/CIwsvANWg6TDx5+Bqp7gEHNcjxJbUeg7RJOrvIa9JoGuZQMF4lYGxDYu35kDP1 za2J8Lw5XhKf02mMEuUYdeBbBo8n0gXw6PCl1BuIgIBaSaXh0U5G9L3qDYFKccm+C/n2yx RNumowBfoG+VppKv34XZ743thSVG1ivWYBLLy+gd04a/eUgPxn4oPrE00oFC9ZqLG9KRSk B6Eo/Px6M/dF5r3OwOIDKtr5rH//78wpriHV+BMueANfLoWDTPw9gJ5hDMCx/3y/WrYwUr 27nHQUMc6dX5od0DQJ8W4OGQjUzro2g0YDbwFInhX+BzQC3Oy4NTDunlW94kmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679680065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=reIfZwv+VwzXOSH+DBHgbSbpZwu57xzZy83/keAWYCY=; b=RIRz+e3JHzzm/eWjMA6zT35aY2YpdmvsA1LcHLkbMj3qGLpd2lDfWMXIp7xjONJvNUDWDF P3RRcKjdehcU/jKT3tTzCWJeVwFYGzdAzOd9MCfMEyhPGMUFOJxnD/kAYbpRPO7MpoxAJm Q4zavceGkavhIZ0POu9NqCeImrkvPHWl5YZqQOpHg2mURYwhD4914C1UjijjxpASDCGwtf iz7V9r6ahONZKH/CEXKIhissvvO2N8dY94h23/RxcW17aSab2br1bj7QrQcEEwm1Y9jjKL VhRL2UXIcvh4NftJC74V85/71ykLNaxRkfFlQs2crONA89ZesIu3cs/3PT95OQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679680065; a=rsa-sha256; cv=none; b=AhAeL1i/H68Jb67RJY1QHGMroVGYOSLqnK/Xl1gu+3m7eP7x3s8Jt4zR0Ez7PG9fnA3ncu dzKQV0sqyMmE58XeR6RcmyGsS+N1jEZCexDeVs6MvcPuBYmUatX7CviL5Y9DOvq8spgZXb e7Xx1+J1YZaEAeTd99G9kTRFN1EA8MVmRb4g2WAbkSMLJnLypIXjMPd7Ru5tWigd7FJtTE ZaQt1tjaLZzww2uEGlWoMoaG7EceMcpvZUnzUTKb+3ni+gDBfN37+twKcdWW1I4RSUionR SOM6mMixwXjgEmHFYTrczuTcXOS6V98BVEZmUWGUqQcNrLi4GCfHlqu9m7RtEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjqRh73SgzRpp; Fri, 24 Mar 2023 17:47: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 32OHlinD075549; Fri, 24 Mar 2023 17:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OHlikG075548; Fri, 24 Mar 2023 17:47:44 GMT (envelope-from git) Date: Fri, 24 Mar 2023 17:47:44 GMT Message-Id: <202303241747.32OHlikG075548@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: 13262b07a069 - main - fdesc_lookup(): drop fdropped List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13262b07a06910edd5e58e6bb2e1d4786a7b7d8e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=13262b07a06910edd5e58e6bb2e1d4786a7b7d8e commit 13262b07a06910edd5e58e6bb2e1d4786a7b7d8e Author: Konstantin Belousov AuthorDate: 2023-03-23 19:30:04 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-24 17:47:22 +0000 fdesc_lookup(): drop fdropped Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39207 --- sys/fs/fdescfs/fdesc_vnops.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 2713b070426c..1c4b6d0c6cdb 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -291,7 +291,6 @@ fdesc_lookup(struct vop_lookup_args *ap) int nlen = cnp->cn_namelen; u_int fd, fd1; int error; - bool fdropped; struct vnode *fvp; if ((cnp->cn_flags & ISLASTCN) && @@ -335,7 +334,6 @@ fdesc_lookup(struct vop_lookup_args *ap) */ if ((error = fget(td, fd, &cap_no_rights, &fp)) != 0) goto bad; - fdropped = false; /* * Make sure we do not deadlock looking up the dvp itself. @@ -351,19 +349,17 @@ fdesc_lookup(struct vop_lookup_args *ap) arg.ix = FD_DESC + fd; arg.fp = fp; arg.td = td; - arg.fdropped = fdropped; + arg.fdropped = false; error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, LK_EXCLUSIVE, &fvp); - fdropped = arg.fdropped; - if (!fdropped) { + if (!arg.fdropped) { /* * In case we're holding the last reference to the file, the dvp * will be re-acquired. */ VOP_UNLOCK(dvp); fdrop(fp, td); - fdropped = true; vn_lock(dvp, LK_RETRY | LK_EXCLUSIVE); fvp = dvp; From nobody Fri Mar 24 18:47:08 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjrmF1X4Vz40xch; Fri, 24 Mar 2023 18: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 4PjrmF0yDRz4bCt; Fri, 24 Mar 2023 18:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HYsmC7YQdPaVcKDg01xx2s3WMcdyfMj01YIdFR8975w=; b=WNNjiFndzltGkAw3NJrmu1X7U9nnDZB805hKoMlhZv7z6adLxTn1DvbJKyTa4WAFMIc+JE ODUvHLVKCzygLIZlr2VHQvErV4Po7+HSM5Z1kBbYntPVBAz3goLPYG+tRJjB5GQiRU0nOL SzkFMspLi789AEMxtwKJilSlcTviqYz0QyWIeJXRw1u8uYqiCe5tLIOgR1/OtxXeRCZ6zA TBsnvFUbaIVmrB24xZfsBYvNYnuSnj0lcUpgEIc+OfSmJyqiT0dNq/OAITMzNjO9ZcSXPx wqlEurPJpG6C77cXLHiig7u7a666KpaxXkpJs8przV6OnyKDTaJu2pJSDtLf3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HYsmC7YQdPaVcKDg01xx2s3WMcdyfMj01YIdFR8975w=; b=mJdgvYsssu6j8qKCieCYkXV4lpvaorTa3T0uFeB8nrapmlpfeeOvwhxdCiJP4jGK9bYJ1b dwnKqQ4RvWcWSZBmA4KRuVyhHnVMiyyb26LLr4oASFDZHrGjcgsgsQGvx/vRmraHcHAePZ Gy91damohuR72b3Q+dXrNtPaOpx+Dub7ikBTuZAQv8yao3OKPCTZEOsNVMIUrAxA1xN+9W BF9nvZS7h88G6kBLYVwjDwTgm9kMWUv6AmJ+ZAScToii7TzRPGD8cgfi2lLMm/+4HQh6B2 wr+kHuHukRSlMwfkKOoiRfNul8+oQjb9uZgVLF3605nR89XUk7h4WWA3LYlYhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679683629; a=rsa-sha256; cv=none; b=jrDaoJrllDB62vzhv1XEW3ZFIAHMD0Unvfu00FmdxfouwxIJyqeZbZidTpBZ1CbR7AP5sq ZMew7DPqk5YC3kil4YVLgtH5lmFXWu7eZMGkx/hhYSRwX8xdxbI2BCVesxmu01AzrI8oNr vSO9BuYp9IDfL32wZUXmDJzFombtbr5sIzxa1I/YPvsfwegoOm6dE5iD6M7jVeJMhQqn8B hJu5ob4/DQVmai2npYVubwCkh/w33XzfIVSJyhpVKfUtgWf7l+GoPDxCNwdMLQgJIFzKIY AIYLD6lGCQeY5ZozOpHXfUIUTHSvP9oKwnEK0BOxdTO/JHZjeScOww18uSKY+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjrmD75dMzSvt; Fri, 24 Mar 2023 18: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 32OIl8Gs074464; Fri, 24 Mar 2023 18: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 32OIl8WP074463; Fri, 24 Mar 2023 18:47:08 GMT (envelope-from git) Date: Fri, 24 Mar 2023 18:47:08 GMT Message-Id: <202303241847.32OIl8WP074463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Koshy Subject: git: 047ce3db9776 - main - pmcstat: Warn about text output format stability. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkoshy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 047ce3db97769968f6777be456cbf196c65eb455 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jkoshy: URL: https://cgit.FreeBSD.org/src/commit/?id=047ce3db97769968f6777be456cbf196c65eb455 commit 047ce3db97769968f6777be456cbf196c65eb455 Author: Joseph Koshy AuthorDate: 2023-03-24 09:39:08 +0000 Commit: Joseph Koshy CommitDate: 2023-03-24 18:46:22 +0000 pmcstat: Warn about text output format stability. The formats for pmcstat(8)'s human-readable output are not part of its user interface definition, and may change in the future. Highlight this in its manual page. Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D39249 --- usr.sbin/pmcstat/pmcstat.8 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pmcstat/pmcstat.8 b/usr.sbin/pmcstat/pmcstat.8 index b0dae2449cfe..dade290c21b1 100644 --- a/usr.sbin/pmcstat/pmcstat.8 +++ b/usr.sbin/pmcstat/pmcstat.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2020 +.Dd March 24, 2023 .Dt PMCSTAT 8 .Os .Sh NAME @@ -107,6 +107,10 @@ counting and sampling flavors. The values of all counting PMCs are printed in human readable form at regular intervals by .Nm . +The format of +.Nm Ns 's +human-readable textual output is not stable, and could change +in the future. The output of sampling PMCs may be configured to go to a log file for subsequent offline analysis, or, at the expense of greater overhead, may be configured to be printed in text form on the fly. From nobody Fri Mar 24 18:49:13 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjrpf1RPLz40xll; Fri, 24 Mar 2023 18:49: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 4Pjrpf16j7z4bGK; Fri, 24 Mar 2023 18:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QLx44BL0ciUdIl7gxCEqRJCumFwnYAQ40P9gBAaZpAA=; b=S/Duu3perkp8zufPX9O3WQXCGLZ0l4qupjl+BoBo0Crz5m+ogI0bjr/uyQcFqPye5vTyp9 Zxg39sz6858UtHOFoa0KOT9jl3LkJVcUdl1vkXLyUhRRwZHltpTrXvF3xTAo04/AnTQR4V +kVPqZUnooaJBt4FuSYqCDaLHLv3FJI4sQ4GyHhfj1IzEngUcQ40OUj1UhxGwPE9qrYn0P yTHvSWYYw8Ow5ou57uh5BjIfS0c2Mo3Ciz9rGaar+ySR6EV77+D9UWuETA+dIDQQzhgSFl UTIlTOyUAwpzgE+wECQYsCGMyJYDYFeuVZojuV8cMrOV1b6n3qxy2jYHcKdA7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QLx44BL0ciUdIl7gxCEqRJCumFwnYAQ40P9gBAaZpAA=; b=kQFGJsH/RJjxiwlN2itdqIJR8XQjGal47IeCri6sD1vbn0AQXi3zJiCcB8SC6TVS1URiBe qaPBqelttTnNo1W/dpSZNY1/iTUT9MTxWSEQ0YaqoqAmX9kvpobV8pJrbNP6YDQrDCXaGK 0JtYwSUsWLEthRdIfGgH3aUDqWiV2gTqC7ALFMUbLc5XkQ4kzFfKXm4MAeIvczXZKizNhX VQyQFXyInn2kf/Xz8VrFDSRyn049nFWdcGYhE+Uq68jd1YdQAjjbC81ZBeorOnKUMrzEST zordZMC+j0xRFe8OWPMDZXo3ytj6ATtqRb3o0+4+c6OfEUbAANbAvTpDR2UgQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679683754; a=rsa-sha256; cv=none; b=eObmf9TenzVA2hbAWqZ2017A/recKmnfRa+G8DlK0Yt/0gElUze6t01ZO9dSlOmKOs5PJC 6ZP5arG/YpTb0SCFQGxRCVlYfP6f5sru13bcOEU9ZD2SVzUwVOk07UxDNPMLhK0LxRa4Dj jggdbLQEKASOg1t4dc8Pj/TgudG+AemWQzk7M0jZeGmmyNcTrt7byEUshrq0XpxoquUFze UyTiVELgXhrk3pEpSfPd0s3gHGnqvpAE6tzF0fZdVoDUVBbhNgAlSx4f9kWwNkkUUGu77e 1+HT7Is1tSOOUmtLOM15Rw8PmkrQ+3EQwOyjbKsM9SvAbwdXLcwKRAI4YEkcCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjrpf07NWzTxV; Fri, 24 Mar 2023 18:49: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 32OInDuB074911; Fri, 24 Mar 2023 18:49:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OInDoG074910; Fri, 24 Mar 2023 18:49:13 GMT (envelope-from git) Date: Fri, 24 Mar 2023 18:49:13 GMT Message-Id: <202303241849.32OInDoG074910@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: 7d9ef309bd09 - main - libvmmapi: Add a struct vcpu and use it in most APIs. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d9ef309bd09c061e9cad8ace6f7bb4c60f087e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9ef309bd09c061e9cad8ace6f7bb4c60f087e6 commit 7d9ef309bd09c061e9cad8ace6f7bb4c60f087e6 Author: John Baldwin AuthorDate: 2023-03-24 18:49:06 +0000 Commit: John Baldwin CommitDate: 2023-03-24 18:49:06 +0000 libvmmapi: Add a struct vcpu and use it in most APIs. This replaces the 'struct vm, int vcpuid' tuple passed to most API calls and is similar to the changes recently made in vmm(4) in the kernel. struct vcpu is an opaque type managed by libvmmapi. For now it stores a pointer to the VM context and an integer id. As an immediate effect this removes the divergence between the kernel and userland for the instruction emulation code introduced by the recent vmm(4) changes. Since this is a major change to the vmmapi API, bump VMMAPI_VERSION to 0x200 (2.0) and the shared library major version. While here (and since the major version is bumped), remove unused vcpu argument from vm_setup_pptdev_msi*(). Add new functions vm_suspend_all_cpus() and vm_resume_all_cpus() for use by the debug server. The underyling ioctl (which uses a vcpuid of -1) remains unchanged, but the userlevel API now uses separate functions for global CPU suspend/resume. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38124 --- lib/libvmmapi/Makefile | 1 + lib/libvmmapi/internal.h | 17 + lib/libvmmapi/vmmapi.c | 290 +++++++++------- lib/libvmmapi/vmmapi.h | 73 ++-- lib/libvmmapi/vmmapi_freebsd.c | 105 +++--- sys/amd64/include/vmm.h | 33 +- sys/amd64/include/vmm_instruction_emul.h | 21 +- sys/amd64/vmm/vmm_instruction_emul.c | 314 ++++++++--------- usr.sbin/bhyve/bhyverun.c | 251 +++++++------- usr.sbin/bhyve/bhyverun.h | 3 +- usr.sbin/bhyve/bootrom.c | 5 +- usr.sbin/bhyve/gdb.c | 119 ++++--- usr.sbin/bhyve/gdb.h | 8 +- usr.sbin/bhyve/inout.c | 16 +- usr.sbin/bhyve/inout.h | 3 +- usr.sbin/bhyve/kernemu_dev.c | 4 +- usr.sbin/bhyve/mem.c | 58 ++-- usr.sbin/bhyve/mem.h | 12 +- usr.sbin/bhyve/pci_emul.c | 11 +- usr.sbin/bhyve/pci_passthru.c | 6 +- usr.sbin/bhyve/pctestdev.c | 4 +- usr.sbin/bhyve/snapshot.c | 4 +- usr.sbin/bhyve/spinup_ap.c | 21 +- usr.sbin/bhyve/spinup_ap.h | 2 +- usr.sbin/bhyve/task_switch.c | 247 +++++++------- usr.sbin/bhyve/vga.c | 69 ++-- usr.sbin/bhyve/xmsr.c | 6 +- usr.sbin/bhyve/xmsr.h | 4 +- usr.sbin/bhyvectl/bhyvectl.c | 570 ++++++++++++++++--------------- usr.sbin/bhyveload/bhyveload.c | 26 +- 30 files changed, 1163 insertions(+), 1140 deletions(-) diff --git a/lib/libvmmapi/Makefile b/lib/libvmmapi/Makefile index 9c410833e09c..e5e513d84a51 100644 --- a/lib/libvmmapi/Makefile +++ b/lib/libvmmapi/Makefile @@ -2,6 +2,7 @@ PACKAGE=lib${LIB} LIB= vmmapi +SHLIB_MAJOR= 6 SRCS= vmmapi.c vmmapi_freebsd.c INCS= vmmapi.h diff --git a/lib/libvmmapi/internal.h b/lib/libvmmapi/internal.h new file mode 100644 index 000000000000..142026e76345 --- /dev/null +++ b/lib/libvmmapi/internal.h @@ -0,0 +1,17 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2022 John Baldwin + */ + +#ifndef __VMMAPI_INTERNAL_H__ +#define __VMMAPI_INTERNAL_H__ + +struct vmctx; + +struct vcpu { + struct vmctx *ctx; + int vcpuid; +}; + +#endif /* !__VMMAPI_INTERNAL_H__ */ diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 451d679dbbba..2d0cc21aeb25 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include "vmmapi.h" +#include "internal.h" #define MB (1024 * 1024UL) #define GB (1024 * 1024 * 1024UL) @@ -163,6 +164,29 @@ vm_destroy(struct vmctx *vm) free(vm); } +struct vcpu * +vm_vcpu_open(struct vmctx *ctx, int vcpuid) +{ + struct vcpu *vcpu; + + vcpu = malloc(sizeof(*vcpu)); + vcpu->ctx = ctx; + vcpu->vcpuid = vcpuid; + return (vcpu); +} + +void +vm_vcpu_close(struct vcpu *vcpu) +{ + free(vcpu); +} + +int +vcpu_id(struct vcpu *vcpu) +{ + return (vcpu->vcpuid); +} + int vm_parse_memsize(const char *opt, size_t *ret_memsize) { @@ -578,36 +602,46 @@ done: return (ptr); } +static int +vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg) +{ + /* + * XXX: fragile, handle with care + * Assumes that the first field of the ioctl data + * is the vcpuid. + */ + *(int *)arg = vcpu->vcpuid; + return (ioctl(vcpu->ctx->fd, cmd, arg)); +} + int -vm_set_desc(struct vmctx *ctx, int vcpu, int reg, +vm_set_desc(struct vcpu *vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access) { int error; struct vm_seg_desc vmsegdesc; bzero(&vmsegdesc, sizeof(vmsegdesc)); - vmsegdesc.cpuid = vcpu; vmsegdesc.regnum = reg; vmsegdesc.desc.base = base; vmsegdesc.desc.limit = limit; vmsegdesc.desc.access = access; - error = ioctl(ctx->fd, VM_SET_SEGMENT_DESCRIPTOR, &vmsegdesc); + error = vcpu_ioctl(vcpu, VM_SET_SEGMENT_DESCRIPTOR, &vmsegdesc); return (error); } int -vm_get_desc(struct vmctx *ctx, int vcpu, int reg, - uint64_t *base, uint32_t *limit, uint32_t *access) +vm_get_desc(struct vcpu *vcpu, int reg, uint64_t *base, uint32_t *limit, + uint32_t *access) { int error; struct vm_seg_desc vmsegdesc; bzero(&vmsegdesc, sizeof(vmsegdesc)); - vmsegdesc.cpuid = vcpu; vmsegdesc.regnum = reg; - error = ioctl(ctx->fd, VM_GET_SEGMENT_DESCRIPTOR, &vmsegdesc); + error = vcpu_ioctl(vcpu, VM_GET_SEGMENT_DESCRIPTOR, &vmsegdesc); if (error == 0) { *base = vmsegdesc.desc.base; *limit = vmsegdesc.desc.limit; @@ -617,89 +651,84 @@ vm_get_desc(struct vmctx *ctx, int vcpu, int reg, } int -vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, struct seg_desc *seg_desc) +vm_get_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *seg_desc) { int error; - error = vm_get_desc(ctx, vcpu, reg, &seg_desc->base, &seg_desc->limit, + error = vm_get_desc(vcpu, reg, &seg_desc->base, &seg_desc->limit, &seg_desc->access); return (error); } int -vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val) +vm_set_register(struct vcpu *vcpu, int reg, uint64_t val) { int error; struct vm_register vmreg; bzero(&vmreg, sizeof(vmreg)); - vmreg.cpuid = vcpu; vmreg.regnum = reg; vmreg.regval = val; - error = ioctl(ctx->fd, VM_SET_REGISTER, &vmreg); + error = vcpu_ioctl(vcpu, VM_SET_REGISTER, &vmreg); return (error); } int -vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *ret_val) +vm_get_register(struct vcpu *vcpu, int reg, uint64_t *ret_val) { int error; struct vm_register vmreg; bzero(&vmreg, sizeof(vmreg)); - vmreg.cpuid = vcpu; vmreg.regnum = reg; - error = ioctl(ctx->fd, VM_GET_REGISTER, &vmreg); + error = vcpu_ioctl(vcpu, VM_GET_REGISTER, &vmreg); *ret_val = vmreg.regval; return (error); } int -vm_set_register_set(struct vmctx *ctx, int vcpu, unsigned int count, +vm_set_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uint64_t *regvals) { int error; struct vm_register_set vmregset; bzero(&vmregset, sizeof(vmregset)); - vmregset.cpuid = vcpu; vmregset.count = count; vmregset.regnums = regnums; vmregset.regvals = regvals; - error = ioctl(ctx->fd, VM_SET_REGISTER_SET, &vmregset); + error = vcpu_ioctl(vcpu, VM_SET_REGISTER_SET, &vmregset); return (error); } int -vm_get_register_set(struct vmctx *ctx, int vcpu, unsigned int count, +vm_get_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uint64_t *regvals) { int error; struct vm_register_set vmregset; bzero(&vmregset, sizeof(vmregset)); - vmregset.cpuid = vcpu; vmregset.count = count; vmregset.regnums = regnums; vmregset.regvals = regvals; - error = ioctl(ctx->fd, VM_GET_REGISTER_SET, &vmregset); + error = vcpu_ioctl(vcpu, VM_GET_REGISTER_SET, &vmregset); return (error); } int -vm_run(struct vmctx *ctx, int vcpu, struct vm_exit *vmexit) +vm_run(struct vcpu *vcpu, struct vm_exit *vmexit) { int error; struct vm_run vmrun; bzero(&vmrun, sizeof(vmrun)); - vmrun.cpuid = vcpu; - error = ioctl(ctx->fd, VM_RUN, &vmrun); + error = vcpu_ioctl(vcpu, VM_RUN, &vmrun); bcopy(&vmrun.vm_exit, vmexit, sizeof(struct vm_exit)); return (error); } @@ -722,18 +751,17 @@ vm_reinit(struct vmctx *ctx) } int -vm_inject_exception(struct vmctx *ctx, int vcpu, int vector, int errcode_valid, +vm_inject_exception(struct vcpu *vcpu, int vector, int errcode_valid, uint32_t errcode, int restart_instruction) { struct vm_exception exc; - exc.cpuid = vcpu; exc.vector = vector; exc.error_code = errcode; exc.error_code_valid = errcode_valid; exc.restart_instruction = restart_instruction; - return (ioctl(ctx->fd, VM_INJECT_EXCEPTION, &exc)); + return (vcpu_ioctl(vcpu, VM_INJECT_EXCEPTION, &exc)); } int @@ -747,27 +775,25 @@ vm_apicid2vcpu(struct vmctx *ctx __unused, int apicid) } int -vm_lapic_irq(struct vmctx *ctx, int vcpu, int vector) +vm_lapic_irq(struct vcpu *vcpu, int vector) { struct vm_lapic_irq vmirq; bzero(&vmirq, sizeof(vmirq)); - vmirq.cpuid = vcpu; vmirq.vector = vector; - return (ioctl(ctx->fd, VM_LAPIC_IRQ, &vmirq)); + return (vcpu_ioctl(vcpu, VM_LAPIC_IRQ, &vmirq)); } int -vm_lapic_local_irq(struct vmctx *ctx, int vcpu, int vector) +vm_lapic_local_irq(struct vcpu *vcpu, int vector) { struct vm_lapic_irq vmirq; bzero(&vmirq, sizeof(vmirq)); - vmirq.cpuid = vcpu; vmirq.vector = vector; - return (ioctl(ctx->fd, VM_LAPIC_LOCAL_IRQ, &vmirq)); + return (vcpu_ioctl(vcpu, VM_LAPIC_LOCAL_IRQ, &vmirq)); } int @@ -823,11 +849,10 @@ vm_ioapic_pincount(struct vmctx *ctx, int *pincount) } int -vm_readwrite_kernemu_device(struct vmctx *ctx, int vcpu, vm_paddr_t gpa, +vm_readwrite_kernemu_device(struct vcpu *vcpu, vm_paddr_t gpa, bool write, int size, uint64_t *value) { struct vm_readwrite_kernemu_device irp = { - .vcpuid = vcpu, .access_width = fls(size) - 1, .gpa = gpa, .value = write ? *value : ~0ul, @@ -835,7 +860,7 @@ vm_readwrite_kernemu_device(struct vmctx *ctx, int vcpu, vm_paddr_t gpa, long cmd = (write ? VM_SET_KERNEMU_DEV : VM_GET_KERNEMU_DEV); int rc; - rc = ioctl(ctx->fd, cmd, &irp); + rc = vcpu_ioctl(vcpu, cmd, &irp); if (rc == 0 && !write) *value = irp.value; return (rc); @@ -891,14 +916,13 @@ vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq, } int -vm_inject_nmi(struct vmctx *ctx, int vcpu) +vm_inject_nmi(struct vcpu *vcpu) { struct vm_nmi vmnmi; bzero(&vmnmi, sizeof(vmnmi)); - vmnmi.cpuid = vcpu; - return (ioctl(ctx->fd, VM_INJECT_NMI, &vmnmi)); + return (vcpu_ioctl(vcpu, VM_INJECT_NMI, &vmnmi)); } static const char *capstrmap[] = { @@ -933,32 +957,29 @@ vm_capability_type2name(int type) } int -vm_get_capability(struct vmctx *ctx, int vcpu, enum vm_cap_type cap, - int *retval) +vm_get_capability(struct vcpu *vcpu, enum vm_cap_type cap, int *retval) { int error; struct vm_capability vmcap; bzero(&vmcap, sizeof(vmcap)); - vmcap.cpuid = vcpu; vmcap.captype = cap; - error = ioctl(ctx->fd, VM_GET_CAPABILITY, &vmcap); + error = vcpu_ioctl(vcpu, VM_GET_CAPABILITY, &vmcap); *retval = vmcap.capval; return (error); } int -vm_set_capability(struct vmctx *ctx, int vcpu, enum vm_cap_type cap, int val) +vm_set_capability(struct vcpu *vcpu, enum vm_cap_type cap, int val) { struct vm_capability vmcap; bzero(&vmcap, sizeof(vmcap)); - vmcap.cpuid = vcpu; vmcap.captype = cap; vmcap.capval = val; - return (ioctl(ctx->fd, VM_SET_CAPABILITY, &vmcap)); + return (vcpu_ioctl(vcpu, VM_SET_CAPABILITY, &vmcap)); } int @@ -1021,13 +1042,12 @@ vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, } int -vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, +vm_setup_pptdev_msi(struct vmctx *ctx, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec) { struct vm_pptdev_msi pptmsi; bzero(&pptmsi, sizeof(pptmsi)); - pptmsi.vcpu = vcpu; pptmsi.bus = bus; pptmsi.slot = slot; pptmsi.func = func; @@ -1039,13 +1059,12 @@ vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, } int -vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot, int func, +vm_setup_pptdev_msix(struct vmctx *ctx, int bus, int slot, int func, int idx, uint64_t addr, uint64_t msg, uint32_t vector_control) { struct vm_pptdev_msix pptmsix; bzero(&pptmsix, sizeof(pptmsix)); - pptmsix.vcpu = vcpu; pptmsix.bus = bus; pptmsix.slot = slot; pptmsix.func = func; @@ -1071,7 +1090,7 @@ vm_disable_pptdev_msix(struct vmctx *ctx, int bus, int slot, int func) } uint64_t * -vm_get_stats(struct vmctx *ctx, int vcpu, struct timeval *ret_tv, +vm_get_stats(struct vcpu *vcpu, struct timeval *ret_tv, int *ret_entries) { static _Thread_local uint64_t *stats_buf; @@ -1082,11 +1101,10 @@ vm_get_stats(struct vmctx *ctx, int vcpu, struct timeval *ret_tv, bool have_stats; have_stats = false; - vmstats.cpuid = vcpu; count = 0; for (index = 0;; index += nitems(vmstats.statbuf)) { vmstats.index = index; - if (ioctl(ctx->fd, VM_STATS, &vmstats) != 0) + if (vcpu_ioctl(vcpu, VM_STATS, &vmstats) != 0) break; if (stats_count < index + vmstats.num_entries) { new_stats = realloc(stats_buf, @@ -1129,30 +1147,28 @@ vm_get_stat_desc(struct vmctx *ctx, int index) } int -vm_get_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state *state) +vm_get_x2apic_state(struct vcpu *vcpu, enum x2apic_state *state) { int error; struct vm_x2apic x2apic; bzero(&x2apic, sizeof(x2apic)); - x2apic.cpuid = vcpu; - error = ioctl(ctx->fd, VM_GET_X2APIC_STATE, &x2apic); + error = vcpu_ioctl(vcpu, VM_GET_X2APIC_STATE, &x2apic); *state = x2apic.state; return (error); } int -vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state state) +vm_set_x2apic_state(struct vcpu *vcpu, enum x2apic_state state) { int error; struct vm_x2apic x2apic; bzero(&x2apic, sizeof(x2apic)); - x2apic.cpuid = vcpu; x2apic.state = state; - error = ioctl(ctx->fd, VM_SET_X2APIC_STATE, &x2apic); + error = vcpu_ioctl(vcpu, VM_SET_X2APIC_STATE, &x2apic); return (error); } @@ -1162,7 +1178,7 @@ vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state state) * Table 9-1. IA-32 Processor States Following Power-up, Reset or INIT */ int -vcpu_reset(struct vmctx *vmctx, int vcpu) +vcpu_reset(struct vcpu *vcpu) { int error; uint64_t rflags, rip, cr0, cr4, zero, desc_base, rdx; @@ -1172,12 +1188,12 @@ vcpu_reset(struct vmctx *vmctx, int vcpu) zero = 0; rflags = 0x2; - error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RFLAGS, rflags); + error = vm_set_register(vcpu, VM_REG_GUEST_RFLAGS, rflags); if (error) goto done; rip = 0xfff0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RIP, rip)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RIP, rip)) != 0) goto done; /* @@ -1186,17 +1202,17 @@ vcpu_reset(struct vmctx *vmctx, int vcpu) * guests like Windows. */ cr0 = CR0_NE; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR0, cr0)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_CR0, cr0)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR2, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_CR2, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR3, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_CR3, zero)) != 0) goto done; cr4 = 0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_CR4, cr4)) != 0) goto done; /* @@ -1205,13 +1221,13 @@ vcpu_reset(struct vmctx *vmctx, int vcpu) desc_base = 0xffff0000; desc_limit = 0xffff; desc_access = 0x0093; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_CS, + error = vm_set_desc(vcpu, VM_REG_GUEST_CS, desc_base, desc_limit, desc_access); if (error) goto done; sel = 0xf000; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CS, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_CS, sel)) != 0) goto done; /* @@ -1220,91 +1236,91 @@ vcpu_reset(struct vmctx *vmctx, int vcpu) desc_base = 0; desc_limit = 0xffff; desc_access = 0x0093; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_SS, + error = vm_set_desc(vcpu, VM_REG_GUEST_SS, desc_base, desc_limit, desc_access); if (error) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_DS, + error = vm_set_desc(vcpu, VM_REG_GUEST_DS, desc_base, desc_limit, desc_access); if (error) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_ES, + error = vm_set_desc(vcpu, VM_REG_GUEST_ES, desc_base, desc_limit, desc_access); if (error) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_FS, + error = vm_set_desc(vcpu, VM_REG_GUEST_FS, desc_base, desc_limit, desc_access); if (error) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_GS, + error = vm_set_desc(vcpu, VM_REG_GUEST_GS, desc_base, desc_limit, desc_access); if (error) goto done; sel = 0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_SS, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_SS, sel)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_DS, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_DS, sel)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_ES, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_ES, sel)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_FS, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_FS, sel)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_GS, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_GS, sel)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_EFER, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_EFER, zero)) != 0) goto done; /* General purpose registers */ rdx = 0xf00; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RAX, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RAX, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RBX, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RBX, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RCX, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RCX, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RDX, rdx)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RDX, rdx)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSI, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RSI, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RDI, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RDI, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RBP, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RBP, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSP, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_RSP, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R8, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R8, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R9, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R9, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R10, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R10, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R11, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R11, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R12, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R12, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R13, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R13, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R14, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R14, zero)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_R15, zero)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_R15, zero)) != 0) goto done; /* GDTR, IDTR */ desc_base = 0; desc_limit = 0xffff; desc_access = 0; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_GDTR, + error = vm_set_desc(vcpu, VM_REG_GUEST_GDTR, desc_base, desc_limit, desc_access); if (error != 0) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_IDTR, + error = vm_set_desc(vcpu, VM_REG_GUEST_IDTR, desc_base, desc_limit, desc_access); if (error != 0) goto done; @@ -1313,35 +1329,35 @@ vcpu_reset(struct vmctx *vmctx, int vcpu) desc_base = 0; desc_limit = 0xffff; desc_access = 0x0000008b; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_TR, 0, 0, desc_access); + error = vm_set_desc(vcpu, VM_REG_GUEST_TR, 0, 0, desc_access); if (error) goto done; sel = 0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_TR, sel)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_TR, sel)) != 0) goto done; /* LDTR */ desc_base = 0; desc_limit = 0xffff; desc_access = 0x00000082; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_LDTR, desc_base, + error = vm_set_desc(vcpu, VM_REG_GUEST_LDTR, desc_base, desc_limit, desc_access); if (error) goto done; sel = 0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_LDTR, 0)) != 0) + if ((error = vm_set_register(vcpu, VM_REG_GUEST_LDTR, 0)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_DR6, + if ((error = vm_set_register(vcpu, VM_REG_GUEST_DR6, 0xffff0ff0)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_DR7, 0x400)) != + if ((error = vm_set_register(vcpu, VM_REG_GUEST_DR7, 0x400)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_INTR_SHADOW, + if ((error = vm_set_register(vcpu, VM_REG_GUEST_INTR_SHADOW, zero)) != 0) goto done; @@ -1384,19 +1400,18 @@ vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities) } int -vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, +vm_gla2gpa(struct vcpu *vcpu, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa, int *fault) { struct vm_gla2gpa gg; int error; bzero(&gg, sizeof(struct vm_gla2gpa)); - gg.vcpuid = vcpu; gg.prot = prot; gg.gla = gla; gg.paging = *paging; - error = ioctl(ctx->fd, VM_GLA2GPA, &gg); + error = vcpu_ioctl(vcpu, VM_GLA2GPA, &gg); if (error == 0) { *fault = gg.fault; *gpa = gg.gpa; @@ -1405,19 +1420,18 @@ vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, } int -vm_gla2gpa_nofault(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, +vm_gla2gpa_nofault(struct vcpu *vcpu, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa, int *fault) { struct vm_gla2gpa gg; int error; bzero(&gg, sizeof(struct vm_gla2gpa)); - gg.vcpuid = vcpu; gg.prot = prot; gg.gla = gla; gg.paging = *paging; - error = ioctl(ctx->fd, VM_GLA2GPA_NOFAULT, &gg); + error = vcpu_ioctl(vcpu, VM_GLA2GPA_NOFAULT, &gg); if (error == 0) { *fault = gg.fault; *gpa = gg.gpa; @@ -1430,7 +1444,7 @@ vm_gla2gpa_nofault(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, #endif int -vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, +vm_copy_setup(struct vcpu *vcpu, struct vm_guest_paging *paging, uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt, int *fault) { @@ -1445,14 +1459,14 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, while (len) { assert(iovcnt > 0); - error = vm_gla2gpa(ctx, vcpu, paging, gla, prot, &gpa, fault); + error = vm_gla2gpa(vcpu, paging, gla, prot, &gpa, fault); if (error || *fault) return (error); off = gpa & PAGE_MASK; n = MIN(len, PAGE_SIZE - off); - va = vm_map_gpa(ctx, gpa, n); + va = vm_map_gpa(vcpu->ctx, gpa, n); if (va == NULL) return (EFAULT); @@ -1554,50 +1568,70 @@ vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus) } int -vm_activate_cpu(struct vmctx *ctx, int vcpu) +vm_activate_cpu(struct vcpu *vcpu) { struct vm_activate_cpu ac; int error; bzero(&ac, sizeof(struct vm_activate_cpu)); - ac.vcpuid = vcpu; - error = ioctl(ctx->fd, VM_ACTIVATE_CPU, &ac); + error = vcpu_ioctl(vcpu, VM_ACTIVATE_CPU, &ac); return (error); } int -vm_suspend_cpu(struct vmctx *ctx, int vcpu) +vm_suspend_all_cpus(struct vmctx *ctx) { struct vm_activate_cpu ac; int error; bzero(&ac, sizeof(struct vm_activate_cpu)); - ac.vcpuid = vcpu; + ac.vcpuid = -1; error = ioctl(ctx->fd, VM_SUSPEND_CPU, &ac); return (error); } int -vm_resume_cpu(struct vmctx *ctx, int vcpu) +vm_suspend_cpu(struct vcpu *vcpu) +{ + struct vm_activate_cpu ac; + int error; + + bzero(&ac, sizeof(struct vm_activate_cpu)); + error = vcpu_ioctl(vcpu, VM_SUSPEND_CPU, &ac); + return (error); +} + +int +vm_resume_cpu(struct vcpu *vcpu) +{ + struct vm_activate_cpu ac; + int error; + + bzero(&ac, sizeof(struct vm_activate_cpu)); + error = vcpu_ioctl(vcpu, VM_RESUME_CPU, &ac); + return (error); +} + +int +vm_resume_all_cpus(struct vmctx *ctx) { struct vm_activate_cpu ac; int error; bzero(&ac, sizeof(struct vm_activate_cpu)); - ac.vcpuid = vcpu; + ac.vcpuid = -1; error = ioctl(ctx->fd, VM_RESUME_CPU, &ac); return (error); } int -vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *info1, uint64_t *info2) +vm_get_intinfo(struct vcpu *vcpu, uint64_t *info1, uint64_t *info2) { struct vm_intinfo vmii; int error; bzero(&vmii, sizeof(struct vm_intinfo)); - vmii.vcpuid = vcpu; - error = ioctl(ctx->fd, VM_GET_INTINFO, &vmii); + error = vcpu_ioctl(vcpu, VM_GET_INTINFO, &vmii); if (error == 0) { *info1 = vmii.info1; *info2 = vmii.info2; @@ -1606,15 +1640,14 @@ vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *info1, uint64_t *info2) } int -vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t info1) +vm_set_intinfo(struct vcpu *vcpu, uint64_t info1) { struct vm_intinfo vmii; int error; bzero(&vmii, sizeof(struct vm_intinfo)); - vmii.vcpuid = vcpu; vmii.info1 = info1; - error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii); + error = vcpu_ioctl(vcpu, VM_SET_INTINFO, &vmii); return (error); } @@ -1671,10 +1704,11 @@ vm_rtc_gettime(struct vmctx *ctx, time_t *secs) } int -vm_restart_instruction(struct vmctx *ctx, int vcpu) +vm_restart_instruction(struct vcpu *vcpu) { + int arg; - return (ioctl(ctx->fd, VM_RESTART_INSTRUCTION, &vcpu)); + return (vcpu_ioctl(vcpu, VM_RESTART_INSTRUCTION, &arg)); } int diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 1be1f19507a9..322b47e4ee0e 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -43,9 +43,10 @@ * API version for out-of-tree consumers like grub-bhyve for making compile * time decisions. */ -#define VMMAPI_VERSION 0104 /* 2 digit major followed by 2 digit minor */ +#define VMMAPI_VERSION 0200 /* 2 digit major followed by 2 digit minor */ struct iovec; +struct vcpu; struct vmctx; struct vm_snapshot_meta; enum x2apic_state; @@ -122,15 +123,18 @@ struct vmctx *vm_open(const char *name); void vm_close(struct vmctx *ctx); void vm_destroy(struct vmctx *ctx); int vm_limit_rights(struct vmctx *ctx); +struct vcpu *vm_vcpu_open(struct vmctx *ctx, int vcpuid); +void vm_vcpu_close(struct vcpu *vcpu); +int vcpu_id(struct vcpu *vcpu); int vm_parse_memsize(const char *optarg, size_t *memsize); int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s); void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len); /* inverse operation to vm_map_gpa - extract guest address from host pointer */ vm_paddr_t vm_rev_map_gpa(struct vmctx *ctx, void *addr); int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num); -int vm_gla2gpa(struct vmctx *, int vcpuid, struct vm_guest_paging *paging, +int vm_gla2gpa(struct vcpu *vcpu, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa, int *fault); -int vm_gla2gpa_nofault(struct vmctx *, int vcpuid, +int vm_gla2gpa_nofault(struct vcpu *vcpu, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa, int *fault); uint32_t vm_get_lowmem_limit(struct vmctx *ctx); @@ -140,44 +144,43 @@ int vm_get_memflags(struct vmctx *ctx); const char *vm_get_name(struct vmctx *ctx); size_t vm_get_lowmem_size(struct vmctx *ctx); size_t vm_get_highmem_size(struct vmctx *ctx); -int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, +int vm_set_desc(struct vcpu *vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access); -int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, +int vm_get_desc(struct vcpu *vcpu, int reg, uint64_t *base, uint32_t *limit, uint32_t *access); -int vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, - struct seg_desc *seg_desc); -int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); -int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); -int vm_set_register_set(struct vmctx *ctx, int vcpu, unsigned int count, +int vm_get_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *seg_desc); +int vm_set_register(struct vcpu *vcpu, int reg, uint64_t val); +int vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval); +int vm_set_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uint64_t *regvals); -int vm_get_register_set(struct vmctx *ctx, int vcpu, unsigned int count, +int vm_get_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uint64_t *regvals); *** 5574 LINES SKIPPED *** From nobody Fri Mar 24 18:49:14 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pjrpg24HZz40xds; Fri, 24 Mar 2023 18:49: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 4Pjrpg1NRVz4bVC; Fri, 24 Mar 2023 18:49:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4SUIjSpLksM/LH26TOUNeWEEdOcexUMAgqSgtsSKWoE=; b=yV2bMn/U/y0UhXg0j+c7kOYsooZreOd93hZbFL3zm3bJpzPGky/j2FNBxBGONm1XrtTEkT tXmzd+N3I4iIp6PprOH1xjXkyt+4ZNPzPmwiFfwZBrHtMhF7c8weChS6kfCPrnv0DBnyAc bd8Qp1c2n/M7n8MArB5c4MWw9afocL5m0GegBJoDwBJFTrE8i2n51fX71pWJAVe5ZXPy0d TVn/Dg5dvmCWnJSzH5LoXYomtAs/KZEG+VLiP9Hh25SjOlXeYC7bSF9wZ9RmF4iFVZUgE+ xZB3qjgnMpUrgeUPWNHPXfkbrMoNi7cyr5gh7jg45+Be29POLrcSB51RRYKzAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679683755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4SUIjSpLksM/LH26TOUNeWEEdOcexUMAgqSgtsSKWoE=; b=gy7YiM4HK7e0wzWIFLfePV2vCpbSYVV9uT2zTLAZ6+I3O8vnqOKT+3sqaE1+tXZVKdiqaL B1Y5qctOe+/UT6BJsIBTP6QaWoxDdJjQXQ3Y43XIf7kJ76Kw/T1dIGF4C24CJmPBGZRzT3 jWdxjnftUxGwOHdq4gY9skyGttGoMdhXQ7BBGCu1e1jXN2wYCS/Epvvq2f4ujUjR3aUDEb u7gW0TwsVRqfj1vOvHQUJa/phqPM5D8ARHmCQsLuz5E9xkp7lAo4Kc7l8WzDfQgTAN8uHX e9h8TDv4w9YOeLU/7xkSjs9y2Ger9x119yYYEMA1AwsqX5BAs4+AbkqO2YuDlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679683755; a=rsa-sha256; cv=none; b=uSK8Zh5F1nc9vH7PbrB/2UbGNIX9G3M2xzYLmVRKg/pCR+/6ott03a/uLXPoBLsQB8nOki eBJQf7Y5BeWuCfAM5cSUDQqAFbKSvqr7pNKF18SKLLA3v/OOeRroIu7HBueXr03dp2/0nv XCtOhBu+Objp5Nemeu6mb7/Hrq68uE6RgL2sdzHcRUJ4g2kHODU2NRHgKQ/tkH4LxTw75a EKiQd5KOK7ujz8NDr9hNlEFpzf93xPnlLhg/r5PeHBgRruGc2USmWBY1gm47ajW+ZvmTCr /FLv4szHpk15p9oVsohhcfts8PTWu+ZBw+vpEpepORUw12YyODrGOCNCz6T55A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pjrpg0TCtzTxW; Fri, 24 Mar 2023 18:49: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 32OInFAg074931; Fri, 24 Mar 2023 18:49:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OInE5r074930; Fri, 24 Mar 2023 18:49:14 GMT (envelope-from git) Date: Fri, 24 Mar 2023 18:49:14 GMT Message-Id: <202303241849.32OInE5r074930@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: 0f735657aa76 - main - bhyve: Remove vmctx member from struct vm_snapshot_meta. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f735657aa762e3b226087a9be6edf95868bc62d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0f735657aa762e3b226087a9be6edf95868bc62d commit 0f735657aa762e3b226087a9be6edf95868bc62d Author: John Baldwin AuthorDate: 2023-03-24 18:49:06 +0000 Commit: John Baldwin CommitDate: 2023-03-24 18:49:06 +0000 bhyve: Remove vmctx member from struct vm_snapshot_meta. This is a userland-only pointer that isn't relevant to the kernel and doesn't belong in the ioctl structure shared between userland and the kernel. For the kernel, the old structure for the ioctl is still supported under COMPAT_FREEBSD13. This changes vm_snapshot_req() in libvmmapi to accept an explicit vmctx argument. It also changes vm_snapshot_guest2host_addr to take an explicit vmctx argument. As part of this change, move the declaration for this function and its wrapper macro from vmm_snapshot.h to snapshot.h as it is a userland-only API. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38125 --- lib/libvmmapi/vmmapi.c | 4 ++-- lib/libvmmapi/vmmapi.h | 2 +- sys/amd64/include/vmm_snapshot.h | 23 ----------------------- sys/amd64/vmm/vmm_dev.c | 32 ++++++++++++++++++++++++++++++++ usr.sbin/bhyve/bhyverun.c | 2 +- usr.sbin/bhyve/pci_ahci.c | 11 ++++++----- usr.sbin/bhyve/pci_e82545.c | 12 +++++++----- usr.sbin/bhyve/pci_xhci.c | 25 +++++++++++++------------ usr.sbin/bhyve/snapshot.c | 36 +++++++++++++++--------------------- usr.sbin/bhyve/snapshot.h | 23 ++++++++++++++++++++++- usr.sbin/bhyve/virtio.c | 12 ++++++++---- 11 files changed, 107 insertions(+), 75 deletions(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 2d0cc21aeb25..3cbc885b82db 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -1712,10 +1712,10 @@ vm_restart_instruction(struct vcpu *vcpu) } int -vm_snapshot_req(struct vm_snapshot_meta *meta) +vm_snapshot_req(struct vmctx *ctx, struct vm_snapshot_meta *meta) { - if (ioctl(meta->ctx->fd, VM_SNAPSHOT_REQ, meta) == -1) { + if (ioctl(ctx->fd, VM_SNAPSHOT_REQ, meta) == -1) { #ifdef SNAPSHOT_DEBUG fprintf(stderr, "%s: snapshot failed for %s: %d\r\n", __func__, meta->dev_name, errno); diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 322b47e4ee0e..459aad0fe1a3 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -265,7 +265,7 @@ void vm_setup_freebsd_gdt(uint64_t *gdtr); /* * Save and restore */ -int vm_snapshot_req(struct vm_snapshot_meta *meta); +int vm_snapshot_req(struct vmctx *ctx, struct vm_snapshot_meta *meta); int vm_restore_time(struct vmctx *ctx); /* diff --git a/sys/amd64/include/vmm_snapshot.h b/sys/amd64/include/vmm_snapshot.h index c4d7fc4d4371..a34684e9b671 100644 --- a/sys/amd64/include/vmm_snapshot.h +++ b/sys/amd64/include/vmm_snapshot.h @@ -44,8 +44,6 @@ #include #endif -struct vmctx; - enum snapshot_req { STRUCT_VIOAPIC = 1, STRUCT_VM, @@ -89,7 +87,6 @@ enum vm_snapshot_op { }; struct vm_snapshot_meta { - struct vmctx *ctx; void *dev_data; const char *dev_name; /* identify userspace devices */ enum snapshot_req dev_req; /* identify kernel structs */ @@ -103,8 +100,6 @@ void vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op); int vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta); size_t vm_get_snapshot_size(struct vm_snapshot_meta *meta); -int vm_snapshot_guest2host_addr(void **addrp, size_t len, bool restore_null, - struct vm_snapshot_meta *meta); int vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta); @@ -120,24 +115,6 @@ do { \ #define SNAPSHOT_VAR_OR_LEAVE(DATA, META, RES, LABEL) \ SNAPSHOT_BUF_OR_LEAVE(&(DATA), sizeof(DATA), (META), (RES), LABEL) -/* - * Address variables are pointers to guest memory. - * - * When RNULL != 0, do not enforce invalid address checks; instead, make the - * pointer NULL at restore time. - */ -#define SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(ADDR, LEN, RNULL, META, RES, LABEL) \ -do { \ - (RES) = vm_snapshot_guest2host_addr((void **)&(ADDR), (LEN), (RNULL), \ - (META)); \ - if ((RES) != 0) { \ - if ((RES) == EFAULT) \ - fprintf(stderr, "%s: invalid address: %s\r\n", \ - __func__, #ADDR); \ - goto LABEL; \ - } \ -} while (0) - /* compare the value in the meta buffer with the data */ #define SNAPSHOT_BUF_CMP_OR_LEAVE(DATA, LEN, META, RES, LABEL) \ do { \ diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index 2d8ff43a74dd..e7f7d24cecd2 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -79,6 +79,20 @@ struct vm_stats_old { #define VM_STATS_OLD \ _IOWR('v', IOCNUM_VM_STATS, struct vm_stats_old) + +struct vm_snapshot_meta_old { + void *ctx; /* unused */ + void *dev_data; + const char *dev_name; /* identify userspace devices */ + enum snapshot_req dev_req; /* identify kernel structs */ + + struct vm_snapshot_buffer buffer; + + enum vm_snapshot_op op; +}; + +#define VM_SNAPSHOT_REQ_OLD \ + _IOWR('v', IOCNUM_SNAPSHOT_REQ, struct vm_snapshot_meta_old) #endif struct devmem_softc { @@ -416,6 +430,9 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, bool memsegs_locked; #ifdef BHYVE_SNAPSHOT struct vm_snapshot_meta *snapshot_meta; +#ifdef COMPAT_FREEBSD13 + struct vm_snapshot_meta_old *snapshot_old; +#endif #endif error = vmm_priv_check(curthread->td_ucred); @@ -495,6 +512,9 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, case VM_UNMAP_PPTDEV_MMIO: #ifdef BHYVE_SNAPSHOT case VM_SNAPSHOT_REQ: +#ifdef COMPAT_FREEBSD13 + case VM_SNAPSHOT_REQ_OLD: +#endif case VM_RESTORE_TIME: #endif /* @@ -951,6 +971,18 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, snapshot_meta = (struct vm_snapshot_meta *)data; error = vm_snapshot_req(sc->vm, snapshot_meta); break; +#ifdef COMPAT_FREEBSD13 + case VM_SNAPSHOT_REQ_OLD: + /* + * The old structure just has an additional pointer at + * the start that is ignored. + */ + snapshot_old = (struct vm_snapshot_meta_old *)data; + snapshot_meta = + (struct vm_snapshot_meta *)&snapshot_old->dev_data; + error = vm_snapshot_req(sc->vm, snapshot_meta); + break; +#endif case VM_RESTORE_TIME: error = vm_restore_time(sc->vm); break; diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 57d8dd7aea60..d447a9ee60e4 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1534,7 +1534,7 @@ main(int argc, char *argv[]) } fprintf(stdout, "Restoring pci devs...\r\n"); - if (vm_restore_user_devs(ctx, &rstate) != 0) { + if (vm_restore_user_devs(&rstate) != 0) { fprintf(stderr, "Failed to restore PCI device state.\n"); exit(1); } diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 9c023d93cab9..6b6a91325f72 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -41,8 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -61,6 +59,9 @@ __FBSDID("$FreeBSD$"); #include "config.h" #include "debug.h" #include "pci_emul.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif #include "ahci.h" #include "block_if.h" @@ -2623,10 +2624,10 @@ pci_ahci_snapshot(struct vm_snapshot_meta *meta) goto done; } - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(port->cmd_lst, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, port->cmd_lst, AHCI_CL_SIZE * AHCI_MAX_SLOTS, false, meta, ret, done); - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(port->rfis, 256, false, meta, - ret, done); + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, port->rfis, 256, + false, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(port->ata_ident, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(port->atapi, meta, ret, done); diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c index bec8edb17caf..646eb0ca0118 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #ifndef WITHOUT_CAPSICUM #include #endif -#include #include #include @@ -68,6 +67,9 @@ __FBSDID("$FreeBSD$"); #include "config.h" #include "debug.h" #include "pci_emul.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif #include "mevent.h" #include "net_utils.h" #include "net_backends.h" @@ -2436,8 +2438,8 @@ e82545_snapshot(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(sc->esc_TADV, meta, ret, done); /* Has dependency on esc_TDLEN; reoreder of fields from struct. */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->esc_txdesc, sc->esc_TDLEN, - true, meta, ret, done); + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->esc_txdesc, + sc->esc_TDLEN, true, meta, ret, done); /* L2 frame acceptance */ for (i = 0; i < (int)nitems(sc->esc_uni); i++) { @@ -2471,8 +2473,8 @@ e82545_snapshot(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(sc->esc_RXCSUM, meta, ret, done); /* Has dependency on esc_RDLEN; reoreder of fields from struct. */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->esc_rxdesc, sc->esc_TDLEN, - true, meta, ret, done); + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->esc_rxdesc, + sc->esc_TDLEN, true, meta, ret, done); /* IO Port register access */ SNAPSHOT_VAR_OR_LEAVE(sc->io_addr, meta, ret, done); diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c index 0ac1423f0736..2c5f36eb130d 100644 --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -60,6 +58,9 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "pci_emul.h" #include "pci_xhci.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif #include "usb_emul.h" @@ -2965,8 +2966,8 @@ pci_xhci_map_devs_slots(struct pci_xhci_softc *sc, int maps[]) } static int -pci_xhci_snapshot_ep(struct pci_xhci_softc *sc __unused, - struct pci_xhci_dev_emu *dev, int idx, struct vm_snapshot_meta *meta) +pci_xhci_snapshot_ep(struct pci_xhci_softc *sc, struct pci_xhci_dev_emu *dev, + int idx, struct vm_snapshot_meta *meta) { int k; int ret; @@ -2992,9 +2993,9 @@ pci_xhci_snapshot_ep(struct pci_xhci_softc *sc __unused, for (k = 0; k < USB_MAX_XFER_BLOCKS; k++) { xfer_block = &xfer->data[k]; - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(xfer_block->buf, - XHCI_GADDR_SIZE(xfer_block->buf), true, meta, ret, - done); + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->xsc_pi->pi_vmctx, + xfer_block->buf, XHCI_GADDR_SIZE(xfer_block->buf), true, + meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(xfer_block->blen, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(xfer_block->bdone, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(xfer_block->processed, meta, ret, done); @@ -3059,11 +3060,11 @@ pci_xhci_snapshot(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(sc->opregs.config, meta, ret, done); /* opregs.cr_p */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->opregs.cr_p, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->opregs.cr_p, XHCI_GADDR_SIZE(sc->opregs.cr_p), true, meta, ret, done); /* opregs.dcbaa_p */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->opregs.dcbaa_p, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->opregs.dcbaa_p, XHCI_GADDR_SIZE(sc->opregs.dcbaa_p), true, meta, ret, done); /* rtsregs */ @@ -3078,11 +3079,11 @@ pci_xhci_snapshot(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.intrreg.erdp, meta, ret, done); /* rtsregs.erstba_p */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->rtsregs.erstba_p, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->rtsregs.erstba_p, XHCI_GADDR_SIZE(sc->rtsregs.erstba_p), true, meta, ret, done); /* rtsregs.erst_p */ - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->rtsregs.erst_p, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, sc->rtsregs.erst_p, XHCI_GADDR_SIZE(sc->rtsregs.erst_p), true, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_deq_seg, meta, ret, done); @@ -3168,7 +3169,7 @@ pci_xhci_snapshot(struct vm_snapshot_meta *meta) if (dev == NULL) continue; - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(dev->dev_ctx, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(pi->pi_vmctx, dev->dev_ctx, XHCI_GADDR_SIZE(dev->dev_ctx), true, meta, ret, done); if (dev->dev_ctx != NULL) { diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 72b63c506c41..866fc265b8aa 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -886,7 +886,6 @@ vm_restore_kern_struct(struct vmctx *ctx, struct restore_state *rstate, } meta = &(struct vm_snapshot_meta) { - .ctx = ctx, .dev_name = info->struct_name, .dev_req = info->req, @@ -899,7 +898,7 @@ vm_restore_kern_struct(struct vmctx *ctx, struct restore_state *rstate, .op = VM_SNAPSHOT_RESTORE, }; - ret = vm_snapshot_req(meta); + ret = vm_snapshot_req(ctx, meta); if (ret != 0) { fprintf(stderr, "%s: Failed to restore struct: %s\r\n", __func__, info->struct_name); @@ -927,7 +926,7 @@ vm_restore_kern_structs(struct vmctx *ctx, struct restore_state *rstate) } static int -vm_restore_user_dev(struct vmctx *ctx, struct restore_state *rstate, +vm_restore_user_dev(struct restore_state *rstate, const struct vm_snapshot_dev_info *info) { void *dev_ptr; @@ -950,7 +949,6 @@ vm_restore_user_dev(struct vmctx *ctx, struct restore_state *rstate, } meta = &(struct vm_snapshot_meta) { - .ctx = ctx, .dev_name = info->dev_name, .buffer.buf_start = dev_ptr, @@ -974,13 +972,13 @@ vm_restore_user_dev(struct vmctx *ctx, struct restore_state *rstate, int -vm_restore_user_devs(struct vmctx *ctx, struct restore_state *rstate) +vm_restore_user_devs(struct restore_state *rstate) { size_t i; int ret; for (i = 0; i < nitems(snapshot_devs); i++) { - ret = vm_restore_user_dev(ctx, rstate, &snapshot_devs[i]); + ret = vm_restore_user_dev(rstate, &snapshot_devs[i]); if (ret != 0) return (ret); } @@ -1029,14 +1027,14 @@ vm_resume_user_devs(void) } static int -vm_snapshot_kern_struct(int data_fd, xo_handle_t *xop, const char *array_key, - struct vm_snapshot_meta *meta, off_t *offset) +vm_snapshot_kern_struct(struct vmctx *ctx, int data_fd, xo_handle_t *xop, + const char *array_key, struct vm_snapshot_meta *meta, off_t *offset) { int ret; size_t data_size; ssize_t write_cnt; - ret = vm_snapshot_req(meta); + ret = vm_snapshot_req(ctx, meta); if (ret != 0) { fprintf(stderr, "%s: Failed to snapshot struct %s\r\n", __func__, meta->dev_name); @@ -1089,8 +1087,6 @@ vm_snapshot_kern_structs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) } meta = &(struct vm_snapshot_meta) { - .ctx = ctx, - .buffer.buf_start = buffer, .buffer.buf_size = buf_size, @@ -1106,8 +1102,8 @@ vm_snapshot_kern_structs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) meta->buffer.buf = meta->buffer.buf_start; meta->buffer.buf_rem = meta->buffer.buf_size; - ret = vm_snapshot_kern_struct(data_fd, xop, JSON_DEV_ARR_KEY, - meta, &offset); + ret = vm_snapshot_kern_struct(ctx, data_fd, xop, + JSON_DEV_ARR_KEY, meta, &offset); if (ret != 0) { error = -1; goto err_vm_snapshot_kern_data; @@ -1186,7 +1182,7 @@ vm_snapshot_user_dev(const struct vm_snapshot_dev_info *info, } static int -vm_snapshot_user_devs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) +vm_snapshot_user_devs(int data_fd, xo_handle_t *xop) { int ret; off_t offset; @@ -1210,8 +1206,6 @@ vm_snapshot_user_devs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) } meta = &(struct vm_snapshot_meta) { - .ctx = ctx, - .buffer.buf_start = buffer, .buffer.buf_size = buf_size, @@ -1395,7 +1389,7 @@ vm_checkpoint(struct vmctx *ctx, const char *checkpoint_file, bool stop_vm) goto done; } - ret = vm_snapshot_user_devs(ctx, kdata_fd, xop); + ret = vm_snapshot_user_devs(kdata_fd, xop); if (ret != 0) { fprintf(stderr, "Failed to snapshot device state.\n"); error = -1; @@ -1639,14 +1633,14 @@ vm_get_snapshot_size(struct vm_snapshot_meta *meta) } int -vm_snapshot_guest2host_addr(void **addrp, size_t len, bool restore_null, - struct vm_snapshot_meta *meta) +vm_snapshot_guest2host_addr(struct vmctx *ctx, void **addrp, size_t len, + bool restore_null, struct vm_snapshot_meta *meta) { int ret; vm_paddr_t gaddr; if (meta->op == VM_SNAPSHOT_SAVE) { - gaddr = paddr_host2guest(meta->ctx, *addrp); + gaddr = paddr_host2guest(ctx, *addrp); if (gaddr == (vm_paddr_t) -1) { if (!restore_null || (restore_null && (*addrp != NULL))) { @@ -1665,7 +1659,7 @@ vm_snapshot_guest2host_addr(void **addrp, size_t len, bool restore_null, } } - *addrp = paddr_guest2host(meta->ctx, gaddr, len); + *addrp = paddr_guest2host(ctx, gaddr, len); } else { ret = EINVAL; } diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index e59c92f2326f..a125dddc1e71 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -95,7 +95,7 @@ void checkpoint_cpu_suspend(int vcpu); int restore_vm_mem(struct vmctx *ctx, struct restore_state *rstate); int vm_restore_kern_structs(struct vmctx *ctx, struct restore_state *rstate); -int vm_restore_user_devs(struct vmctx *ctx, struct restore_state *rstate); +int vm_restore_user_devs(struct restore_state *rstate); int vm_pause_user_devs(void); int vm_resume_user_devs(void); @@ -106,4 +106,25 @@ void init_snapshot(void); int load_restore_file(const char *filename, struct restore_state *rstate); +int vm_snapshot_guest2host_addr(struct vmctx *ctx, void **addrp, size_t len, + bool restore_null, struct vm_snapshot_meta *meta); + +/* + * Address variables are pointers to guest memory. + * + * When RNULL != 0, do not enforce invalid address checks; instead, make the + * pointer NULL at restore time. + */ +#define SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(CTX, ADDR, LEN, RNULL, META, RES, LABEL) \ +do { \ + (RES) = vm_snapshot_guest2host_addr((CTX), (void **)&(ADDR), (LEN), \ + (RNULL), (META)); \ + if ((RES) != 0) { \ + if ((RES) == EFAULT) \ + fprintf(stderr, "%s: invalid address: %s\r\n", \ + __func__, #ADDR); \ + goto LABEL; \ + } \ +} while (0) + #endif diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index 68304f76dc49..12d5f9b147d0 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -47,6 +46,9 @@ __FBSDID("$FreeBSD$"); #include "bhyverun.h" #include "debug.h" #include "pci_emul.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif #include "virtio.h" /* @@ -880,8 +882,10 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) int ret; struct virtio_consts *vc; struct vqueue_info *vq; + struct vmctx *ctx; uint64_t addr_size; + ctx = vs->vs_pi->pi_vmctx; vc = vs->vs_vc; /* Save virtio queue info */ @@ -903,15 +907,15 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) continue; addr_size = vq->vq_qsize * sizeof(struct vring_desc); - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_desc, addr_size, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(ctx, vq->vq_desc, addr_size, false, meta, ret, done); addr_size = (2 + vq->vq_qsize + 1) * sizeof(uint16_t); - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_avail, addr_size, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(ctx, vq->vq_avail, addr_size, false, meta, ret, done); addr_size = (2 + 2 * vq->vq_qsize + 1) * sizeof(uint16_t); - SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_used, addr_size, + SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(ctx, vq->vq_used, addr_size, false, meta, ret, done); SNAPSHOT_BUF_OR_LEAVE(vq->vq_desc, From nobody Fri Mar 24 20:42:56 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjvKs2bZ1z416B2; Fri, 24 Mar 2023 20:42: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 4PjvKs0jJbz3McZ; Fri, 24 Mar 2023 20:42:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679690577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PN61+vfPSOIQesDSgNb1hNO1VsmTKahcRhkSSJAAuAw=; b=opqBXpRPI8TjdwHbmrdMCzV85UMp1vos0GqpFmo+2DQoR0MLEL36HrzbStiTfsEgit2C4/ ziLHsreE+yMd0s91rK9CJhEY8+LudzLOywgoaPeCQDUZdBLQF+it1tZ2WPFb5904TmGPeb Nl0rDEo3MDeQBH9QmNFMSUEnrn9JIJD3lcNy7i8EZpLA7OtwOsOPxQjtbi0Clm85EkGIBp hzkSLxgYMpRKnawYJNxOCWMZuVjPkYI8skC/XEJ2i1P8QUtccZUzkfPS6Hxtw2CCkGhfWb M2HoEPj7nUF8Txyvn/ubOFwf3VZbmEv4atxMC6AGjropxFdOmUko2QG6FU95+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679690577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PN61+vfPSOIQesDSgNb1hNO1VsmTKahcRhkSSJAAuAw=; b=vVA5oTD5JEtgswEXTJb0ZdsrzzXE5XqbDeQNY+NZwNk1Hat8W1CI8UFRaCZE24kwKrvpSY VzBKfYtmtJbaA4rVd4QSm1zG1YwQonwLfZLG925XON6hK34zM4wWFPMFJeHLbU6ntLGEFD jrjuhACWFB80OeOc6wVHs561gwXcxn5xFf2BduCGGpTp69r7sWAG0sfIxn9RyJmP1uXH52 M73vZsIH+T0f6ClZiIuufSBcE+5YXKYYhs0VrKttgwaeTaJH8LED5ddZV8GAFhuFsUQarl CrUDbNskP0ztzMGPM6K8y+kZh+tFusw7twldRBFDA8ydfjjHSKCGkOZDhhX4Fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679690577; a=rsa-sha256; cv=none; b=YxbQMkKjtSzT/2HdbdMcjqJ+7c+P0MUhebcV7IHFEuUz1GgPEd+jkwBWQWchyG9jdB9x5c XUSvy4bOIzB/L/flYf/s5TQvEm8SrsntZi6wlkYErBm4Vkkv/dHAH6kos5WHRxGQCtKcHW P11FC5H0AmjrUUl/bWmFY3DfbAUl4b+RxBayd9STxQ27DSizJyDMJrQe0JqIIFXWmEj47D mbafwN+YcQY4luYc+/Hhp6MjnSlLTRtspK00LTjAA8pwrWe3VsIl3g6c2zWaA8Be5ii2si pHy3S9zPEOun0OFW61hnFS4XVzyrRO+we/GGmnXb57K0uljRDbjy1wo/5VVwvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjvKr6tj3zXkT; Fri, 24 Mar 2023 20:42: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 32OKguIe070574; Fri, 24 Mar 2023 20:42:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OKgu7H070573; Fri, 24 Mar 2023 20:42:56 GMT (envelope-from git) Date: Fri, 24 Mar 2023 20:42:56 GMT Message-Id: <202303242042.32OKgu7H070573@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: b22fccad8c7a - main - Remove libvmmapi.so.5 after the shlib version was bumped to 6. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b22fccad8c7a2dc24d4e23dfa8140e040d9ac830 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b22fccad8c7a2dc24d4e23dfa8140e040d9ac830 commit b22fccad8c7a2dc24d4e23dfa8140e040d9ac830 Author: John Baldwin AuthorDate: 2023-03-24 20:42:18 +0000 Commit: John Baldwin CommitDate: 2023-03-24 20:42:18 +0000 Remove libvmmapi.so.5 after the shlib version was bumped to 6. --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index e3cb44fa9f84..72b119c1c85b 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20230324: libvmmapi shlib version bumped to 6 +OLD_LIBS+=usr/lib/libvmmapi.so.5 + # 20230320: vcount.9 removed OLD_FILES+=usr/share/man/man9/count_dev.9.gz OLD_FILES+=usr/share/man/man9/vcount.9.gz From nobody Fri Mar 24 20:46:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjvPk2Fb7z416dg; Fri, 24 Mar 2023 20:46: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 4PjvPk1kQkz3MrL; Fri, 24 Mar 2023 20:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679690778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DB545orpdjG82d0RTzs3uV05xjawArbS8C8AakPJQZU=; b=pHMO2e1EdePzS9j/9L1P5nqoSQO7yZYjmy4+MnBZ2T27n7v2wYJVqNPaS2l4s61T4i4e0D tWSLOncDiONaHZL1GMdWre/8VwabYv5kayxLdixzb1tovq1dSWP0xB+1inpFHzDZ3DvI8l gvKTqquYL/9TBRPJyDDbNqL7JX5tt58IXwvEX9NGECG0mZSY1dFiZZSFHwuh0iDAK6PxQH m9QtbAhaVLF1gCqYCSR6eFaSVY+PAl1/HB3xnZMep+ZqC3+TpNiQYlJMoNVQgKFPILyDNb rc46Q0SII7Nkx4d/5ccn+WuX1/wRq+L6mMihpq6PkyZRlps8hZoFdhn2PgHyzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679690778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DB545orpdjG82d0RTzs3uV05xjawArbS8C8AakPJQZU=; b=OqpdsiALeBIw+bweQd8G0T4zn8LhyL8W5m19JYR1rneA4cMkzRsl7nR3a2xs3BHhMM0f1h JHYzdPLuDgZJXSl2KZrgCwK7aJtWXOnkiJcTRMkDhhshqB3Dx/x9Yf9fl8xi1G/s0/G/SX 1Kst7FKxLON4Ak1IgbG3jBcWkksL1kDhUrdqh0eJ0B9gKZdI8enKliasop7XEtJLwdBwfN /5JAB+vkAO7knW9TPYECcnAvYlx/lZbFzIrVDoQSOfyojZtocMacdQuHfRA7rGIc2bVSS4 IL9rIaW41SVdfQ1wqVeTsZ7YgvgayUqGwnNSxuZGMWywjDESEx2JCsL8AQDFIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679690778; a=rsa-sha256; cv=none; b=CoYJdxz5p5RjqhZ7IT/MZ7RB8FTnfSXlgoOTMNmq1qAnK38nKywx90t5fQgBS+GhihUYZP q7+KitCxRSfb0+1sr8p12bHmjrZLrMJ3zngy47T3Pct/3tmXUSte1RQeQ464HRs0t7vtvd GiJRvJ/OZ7yl354blMnLuC382jf/ZFLPMsOiDTnMjQytCF4z3/6kGOIHmlXE8sk53nNPN3 VETe+fwOHD2U8uPcTgmFRSqGKBJuBk0m2Yo17tRNgQqDREir5jnp3eDjUzJfCr/WTur2pS TBSJ2uq42gCrIZK0PXEUp7ccaieBNnf2+5JGNwCXosu9fsLpDxoi6TrnWyPLBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjvPk0pjYzXMk; Fri, 24 Mar 2023 20:46: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 32OKkI7H071262; Fri, 24 Mar 2023 20:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OKkIZO071261; Fri, 24 Mar 2023 20:46:18 GMT (envelope-from git) Date: Fri, 24 Mar 2023 20:46:18 GMT Message-Id: <202303242046.32OKkIZO071261@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 9b20ab1e1ef7 - main - local-unbound-setup: Disable the libc subscriber. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b20ab1e1ef7d3de672ec20a62f26a605db8d3d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=9b20ab1e1ef7d3de672ec20a62f26a605db8d3d0 commit 9b20ab1e1ef7d3de672ec20a62f26a605db8d3d0 Author: Dag-Erling Smørgrav AuthorDate: 2023-03-24 20:45:24 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-03-24 20:46:09 +0000 local-unbound-setup: Disable the libc subscriber. This is the correct way to prevent resolvconf from updating resolv.conf. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D39262 --- usr.sbin/unbound/setup/local-unbound-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/unbound/setup/local-unbound-setup.sh b/usr.sbin/unbound/setup/local-unbound-setup.sh index dc0768a672a6..f725b566b650 100755 --- a/usr.sbin/unbound/setup/local-unbound-setup.sh +++ b/usr.sbin/unbound/setup/local-unbound-setup.sh @@ -195,7 +195,7 @@ do_not_edit() { gen_resolvconf_conf() { local style="$1" do_not_edit - echo "resolv_conf=\"/dev/null\" # prevent updating ${resolv_conf}" + echo "libc=\"NO\"" if [ "${style}" = "dynamic" ] ; then echo "unbound_conf=\"${forward_conf}\"" echo "unbound_pid=\"${pidfile}\"" From nobody Sat Mar 25 09:47:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkDlW5Hpcz41whm; Sat, 25 Mar 2023 09:47: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 4PkDlW4Scwz3NGg; Sat, 25 Mar 2023 09:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679737671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nFkW84XLWVtO4pBpFUp+nC8jR89mAcyTJHDSmAjhSnk=; b=W8fz84lqfOjnUDxYkcOQAb4/pF4xyzUeNq0JQaWC512R+qhdKLwarWaXfExLQEjC0gJlC5 bBIbHF2r7U1oc2dlXy9SUXxtXGsbCEYZKJ6G7S6w4LjRdXT3brgHMQIKmlCowRk/4psNiA z29sSki7ef3nucuD7+mlk7ivZVYZSq43SsjXkOPReYnwkHrWclOY24Ee4tMwh3ScN9yRo6 Vu8B3qoV8+dnGwTjPAPSNOoWsrCUd/hQPiAXrZ8urrw/Zv/bH/KP502lUDUQm9PFFkJ3Sm QZyIdTxXD+1JdySzehxFZGRn0BPY4lBnTYYf+CTwGvttYl8/bH1tlBB2wHu+yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679737671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nFkW84XLWVtO4pBpFUp+nC8jR89mAcyTJHDSmAjhSnk=; b=Sg8Q8Xl9ccotsBXsWIkWH5VSXbYcKg4iktIU7/pae0AZEbnh9B2m4Mnh6cFd1gTMNl239+ vB1s6rCFqKAqXA7Ed+jb68o4yvgaKMc35kbf4He+tTvZWgZHJT8AZqQIzavLK3rRk2Pf1p eSdRQEevkPzgJFtYYQt+8c2zfNrVKpMXL9jzd0YFuwfqrKdK30xNO49pYrnAUoN4OxJrV1 0F/im5S8gT24HZPMzvYD5b2FMG8pWPL3uwxcPIxQrDW7FrcxfYnMFrru4liWEgbVDcHcty FTdbezgsndl8jDen/SyQwfyaZA/oLFEGC3Yn1RTwE1IWIR+WiQLQJqbWFpGbFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679737671; a=rsa-sha256; cv=none; b=cQ12BJjpwcmjwdNOl0omy5mUs0pqfv7Tzb4bzqoswNOdcFjdfSEYniJKCKG1+9nTiwuFYj 6kHOChmxAVssJ6XL2gdH/shffEXXez7lV8X1yavpr3gqPfg1WRSo3WutgrYOoVAo0vQHw2 E2vVWdnh8wJRA4LxSpQSe6OisvGnSvLXn+Q4LF215Wy5+tVDaB6h3D7hkBM3h9DK/DjBzj WmqnsvIt7AAeh3NGAyEPxgDZW4II3LN5R+YQgqFZxjX8zMoF6wRET5cHWkzAymszCsddPy 1KLKhP79WRIFl9+SKN8rLu2rHCjMN5jHDvijmR8IY9PnWxLysj3blI4BU8UdOg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkDlW3WHGzvJJ; Sat, 25 Mar 2023 09: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 32P9lpjG054870; Sat, 25 Mar 2023 09: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 32P9lp2D054869; Sat, 25 Mar 2023 09:47:51 GMT (envelope-from git) Date: Sat, 25 Mar 2023 09:47:51 GMT Message-Id: <202303250947.32P9lp2D054869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lorenzo Salvadore Subject: git: a756181cea9e - main - share/misc/committers-doc.dot: Add myself List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: salvadore X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a756181cea9ee7426f164a0b1783d283b8ab19c8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by salvadore: URL: https://cgit.FreeBSD.org/src/commit/?id=a756181cea9ee7426f164a0b1783d283b8ab19c8 commit a756181cea9ee7426f164a0b1783d283b8ab19c8 Author: Lorenzo Salvadore AuthorDate: 2023-03-24 11:58:35 +0000 Commit: Lorenzo Salvadore CommitDate: 2023-03-25 09:47:40 +0000 share/misc/committers-doc.dot: Add myself Add myself as a doc committer, mentored by carlavilla and dbaio. Approved by: carlavilla (mentor) Differential Revision: https://reviews.freebsd.org/D39254 --- share/misc/committers-doc.dot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 5c695d19573d..9602419e5e1b 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -97,6 +97,7 @@ pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2012/02/14"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2004/10/16"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2008/11/03"] ryusuke [label="Ryusuke Suzuki\nryusuke@FreeBSD.org\n2009/12/21"] +salvadore[label="Lorenzo Salvadore\nsalvadore@FreeBSD.org\n2023/03/20"] sevan [label="Sevan Janiyan\nsevan@FreeBSD.org\n2016/09/16"] sg [label="Stephen Gregoratto\nsg@FreeBSD.org\n2019/09/10"] simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2003/07/20"] @@ -141,6 +142,7 @@ carlavilla -> emaste carlavilla -> grahamperrin carlavilla -> lwhsu carlavilla -> pauamma +carlavilla -> salvadore ceri -> brd ceri -> brueffer @@ -148,6 +150,8 @@ ceri -> linimon ceri -> roam ceri -> simon +dbaio -> salvadore + den -> marck delphij -> chinsan From nobody Sat Mar 25 10:45:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkG2K37W2z420rp; Sat, 25 Mar 2023 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 4PkG2K2yNWz3hD2; Sat, 25 Mar 2023 10:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679741145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DQtdaNEBak25lfWPZE62FsvPyJQiK5Ju13LEXXGRU6o=; b=FsT7G889JifE78m6HQbkSLKU5BGopEwkKAt5XPvXPe9tX5/j+uHfveoLUPl2yAA7sDWdSa JnaW6wC37XUVkCMmqCmQypk276SZrCj9N1fcGBQ1LbaODPamX9eN600JroKN42B6WltdrZ EGm0xbMYSsDuBbcdWNy1jErlsLl/XWCE5oYj2q2Bj84Jq1QtDNqjv6pI+CctNRAQ0AxRnk jNJ6Wv2mmKaAbVrXhPmTxaONk1eRgyPr2sgx6K5frrkbpIbRwO1Pm62tpE3BEE/j02Ryoj y3sjXtQEa59A+h5kdYGUrDRY1QAcXNSTGaiv+ZK1hsHbV/wnkeID4SNhD1R01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679741145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DQtdaNEBak25lfWPZE62FsvPyJQiK5Ju13LEXXGRU6o=; b=gZORm7llvjGMUOD9H5Wd+ZLErItZr+jYY0wSmUB248N5g4C88OQi/t0LOH8GmbrQXhJUX6 zVGrjpgjpPiKikCktkm6bTPtgt2NXUvbAtfeX6oASXXZtYA5lgb60gRnBdzJNaEqbymLhH 8OQjyVoTBh0fMIa6JWHuY4MS/hS6LR6ng4BjhIcwD5s96ZB1sPwZLkJ+Mxpw3uPsVy1AMQ RwhzHtdgL26adhCVVcz+wb6Cd+ubuFRSkDfgA1/I60XA4rnTxqYBUzHAs/nvTOa/0qU5WN y1fjQKvDKJ0ZQBjywOf5sNNnjtg9dl4277M9/D0cBA796D5Ip8+GpUvtedEQfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679741145; a=rsa-sha256; cv=none; b=YOITSQ4v1l+CARZA12KKoNgJF99M1ZY8JdwOoi6ToPYh4FBXaeN/RCRmeUnSdCTH6jJnvr jdeEDeIcrSSIK1fMM9HREJ4UJUMLv08CT6OL+edqS0rN6v2Y9VRgeQxlf+rtGjrd/Zrrfo MWBeVn1+1gXiMZYCBum9oRGxPl+EGAKJz7SwiOsI08MFb+7zfqhQBLiTrBcQDgWGtIpU5n IdGaNE7Wq/dKnOzuYzq0AD+YcD6yYTzj1tuMC8mGNQ9KywRr2I+y+xbtnvzi1neK6+7ErU rknq6/meWW2vlt9vo4Jd+vwQ7SyPH9E02Lz/ZLCjtAa3PD8C4PuYRBVQXXmVEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkG2K22DvzwRk; Sat, 25 Mar 2023 10:45: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 32PAjjv9053861; Sat, 25 Mar 2023 10:45:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PAjjHr053860; Sat, 25 Mar 2023 10:45:45 GMT (envelope-from git) Date: Sat, 25 Mar 2023 10:45:45 GMT Message-Id: <202303251045.32PAjjHr053860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 0b56641cfcda - main - linsysfs(4): Reimplement listnics() using ifAPI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b56641cfcda30d06243223f37781ccc18455bef Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0b56641cfcda30d06243223f37781ccc18455bef commit 0b56641cfcda30d06243223f37781ccc18455bef Author: Dmitry Chagin AuthorDate: 2023-03-25 10:40:41 +0000 Commit: Dmitry Chagin CommitDate: 2023-03-25 10:40:41 +0000 linsysfs(4): Reimplement listnics() using ifAPI Handle if arrival/departure events. Reviewed by: melifaro (early version) Differential Revision: https://reviews.freebsd.org/D38901 MFC after: 1 month XMFC with: ifAPI --- sys/compat/linsysfs/linsysfs.c | 186 +-------------------- sys/compat/linsysfs/linsysfs.h | 38 +++++ sys/compat/linsysfs/linsysfs_net.c | 326 +++++++++++++++++++++++++++++++++++++ sys/modules/linsysfs/Makefile | 2 +- 4 files changed, 373 insertions(+), 179 deletions(-) diff --git a/sys/compat/linsysfs/linsysfs.c b/sys/compat/linsysfs/linsysfs.c index 3b1bdfc280fc..298ce4508b4d 100644 --- a/sys/compat/linsysfs/linsysfs.c +++ b/sys/compat/linsysfs/linsysfs.c @@ -37,22 +37,19 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include -#include -#include -#include - -#include -#include #include #include +#include + +MALLOC_DEFINE(M_LINSYSFS, "linsysfs", "Linsysfs structures"); + struct scsi_host_queue { TAILQ_ENTRY(scsi_host_queue) scsi_host_next; char *path; @@ -69,175 +66,6 @@ atoi(const char *str) return (int)strtol(str, (char **)NULL, 10); } -static int -linsysfs_ifnet_addr(PFS_FILL_ARGS) -{ - struct epoch_tracker et; - struct l_sockaddr lsa; - struct ifnet *ifp; - int error; - - CURVNET_SET(TD_TO_VNET(td)); - NET_EPOCH_ENTER(et); - ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); - if (ifp != NULL && (error = linux_ifhwaddr(ifp, &lsa)) == 0) - error = sbuf_printf(sb, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", - lsa.sa_data[0], lsa.sa_data[1], lsa.sa_data[2], - lsa.sa_data[3], lsa.sa_data[4], lsa.sa_data[5]); - else - error = ENOENT; - NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); - return (error == -1 ? ERANGE : error); -} - -static int -linsysfs_ifnet_addrlen(PFS_FILL_ARGS) -{ - - sbuf_printf(sb, "%d\n", LINUX_IFHWADDRLEN); - return (0); -} - -static int -linsysfs_ifnet_flags(PFS_FILL_ARGS) -{ - struct epoch_tracker et; - struct ifnet *ifp; - int error; - - CURVNET_SET(TD_TO_VNET(td)); - NET_EPOCH_ENTER(et); - ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); - if (ifp != NULL) - error = sbuf_printf(sb, "0x%x\n", linux_ifflags(ifp)); - else - error = ENOENT; - NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); - return (error == -1 ? ERANGE : error); -} - -static int -linsysfs_ifnet_ifindex(PFS_FILL_ARGS) -{ - struct epoch_tracker et; - struct ifnet *ifp; - int error; - - CURVNET_SET(TD_TO_VNET(td)); - NET_EPOCH_ENTER(et); - ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); - if (ifp != NULL) - error = sbuf_printf(sb, "%u\n", if_getindex(ifp)); - else - error = ENOENT; - NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); - return (error == -1 ? ERANGE : error); -} - -static int -linsysfs_ifnet_mtu(PFS_FILL_ARGS) -{ - struct epoch_tracker et; - struct ifnet *ifp; - int error; - - CURVNET_SET(TD_TO_VNET(td)); - NET_EPOCH_ENTER(et); - ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); - if (ifp != NULL) - error = sbuf_printf(sb, "%u\n", if_getmtu(ifp)); - else - error = ENOENT; - NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); - return (error == -1 ? ERANGE : error); -} - -static int -linsysfs_ifnet_tx_queue_len(PFS_FILL_ARGS) -{ - - /* XXX */ - sbuf_printf(sb, "1000\n"); - return (0); -} - -static int -linsysfs_ifnet_type(PFS_FILL_ARGS) -{ - struct epoch_tracker et; - struct l_sockaddr lsa; - struct ifnet *ifp; - int error; - - CURVNET_SET(TD_TO_VNET(td)); - NET_EPOCH_ENTER(et); - ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); - if (ifp != NULL && (error = linux_ifhwaddr(ifp, &lsa)) == 0) - error = sbuf_printf(sb, "%d\n", lsa.sa_family); - else - error = ENOENT; - NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); - return (error == -1 ? ERANGE : error); -} - -static void -linsysfs_listnics(struct pfs_node *dir) -{ - struct pfs_node *nic; - struct pfs_node *lo; - - nic = pfs_create_dir(dir, "eth0", NULL, NULL, NULL, 0); - - pfs_create_file(nic, "address", &linsysfs_ifnet_addr, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "addr_len", &linsysfs_ifnet_addrlen, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "flags", &linsysfs_ifnet_flags, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "ifindex", &linsysfs_ifnet_ifindex, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "mtu", &linsysfs_ifnet_mtu, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "tx_queue_len", &linsysfs_ifnet_tx_queue_len, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(nic, "type", &linsysfs_ifnet_type, - NULL, NULL, NULL, PFS_RD); - - lo = pfs_create_dir(dir, "lo", NULL, NULL, NULL, 0); - - pfs_create_file(lo, "address", &linsysfs_ifnet_addr, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "addr_len", &linsysfs_ifnet_addrlen, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "flags", &linsysfs_ifnet_flags, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "ifindex", &linsysfs_ifnet_ifindex, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "mtu", &linsysfs_ifnet_mtu, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "tx_queue_len", &linsysfs_ifnet_tx_queue_len, - NULL, NULL, NULL, PFS_RD); - - pfs_create_file(lo, "type", &linsysfs_ifnet_type, - NULL, NULL, NULL, PFS_RD); -} - /* * Filler function for proc_name */ @@ -650,7 +478,6 @@ linsysfs_init(PFS_INIT_ARGS) struct pfs_node *drm; struct pfs_node *pci; struct pfs_node *scsi; - struct pfs_node *net; struct pfs_node *devdir, *chardev; struct pfs_node *kernel; devclass_t devclass; @@ -702,7 +529,6 @@ linsysfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); linsysfs_listcpus(cpu); - linsysfs_listnics(net); /* /sys/kernel */ kernel = pfs_create_dir(root, "kernel", NULL, NULL, NULL, 0); @@ -712,6 +538,8 @@ linsysfs_init(PFS_INIT_ARGS) /* /sys/subsystem/... */ dir = pfs_create_dir(root, "subsystem", NULL, NULL, NULL, 0); + linsysfs_net_init(); + return (0); } @@ -730,6 +558,8 @@ linsysfs_uninit(PFS_INIT_ARGS) free(scsi_host, M_TEMP); } + linsysfs_net_uninit(); + return (0); } diff --git a/sys/compat/linsysfs/linsysfs.h b/sys/compat/linsysfs/linsysfs.h new file mode 100644 index 000000000000..005c0e090a6b --- /dev/null +++ b/sys/compat/linsysfs/linsysfs.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2023 Dmitry Chagin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _COMPAT_LINSYSFS_LINSYSFS_H_ +#define _COMPAT_LINSYSFS_LINSYSFS_H_ + +MALLOC_DECLARE(M_LINSYSFS); + +extern struct pfs_node *net; + +void linsysfs_net_init(void); +void linsysfs_net_uninit(void); + +#endif /* _COMPAT_LINSYSFS_LINSYSFS_H_ */ diff --git a/sys/compat/linsysfs/linsysfs_net.c b/sys/compat/linsysfs/linsysfs_net.c new file mode 100644 index 000000000000..00eb642f1db2 --- /dev/null +++ b/sys/compat/linsysfs/linsysfs_net.c @@ -0,0 +1,326 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2023 Dmitry Chagin + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +struct pfs_node *net; +static eventhandler_tag if_arrival_tag, if_departure_tag; + +static uint32_t net_latch_count = 0; +static struct mtx net_latch_mtx; +MTX_SYSINIT(net_latch_mtx, &net_latch_mtx, "lsfnet", MTX_DEF); + +struct ifp_nodes_queue { + TAILQ_ENTRY(ifp_nodes_queue) ifp_nodes_next; + if_t ifp; + struct pfs_node *pn; +}; +TAILQ_HEAD(,ifp_nodes_queue) ifp_nodes_q; + +static void +linsysfs_net_latch_hold(void) +{ + + mtx_lock(&net_latch_mtx); + if (net_latch_count++ > 0) + mtx_sleep(&net_latch_count, &net_latch_mtx, PDROP, "lsfnet", 0); + else + mtx_unlock(&net_latch_mtx); +} + +static void +linsysfs_net_latch_rele(void) +{ + + mtx_lock(&net_latch_mtx); + if (--net_latch_count > 0) + wakeup_one(&net_latch_count); + mtx_unlock(&net_latch_mtx); +} + +static int +linsysfs_ifnet_addr(PFS_FILL_ARGS) +{ + struct epoch_tracker et; + struct l_sockaddr lsa; + struct ifnet *ifp; + int error; + + CURVNET_SET(TD_TO_VNET(td)); + NET_EPOCH_ENTER(et); + ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); + if (ifp != NULL && (error = linux_ifhwaddr(ifp, &lsa)) == 0) + error = sbuf_printf(sb, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + lsa.sa_data[0], lsa.sa_data[1], lsa.sa_data[2], + lsa.sa_data[3], lsa.sa_data[4], lsa.sa_data[5]); + else + error = ENOENT; + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (error == -1 ? ERANGE : error); +} + +static int +linsysfs_ifnet_addrlen(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", LINUX_IFHWADDRLEN); + return (0); +} + +static int +linsysfs_ifnet_flags(PFS_FILL_ARGS) +{ + struct epoch_tracker et; + struct ifnet *ifp; + int error; + + CURVNET_SET(TD_TO_VNET(td)); + NET_EPOCH_ENTER(et); + ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); + if (ifp != NULL) + error = sbuf_printf(sb, "0x%x\n", linux_ifflags(ifp)); + else + error = ENOENT; + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (error == -1 ? ERANGE : error); +} + +static int +linsysfs_ifnet_ifindex(PFS_FILL_ARGS) +{ + struct epoch_tracker et; + struct ifnet *ifp; + int error; + + CURVNET_SET(TD_TO_VNET(td)); + NET_EPOCH_ENTER(et); + ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); + if (ifp != NULL) + error = sbuf_printf(sb, "%u\n", if_getindex(ifp)); + else + error = ENOENT; + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (error == -1 ? ERANGE : error); +} + +static int +linsysfs_ifnet_mtu(PFS_FILL_ARGS) +{ + struct epoch_tracker et; + struct ifnet *ifp; + int error; + + CURVNET_SET(TD_TO_VNET(td)); + NET_EPOCH_ENTER(et); + ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); + if (ifp != NULL) + error = sbuf_printf(sb, "%u\n", if_getmtu(ifp)); + else + error = ENOENT; + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (error == -1 ? ERANGE : error); +} + +static int +linsysfs_ifnet_tx_queue_len(PFS_FILL_ARGS) +{ + + /* XXX */ + sbuf_printf(sb, "1000\n"); + return (0); +} + +static int +linsysfs_ifnet_type(PFS_FILL_ARGS) +{ + struct epoch_tracker et; + struct l_sockaddr lsa; + struct ifnet *ifp; + int error; + + CURVNET_SET(TD_TO_VNET(td)); + NET_EPOCH_ENTER(et); + ifp = ifname_linux_to_ifp(td, pn->pn_parent->pn_name); + if (ifp != NULL && (error = linux_ifhwaddr(ifp, &lsa)) == 0) + error = sbuf_printf(sb, "%d\n", lsa.sa_family); + else + error = ENOENT; + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (error == -1 ? ERANGE : error); +} + +static struct pfs_node * +linsysfs_net_find_node(if_t ifp) +{ + struct ifp_nodes_queue *nq, *nq_tmp; + + TAILQ_FOREACH_SAFE(nq, &ifp_nodes_q, ifp_nodes_next, nq_tmp) { + if (nq->ifp == ifp) + return (nq->pn); + } + return (NULL); +} + +static int +linsysfs_net_addnic(if_t ifp, void *arg) +{ + char ifname[LINUX_IFNAMSIZ]; + struct ifp_nodes_queue *nq; + struct epoch_tracker et; + struct pfs_node *dir = arg; + struct pfs_node *nic = NULL; + int ret __diagused; + + NET_EPOCH_ENTER(et); + ret = ifname_bsd_to_linux_ifp(ifp, ifname, sizeof(ifname)); + NET_EPOCH_EXIT(et); + KASSERT(ret > 0, ("Interface (%s) is not converted", if_name(ifp))); + + nic = linsysfs_net_find_node(ifp); + MPASS(nic == NULL); + + nic = pfs_create_dir(dir, ifname, NULL, NULL, NULL, 0); + pfs_create_file(nic, "address", &linsysfs_ifnet_addr, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "addr_len", &linsysfs_ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "flags", &linsysfs_ifnet_flags, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "ifindex", &linsysfs_ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "mtu", &linsysfs_ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "tx_queue_len", &linsysfs_ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(nic, "type", &linsysfs_ifnet_type, + NULL, NULL, NULL, PFS_RD); + + nq = malloc(sizeof(*nq), M_LINSYSFS, M_WAITOK); + nq->pn = nic; + nq->ifp = ifp; + TAILQ_INSERT_TAIL(&ifp_nodes_q, nq, ifp_nodes_next); + return (0); +} + +static int +linsysfs_net_delnic(if_t ifp, void *arg) +{ + struct ifp_nodes_queue *nq, *nq_tmp; + + TAILQ_FOREACH_SAFE(nq, &ifp_nodes_q, ifp_nodes_next, nq_tmp) { + if (nq->ifp == ifp) { + TAILQ_REMOVE(&ifp_nodes_q, nq, ifp_nodes_next); + pfs_destroy(nq->pn); + free(nq, M_LINSYSFS); + return (0); + } + } + return (1); +} + +static void +linsysfs_net_listnics(struct pfs_node *dir) +{ + + CURVNET_SET(TD_TO_VNET(curthread)); + if_foreach_sleep(NULL, NULL, linsysfs_net_addnic, dir); + CURVNET_RESTORE(); +} + +static void +linsysfs_ifnet_arrival(void *arg __unused, struct ifnet *ifp) +{ + + linsysfs_net_latch_hold(); + linsysfs_net_addnic(ifp, net); + linsysfs_net_latch_rele(); +} + +static void +linsysfs_ifnet_departure(void *arg __unused, struct ifnet *ifp) +{ + + linsysfs_net_latch_hold(); + linsysfs_net_delnic(ifp, net); + linsysfs_net_latch_rele(); +} + +void +linsysfs_net_init(void) +{ + + MPASS(net != NULL); + TAILQ_INIT(&ifp_nodes_q); + if_arrival_tag = EVENTHANDLER_REGISTER(ifnet_arrival_event, + linsysfs_ifnet_arrival, NULL, EVENTHANDLER_PRI_ANY); + if_departure_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, + linsysfs_ifnet_departure, NULL, EVENTHANDLER_PRI_ANY); + + linsysfs_net_latch_hold(); + linsysfs_net_listnics(net); + linsysfs_net_latch_rele(); +} + +void +linsysfs_net_uninit(void) +{ + struct ifp_nodes_queue *nq, *nq_tmp; + + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, if_arrival_tag); + EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_departure_tag); + + linsysfs_net_latch_hold(); + TAILQ_FOREACH_SAFE(nq, &ifp_nodes_q, ifp_nodes_next, nq_tmp) { + TAILQ_REMOVE(&ifp_nodes_q, nq, ifp_nodes_next); + free(nq, M_LINSYSFS); + } + linsysfs_net_latch_rele(); +} diff --git a/sys/modules/linsysfs/Makefile b/sys/modules/linsysfs/Makefile index 058fbbc521b1..8ec02da435e4 100644 --- a/sys/modules/linsysfs/Makefile +++ b/sys/modules/linsysfs/Makefile @@ -5,7 +5,7 @@ KMOD= linsysfs SRCS= vnode_if.h \ device_if.h bus_if.h pci_if.h \ - linsysfs.c + linsysfs.c linsysfs_net.c .if !defined(KERNBUILDDIR) .warning Building Linuxulator outside of a kernel does not make sense From nobody Sat Mar 25 10:45:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkG2L5C9dz420qb; Sat, 25 Mar 2023 10:45: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 4PkG2L3dnbz3hBB; Sat, 25 Mar 2023 10:45:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679741146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v6uv5rgZ3HOpKfzgWlRjp0obzoOw1JWcVMcQLOvVNz8=; b=XXyGVhH6tPpOqU5ZiPUWSBSwX9gfPEtXKm0NYDuuvtJLj2Wt3SEbS82yzieTc4s4qvEfG/ 1ssExHP76J6XqO1LDYLRWd8r1vcVIezC5ck4AFqaJDHluo/hUuLCkx2uj8V84Yrm6gq5IU Bqh4c9vEiLhC5ylulMQuTw/XRNciTx3UewHdvPTFE8rUC+zgXpQGWMp8wZ0Fe0+A1V9TgW Mfe3g9POFaPjqPiNFlTaOWUFv6ymPtgVLYtpU0hXq2CeyMYeYDcFLOp9TB/hsnAk+adhXE /4MNmzHfJhvZDR5E/WxZ8xiPaVeeTH64zQBjFNadbToFRR7MvKD0WO7r4fmECA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679741146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v6uv5rgZ3HOpKfzgWlRjp0obzoOw1JWcVMcQLOvVNz8=; b=s2MLyYvYjtHEmArmVVdlHbkMMTaPUL0O8BCv8x4RvIsqwqdItXRzmu32mL/v0bDqtgY5uI MsQRYHfgyuRyn2GPlDpCvzqagWdq++ADhtkA01oViVDNuciLpGMN67ABNf8PRaAHWX4soq 27ca+5ebWzHrD7Bor5RXFeFIx2WhN8/zYpfe1OI43ZBUVy4+Gd+QDKpt6EfMl5iG6ovQGN 4k9D7sZ7H7r2IntgdRhXoH2EqGKR1xCv7VVCjITVKr7mOtz1Cjb274htRiUu5fz0faAqGf V6Y14KYuZEnUY/rsLD38IXQJf6NhxSsGz4iZmG9UtdHvupdJXG5IrL/IupyAdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679741146; a=rsa-sha256; cv=none; b=eJf8/woK4BC1Yhqg3E5JPE/BGQ2MkRQ/0kMSn94dfoFRtvhMvGHp1bA7CLznnblT9+E0nZ Q3LTwwy2zvMx0mr/paxjzITME8k0UieUFZsfKOw5sluZb56ME+V8Q+wXqnzXVGLmrIVebR VL1TZoc1+gz957FVE9TOpU3JGAes8HOjQlLGutLFzOEv/iWadniQ1Ch7Y8kAuSdxa1l1T2 LdOGUqfrr8y8vqlxJFc3BuzHfuVmOGaDX7gd2w4rubT3HS5UOBOhEVnxjytQzyHPaym/CF k7dmpuiH0AyzDSwX4PD0nVfnyfa9Wb2XQNd2tE1pYkhUuVNox++zGIdVpr5DhQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkG2L2b5Bzwqf; Sat, 25 Mar 2023 10:45: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 32PAjkXX053880; Sat, 25 Mar 2023 10:45:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PAjkZP053879; Sat, 25 Mar 2023 10:45:46 GMT (envelope-from git) Date: Sat, 25 Mar 2023 10:45:46 GMT Message-Id: <202303251045.32PAjkZP053879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 1f0c8bfd6504 - main - linsysfs(4): Keep Linux compatible sysfs the same as Ubuntu List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f0c8bfd650422a30aa6fcf01da860b8d43628a8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=1f0c8bfd650422a30aa6fcf01da860b8d43628a8 commit 1f0c8bfd650422a30aa6fcf01da860b8d43628a8 Author: Vico Chen AuthorDate: 2023-03-25 10:41:04 +0000 Commit: Dmitry Chagin CommitDate: 2023-03-25 10:41:04 +0000 linsysfs(4): Keep Linux compatible sysfs the same as Ubuntu By checking Ubuntu, there is no `/sys/subsystem' in sysfs. To compatible with Ubuntu, delete the 'subsystem' creation in Linux compatible module. On the other hand, the sysfs `/sys/subsystem' cause failure for some Linux udev cases. In Linux udev source code, there is a function named `scan_devices_all', and it will scan `/sys/subsystem' if it is existed, but now there are nothing in /sys/subsystem `, and it returns empty to cause some use cases failed. Reviewed by: dchagin Differential Revision: https://reviews.freebsd.org/D38885 MFC after: 1 month XMFC with: ifAPI --- sys/compat/linsysfs/linsysfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/compat/linsysfs/linsysfs.c b/sys/compat/linsysfs/linsysfs.c index 298ce4508b4d..23abd2c32743 100644 --- a/sys/compat/linsysfs/linsysfs.c +++ b/sys/compat/linsysfs/linsysfs.c @@ -535,9 +535,6 @@ linsysfs_init(PFS_INIT_ARGS) /* /sys/kernel/debug, mountpoint for lindebugfs. */ pfs_create_dir(kernel, "debug", NULL, NULL, NULL, 0); - /* /sys/subsystem/... */ - dir = pfs_create_dir(root, "subsystem", NULL, NULL, NULL, 0); - linsysfs_net_init(); return (0); From nobody Sat Mar 25 13:27:17 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkKck2b6rz41BKk; Sat, 25 Mar 2023 13:27: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 4PkKck1SnNz3t9t; Sat, 25 Mar 2023 13:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679750838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V1bEgiEc8KLfftCct09sSnJbp/WrIyjou0y5a2RQ3Ao=; b=E54YoG3k3uBxegn+bkkjmcGUXxRYTbMJuByLfGgsm1wQtAfSjmWh07sP8M07QmBKWtxy48 ZKzuXTOsFX7f1oTUfEM8lsiAbBZM3TGuscXGQDAOiDnHRAlnz172ke1sudq9iImBn4abTN rZn80IAR4qgndyHB5qQQfAOUGeG8MSfEEqwXEe4ym0cc0OVciMccLYimndsKUMaKkbYyQE w0WmwVnI91VJotTa+FsXOgt44aSNpepkFYHSQU0/j3E7Q6CNVEnH17bLh82qSrZwd7wu7P 0kr87SaKbecriCtrEr5XxmRgHPgTBR73nxOHD41UWIZjRptjC/uo2A7WXWLPIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679750838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V1bEgiEc8KLfftCct09sSnJbp/WrIyjou0y5a2RQ3Ao=; b=HboHAbmGPCZsvqkE+qqyWUQWCzhONWUXU5pjx+3CUO3eDmZYUt18BRoHP4ZiO0lWKKyRr/ T+tU0dGG8J3GD6mwUP4QsjUfQ0+OGbchetkLHNgwuY6j+2SNPFF9076fgIJypHhoRyhjvZ A19+QpIe+V3PqjA1rfF0zH3Y7LfPP5aadJr+ZMjjvs6KJ8TAo28OM0WgdzKXjDftW39nXr WPP8qf+z3BFIE+tLqOWHkthXm8F9DXcwdEAUH26/3qkKdC/LwPT4KE46KroGNl26s2/v0U xKL+/FzT4VeFg1M1YmRFBIMgW1dVA34OCfOE+h7ZP5zOx8XJq33r9Gs4zowSdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679750838; a=rsa-sha256; cv=none; b=Td1ti0RwVJs2+O3wIFqBZZBHk8vAvwUUXYaYQWXxZ7TiZiF19kgiqtzWd3lWKjwl9q377q quKWqYtkDH6Spy3bacA1DcF4do3k+1qYODNckEWamrDRg8pdK/Pp7hyoDP6gsZbmJ15ujX 0p+AGhkDhbmrQW2FgjuGw7z2eulf7zAZGVPGJl5Jse2k8g2cQu7M0byvhs3CXo4hvHp4OY sKVnsyZmRr8avUmNEZdGk82lsqhgEThNW9IEd966VJ+OWKpo0czwn9RNIt6VhH5Sx59KD9 M+zb/fYzTM2TkDfXUt1SoAw653GduZ3Z4Y9am7aGeLaxSbk5yFqA57Df9fmvug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkKck0Sqxz112k; Sat, 25 Mar 2023 13:27: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 32PDRHIU017135; Sat, 25 Mar 2023 13:27:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PDRHsk017134; Sat, 25 Mar 2023 13:27:17 GMT (envelope-from git) Date: Sat, 25 Mar 2023 13:27:17 GMT Message-Id: <202303251327.32PDRHsk017134@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: 978013a0945d - main - makefs: emit NM records for all directory entries List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 978013a0945d4c6b7ab3ee798dc13c74e913762a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=978013a0945d4c6b7ab3ee798dc13c74e913762a commit 978013a0945d4c6b7ab3ee798dc13c74e913762a Author: Ed Maste AuthorDate: 2023-03-24 17:53:59 +0000 Commit: Ed Maste CommitDate: 2023-03-25 13:25:18 +0000 makefs: emit NM records for all directory entries We previously attempted to emit Rock Ridge NM records only when the name represented by the Rock Ridge extensions would actually differ. We would omit the record for an all-upper-case directory name, however Linux (and perhaps other operating systems) map names with no NM record to lowercase. This affected only directories, as file names have an implicit ";1" version number appended and thus always differ. To solve, just emit NM records for all entries other than DOT and DOTDOT . We could continue to omit the NM record for directories that would avoid mapping (for example, one named 1234.567) but this does not seem worth the complexity. PR: 203531 Reported by: Thomas Schmitt TEST, - * no NM. test -> TEST, need a NM - * - * The rr_moved_dir needs to be assigned a NM record as well. - */ if (node == diskStructure->rr_moved_dir) { cd9660_rrip_add_NM(node, RRIP_DEFAULT_MOVE_DIR_NAME); - } - else if ((node->node != NULL) && - ((strlen(node->node->name) != - (uint8_t)node->isoDirRecord->name_len[0]) || - (memcmp(node->node->name,node->isoDirRecord->name, - (uint8_t)node->isoDirRecord->name_len[0]) != 0))) { + } else if (node->node != NULL) { cd9660_rrip_NM(node); } - - /* Rock ridge directory relocation code here. */ /* First handle the CL for the placeholder file. */ From nobody Sat Mar 25 13:42:32 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkKyJ4nKcz41C78; Sat, 25 Mar 2023 13:42: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 4PkKyJ4GCnz3vXn; Sat, 25 Mar 2023 13:42:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MvTGMMY0ZDEyLMayzk3g0qULXFiUtlOV40AX+Iq2N5A=; b=JNKumN/KzNvLxS7j+tgUKDWQbPfjegoGLBfofy2RT1S0WbGO3eSUjyRbUMb4R2+c5l6Hho Z+bQZPLrf89so1VOsJ9Dp0WxRlfS1FMei5pHkk5O+2RIqDFTRVglLdrXUpBoPgjHd+jcfq XPZzaeEhsDEXqXBS25DIPuw+IBMtVKC59z3xJUQ4KDf9crcACkyVQekWrRsUUJiR9Wi4+F QDguVXJLFe/Uv4zHHwT/TugBfWFiiYS0Kpf2eQo4fjqPcHBw6HqBPeIPsGR8M7JGLPOomf Lu99yRBv6d8pr6Gtm/w26mADs7DD7kC87QcznFWRR2Fv2UmFITGWu7M8564pvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MvTGMMY0ZDEyLMayzk3g0qULXFiUtlOV40AX+Iq2N5A=; b=IIe9MguB1h6Ld+LB08zgAF90VgroL6Mhio8Z2OFEQBuZWmC0W/yannc5mV37Epqpj8Psf/ tFeCtculXB3zjCTSTem22pDJ5g4aoFzSmAqbXHRHExNmjTKJv4DvH79WAlBPYvRUBNhDXi Pxa6oa2GT4gi/waxys3nrhFgWYE95XT/9Y6QGac6grnnXCmiVGa2YRN6EJUMYdhX2/MXWB /lDTrUKaT8XX0nLMNBMExbZ7frc4OZjekTzw/6hTOorPhKSAHNLdNfiRvm9b/8qTvd1exU ALjfgJHwFb3f4LCicN4jwG5WjFZ6ftia8bcIYETZ5zUxsAHRFLW77KWVOSljkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679751752; a=rsa-sha256; cv=none; b=PADdx/K/qj4qDh7MVCeLLFWMXf6snPiJ1zEHrP7xOoeaHyL5pijDxuKoVNMecEsAmvYdDO aWCJ6D9DvaXcI/yi61EWeP8SA0E4FGOUkyqb8mCfDa1CPJ9YEFAaBlfS7R97xpOtGltEhF BejkAhtEGYk/DRZKDq1cQ/YNOht46yhGROZTCZnt9bToC3mJPNYDhhiKvFdZWpn4CEhVYy 3B5kPxd9csTVTWqjvejTNOFUBuizv9ebTTLDDkdN89axGs1K19S5ceJhAbntjSA8eAuigd 8KqMk58S7bk08T+HeVrd+MjCKyd2CR2wLG2LnDvgH/j3B3JpPuMlzwDS/glmQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkKyJ3JsCz121F; Sat, 25 Mar 2023 13:42: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 32PDgWuq048535; Sat, 25 Mar 2023 13:42:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PDgWaR048534; Sat, 25 Mar 2023 13:42:32 GMT (envelope-from git) Date: Sat, 25 Mar 2023 13:42:32 GMT Message-Id: <202303251342.32PDgWaR048534@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: e5eb1d298f65 - main - vfs: replace some spelled out VNASSERTs with VNPASS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e5eb1d298f65af257618503f61947d00666c8401 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e5eb1d298f65af257618503f61947d00666c8401 commit e5eb1d298f65af257618503f61947d00666c8401 Author: Mateusz Guzik AuthorDate: 2023-03-25 13:20:02 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-25 13:42:27 +0000 vfs: replace some spelled out VNASSERTs with VNPASS nfc --- sys/kern/vfs_subr.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index d89e0ed13dd5..f8a871906e0f 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1650,8 +1650,7 @@ vtryrecycle(struct vnode *vp) struct mount *vnmp; CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - VNASSERT(vp->v_holdcnt, vp, - ("vtryrecycle: Recycling vp %p without a reference.", vp)); + VNPASS(vp->v_holdcnt > 0, vp); /* * This vnode may found and locked via some other list, if so we * can't recycle it yet. @@ -3194,14 +3193,13 @@ vdefer_inactive(struct vnode *vp) { ASSERT_VI_LOCKED(vp, __func__); - VNASSERT(vp->v_holdcnt > 0, vp, - ("%s: vnode without hold count", __func__)); + VNPASS(vp->v_holdcnt > 0, vp); if (VN_IS_DOOMED(vp)) { vdropl(vp); return; } if (vp->v_iflag & VI_DEFINACT) { - VNASSERT(vp->v_holdcnt > 1, vp, ("lost hold count")); + VNPASS(vp->v_holdcnt > 1, vp); vdropl(vp); return; } @@ -3545,8 +3543,7 @@ vdbatch_enqueue(struct vnode *vp) struct vdbatch *vd; ASSERT_VI_LOCKED(vp, __func__); - VNASSERT(!VN_IS_DOOMED(vp), vp, - ("%s: deferring requeue of a doomed vnode", __func__)); + VNPASS(!VN_IS_DOOMED(vp), vp); if (vp->v_dbatchcpu != NOCPU) { VI_UNLOCK(vp); @@ -3584,8 +3581,7 @@ vdbatch_dequeue(struct vnode *vp) int i; short cpu; - VNASSERT(vp->v_type == VBAD || vp->v_type == VNON, vp, - ("%s: called for a used vnode\n", __func__)); + VNPASS(vp->v_type == VBAD || vp->v_type == VNON, vp); cpu = vp->v_dbatchcpu; if (cpu == NOCPU) @@ -3737,8 +3733,7 @@ vinactivef(struct vnode *vp) ASSERT_VOP_ELOCKED(vp, "vinactive"); ASSERT_VI_LOCKED(vp, "vinactive"); - VNASSERT((vp->v_iflag & VI_DOINGINACT) == 0, vp, - ("vinactive: recursed on VI_DOINGINACT")); + VNPASS((vp->v_iflag & VI_DOINGINACT) == 0, vp); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); vp->v_iflag |= VI_DOINGINACT; vp->v_iflag &= ~VI_OWEINACT; @@ -3761,8 +3756,7 @@ vinactivef(struct vnode *vp) } error = VOP_INACTIVE(vp); VI_LOCK(vp); - VNASSERT(vp->v_iflag & VI_DOINGINACT, vp, - ("vinactive: lost VI_DOINGINACT")); + VNPASS(vp->v_iflag & VI_DOINGINACT, vp); vp->v_iflag &= ~VI_DOINGINACT; return (error); } @@ -4766,7 +4760,7 @@ vfs_deferred_inactive(struct vnode *vp, int lkflags) { ASSERT_VI_LOCKED(vp, __func__); - VNASSERT((vp->v_iflag & VI_DEFINACT) == 0, vp, ("VI_DEFINACT still set")); + VNPASS((vp->v_iflag & VI_DEFINACT) == 0, vp); if ((vp->v_iflag & VI_OWEINACT) == 0) { vdropl(vp); return; @@ -6376,7 +6370,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")); + VNPASS(vp->v_type == VDIR, vp); dirent = malloc(sizeof(struct dirent), M_TEMP, M_WAITOK); iov.iov_base = dirent; From nobody Sat Mar 25 13:42:33 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkKyK5w66z41C31; Sat, 25 Mar 2023 13:42: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 4PkKyK59pXz3vpn; Sat, 25 Mar 2023 13:42:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j6C+TpfSj+Bh7m4e92IHMleRfOHPSUkes/MJr6wKRZw=; b=K19hEXfLVgwFEMDxfg+OrUSxTMUThCTLGfDEO6imcCTh6s6MGybbFLnZzdMcPbdQ779kK6 /41aJRZxMOI54+hLYqUSbCuBBocFknecAjblLyyVii5JH4gZxU42/Q3K2fXSpg1F+f4Ihl OcsDIR63hnzoG5pnLcrsKKF+0pue9G+HcwfmDgLYAKOL/i8nVBNYSTznH7G1oKHJLO7YxD iSutfzqIH9ZUzWtqKq9S2IM5xhKj3NeoDS0nXdiI9z4L93nUZ5rNeRJYWSuVi3JrUhEeRJ RIVorqiAfianfe8aThrHWzvDuox7oGX5SRUy2wCKHTA99iZnFR63ZmM44Z1waw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j6C+TpfSj+Bh7m4e92IHMleRfOHPSUkes/MJr6wKRZw=; b=yyo6pEOOuMUzqBsSXVaVIhIVNw/Ai7ddnUfsCan/Nyg16PMs/lgl8em+b/ZjUX8PL1IuI9 THzqAuzjBwIqCGYsXYwG9tIlLEFnsP+RYQfGedu9mHsMwXkFesikU/Y3dvxJjLN2z4vU/7 dm0koo80dNaNNQ4W+RfRhQJLE4SKUNRU05VQN+fb89be10ziffoXyPBoe+IfrP6VazXHZW sWCj6X1rFQMdHNckJcAKcgo+TWIU3kKL652qIreeg1giXr4P6mxt6EXZcFYh1IXD7n2grJ QuHj1nfsVhN9ebuorS6j11qkHPVoY2i9TJ3xwWCEyr8DMtU9ViZNrqEHfXWZQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679751753; a=rsa-sha256; cv=none; b=iy9aTdlaTJAwHBexvGAwnkruXKaOLkunRwmjIov4QqlT0wpCnf2lBYqcJG3gbvCi3IP4GQ oOk3gZs4VjN09MDMG0y1pu7r/f4Er9aqwF/iKVNPE2grLWkzMYTIvr4sufWFpW3zbt4upG yb1N/EHJm+fplouwlgcsJWNojH8peOERwSOKs0YNDv6gjZLo+nQkz+hDeFsl1gqpBTyZgX Kg5C+smsuuiPYgZKlYDWff2IIRuwVLpzoOrBsq/w1b2awIGmgW5Gh93ScqJQhiyd8YGZGP iL1FP3RR6SwgOSGkxTSIWl8/CclFFL1G3l3psmSuPdtRX16lihGiXlqjgF2TZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkKyK4FJwz11xL; Sat, 25 Mar 2023 13:42: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 32PDgXdJ048557; Sat, 25 Mar 2023 13:42:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PDgXg9048556; Sat, 25 Mar 2023 13:42:33 GMT (envelope-from git) Date: Sat, 25 Mar 2023 13:42:33 GMT Message-Id: <202303251342.32PDgXg9048556@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: 245767c2782e - main - vfs: flip deferred_inact to atomic List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 245767c2782ef2e29340be0a6755be817f16bad4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=245767c2782ef2e29340be0a6755be817f16bad4 commit 245767c2782ef2e29340be0a6755be817f16bad4 Author: Mateusz Guzik AuthorDate: 2023-03-25 13:31:17 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-25 13:42:27 +0000 vfs: flip deferred_inact to atomic Turns out it is very rarely triggered, making a per-cpu counter a waste. Examples from real life boxes: uptime counter 135 days 847 138 days 2190 141 days 1 --- sys/kern/vfs_subr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index f8a871906e0f..72be478e310d 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -198,9 +198,9 @@ static counter_u64_t recycles_free_count; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles_free, CTLFLAG_RD, &recycles_free_count, "Number of free vnodes recycled to meet vnode cache targets"); -static counter_u64_t deferred_inact; -SYSCTL_COUNTER_U64(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, &deferred_inact, - "Number of times inactive processing was deferred"); +static u_long deferred_inact; +SYSCTL_ULONG(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, + &deferred_inact, 0, "Number of times inactive processing was deferred"); /* To keep more than one thread at a time from running vfs_getnewfsid */ static struct mtx mntid_mtx; @@ -734,7 +734,6 @@ vntblinit(void *dummy __unused) vnodes_created = counter_u64_alloc(M_WAITOK); recycles_count = counter_u64_alloc(M_WAITOK); recycles_free_count = counter_u64_alloc(M_WAITOK); - deferred_inact = counter_u64_alloc(M_WAITOK); /* * Initialize the filesystem syncer. @@ -3211,7 +3210,7 @@ vdefer_inactive(struct vnode *vp) vlazy(vp); vp->v_iflag |= VI_DEFINACT; VI_UNLOCK(vp); - counter_u64_add(deferred_inact, 1); + atomic_add_long(&deferred_inact, 1); } static void From nobody Sat Mar 25 13:42:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkKyM1125z41BxS; Sat, 25 Mar 2023 13:42: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 4PkKyL63KDz3vsZ; Sat, 25 Mar 2023 13:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCqqUbdf6Ivmn/zGLGokOXPcGQcrH5v2V4pSblFuB/4=; b=hhGl+EMjrj11PXg3c3A6XsXU+OPZLgnVxAqB6Hdt69GHa1kqZv4byHWcNFoMNau+vcfWKT sD8asRGZg+YMk/3RL0V2aCheVqmj9WX3LhzFfUdtWbpQDX+bSF0nlOYyXnDVQOBmFhKqRi jQT6NuXfB4ARkDnHwcUBPJU9Bpe28+tuut8O4zqw/Y7mHYxVW3/6RSQCSL3z5OsK/QbuYC rOfqKLQ0oJG6ZtcmwSE64g30IfokdGVqFRZwAzW1bMa0jqo8jRigzm19Zn7xIdwlMDi7bH 4mfoMvn/NnE13j/5veMU0UjdlvTHfvZjhZBLnWyPX5OLKd7bHGMnIlKTRLz65w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679751754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCqqUbdf6Ivmn/zGLGokOXPcGQcrH5v2V4pSblFuB/4=; b=F3TTp0E6zDBdwD2BgjhyI4ave+lJGXAeesFooQY4nqglizwURWAiSf0HLlZB1316ey8Yos zkuO1KJdvYD2Kcq/DI+o3uSkD1eYIii3AYMRKL8mHggmYjC+3C7t2PTwInk8V3NXlADsBX bTOITHSYdjGIfo5WS6xEcOrMdIT4bTM7830GHCwqrznnErXPaIM7PPvgg+aNd6A9cuLP8K SmXB3ZuE0/ClqiYpl6Xer66NKZ4SBxvtaVylzKt2RkChSXoDYyF9f3y0z6GsQi6EMJTFTs QJaDHb08Ys07FS/oYwhkjpnLFC3+UeiXk+VASOVZJr/fdCi4/pF25HELRbNA4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679751754; a=rsa-sha256; cv=none; b=u7Y0iSSM/3I2j/KFkWU7iS/hdv58MTfNP+2gm5GuYlGnQ+Md0OJa9GYXZfvEh/WQPr1WpB uBOydN99EH1KnVx2zwuvrYwuXok6KUcscNnoBQuE6dG5b02UHwwfmKtvUaRRBW1YEgKHdm 4NNjs56oXksBSVngQCnKSgokBt3z1N02rE6l+Za4rSD1M+1U3az8+JeAhi19eyUk49IWev SpnBmK4yoGqy6FI4UhBNwQLOHb3GlGaNB2CEN5+aTHlhFcP7jwYS5rJXW7e9mDdCVgbThP omCQ5sNNu1XmghX89DKYcfdsXjn6fwZmTLWS9XjNeno5tfHsWHyTMrzoTQC0ng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkKyL5272z11wQ; Sat, 25 Mar 2023 13:42: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 32PDgYNS048576; Sat, 25 Mar 2023 13:42:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PDgYrM048575; Sat, 25 Mar 2023 13:42:34 GMT (envelope-from git) Date: Sat, 25 Mar 2023 13:42:34 GMT Message-Id: <202303251342.32PDgYrM048575@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: 138a5dafba31 - main - vfs: trylock vnode requeue List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 138a5dafba312ff39ce0eefdbe34de95519e600d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=138a5dafba312ff39ce0eefdbe34de95519e600d commit 138a5dafba312ff39ce0eefdbe34de95519e600d Author: Mateusz Guzik AuthorDate: 2023-03-21 04:23:15 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-25 13:42:27 +0000 vfs: trylock vnode requeue The quasi-LRU still gets in the way for example when doing an incremental bzImage build, with vnode_list lock being at the top of the profile. Further damage control the problem by trylocking. Note the entire mechanism desperately wants to be reaped out in favor of something(tm) which both scales in a multicore setting and provides sensible replacement policy. With this change everything vfs almost disappears from the on CPU flamegraph, what is left is tons of contention in the VM. --- sys/kern/vfs_subr.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 72be478e310d..48aea3b6c8ff 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3521,17 +3521,25 @@ vdbatch_process(struct vdbatch *vd) MPASS(curthread->td_pinned > 0); MPASS(vd->index == VDBATCH_SIZE); - mtx_lock(&vnode_list_mtx); critical_enter(); - for (i = 0; i < VDBATCH_SIZE; i++) { - vp = vd->tab[i]; - TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); - TAILQ_INSERT_TAIL(&vnode_list, vp, v_vnodelist); - MPASS(vp->v_dbatchcpu != NOCPU); - vp->v_dbatchcpu = NOCPU; + if (mtx_trylock(&vnode_list_mtx)) { + for (i = 0; i < VDBATCH_SIZE; i++) { + vp = vd->tab[i]; + vd->tab[i] = NULL; + TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); + TAILQ_INSERT_TAIL(&vnode_list, vp, v_vnodelist); + MPASS(vp->v_dbatchcpu != NOCPU); + vp->v_dbatchcpu = NOCPU; + } + mtx_unlock(&vnode_list_mtx); + } else { + for (i = 0; i < VDBATCH_SIZE; i++) { + vp = vd->tab[i]; + vd->tab[i] = NULL; + MPASS(vp->v_dbatchcpu != NOCPU); + vp->v_dbatchcpu = NOCPU; + } } - mtx_unlock(&vnode_list_mtx); - bzero(vd->tab, sizeof(vd->tab)); vd->index = 0; critical_exit(); } From nobody Sat Mar 25 14:16:42 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkLjk3jHSz41F1v; Sat, 25 Mar 2023 14:16: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 4PkLjk3CRhz3yf2; Sat, 25 Mar 2023 14:16:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679753802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YZJXV8+8zUOKoUd75E0UbqLEHr7lD6obUFxVOPRpYQQ=; b=fq3X7mh28ymEM+SDwuk38v84fiF+bmOuEM9m6J6GmM497TI9iroKllWS5AIsb0oG6dWXKv skSHLRKG8JilbOCaIFh9LfIlQpUe/vsdq5i9I0t9y9YhcB3cdoGBeYLgATYkhbMytBsyhm mKv9f6HsLN9AwXBkSXG+oX0334M+7YKtdXGGGgaCw//voqTvAq3/by8ioiiezIoYFCzJGf A6+f14KiVpkuWgqXx0zOwOAIdcseP/bAFdnlTEj9wHR6LNqi5FZtQhpaqzzrDKlIhGSFdI eXfDXkqJ8+IigYgpB5N+Sg2LDmKawywabkGlZhzThbLQOWsQIydP89pPkB4FkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679753802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YZJXV8+8zUOKoUd75E0UbqLEHr7lD6obUFxVOPRpYQQ=; b=Bk74PYgvPxfqwmfGnUz40jHrRW2A4hSKI4V51SMNua6yX85S4hZ0HDGxpqfbEXmS5wc6Os 4BRmyN5MSTD42W8hnAh57Xf956ZfyybWWTpR4ujRLQB9XH5eQkMaArzRLjvgVl5vy+hSN/ qJSUOaEnCvTPINv29elzFTjwIgB8u2DW5Gyn2iN/9/cZkmPctqm+7/B9La++lN/8Yhb1Gk dbFUisF90Y+MIdD9dp4cXzjcQWuL12mWSfQyqSHRPSMdN1FaBbfDMsUfcDcFKHJnWikcsM 5QmzMJGjPRlhtJF8Gs4sjwutZuAnCOnMQHZyBodlk3by1imSMHxNi9b156UnTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679753802; a=rsa-sha256; cv=none; b=Mlml2V3yc6C7Q/196ldlCc2dNPzrXQyUMUiHFcmXen3eTPWCBb3Xo0pLER3hxr+89i6fK6 ytxaM7nBuJrn3Y71yz16aWF489c+RyElwmvVUvmzF6mxM2i6ZzqmAGy4z8A86yblOYV4BV 0rUezxAHJQiiKifgIRcjqaV/Lhm3fWDBDXgen6kc/NmZd7SOtnSEyfo85gN3vefMNaAvbW Yot/Uccjvc7bH56NqoRx9wVPghtAs+XoVV1HID+tdPF6rzAfojFBSW3SE+rPfeY3FsiFhO cKZ08flHCt/2+u98SNUY2VlYHJt0nRPPrqZPs6ET35uJ0JIcB265x4Fvs7OnnQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkLjk2GDWz12Vb; Sat, 25 Mar 2023 14:16: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 32PEGgd0099204; Sat, 25 Mar 2023 14:16:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PEGgtG099203; Sat, 25 Mar 2023 14:16:42 GMT (envelope-from git) Date: Sat, 25 Mar 2023 14:16:42 GMT Message-Id: <202303251416.32PEGgtG099203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 508aee968143 - main - pwd_mkdb: Sort options and update usage message. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 508aee968143cb0eaea97fba706dcd2624c052e9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=508aee968143cb0eaea97fba706dcd2624c052e9 commit 508aee968143cb0eaea97fba706dcd2624c052e9 Author: Dag-Erling Smørgrav AuthorDate: 2023-03-25 14:15:40 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-03-25 14:15:40 +0000 pwd_mkdb: Sort options and update usage message. Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D39266 --- usr.sbin/pwd_mkdb/pwd_mkdb.8 | 38 +++++++++++++++++++------------------- usr.sbin/pwd_mkdb/pwd_mkdb.c | 10 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.8 b/usr.sbin/pwd_mkdb/pwd_mkdb.8 index 0a8b0143569c..52044f5b4364 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.8 +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.8 @@ -28,7 +28,7 @@ .\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd October 20, 2018 +.Dd March 25, 2023 .Dt PWD_MKDB 8 .Os .Sh NAME @@ -65,6 +65,19 @@ The options are as follows: Check if the password file is in the correct format. Do not change, add, or remove any files. +.It Fl d Ar directory +Store databases into specified destination directory instead of +.Pa /etc . +.It Fl i +Ignore locking failure of the +.Pa master.passwd +file. +This option is intended to be used to build password files in +the release process over NFS where no contention can happen. +A non-default directory must also be specified with the +.Fl d +option for locking to be ignored. +Other use of this option is strongly discouraged. .It Fl N Tell .Nm @@ -76,24 +89,6 @@ the rebuilding of the database. .It Fl p Create a Version 7 style password file and install it into .Pa /etc/passwd . -.It Fl i -Ignore locking failure of the -.Pa master.passwd -file. -This option is intended to be used to build password files in -the release process over NFS where no contention can happen. -A non-default directory must also be specified with the -.Fl d -option for locking to be ignored. -Other use of this option is strongly discouraged. -.It Fl d Ar directory -Store databases into specified destination directory instead of -.Pa /etc . -.It Fl u Ar username -Only update the record for the specified user. -Utilities that -operate on a single user can use this option to avoid the -overhead of rebuilding the entire database. .It Fl s Ar cachesize Specify in megabytes the size of the memory cache used by the hashing library. @@ -104,6 +99,11 @@ As a rough guide, the memory usage of in megabytes will be a little bit more than twice the figure specified here. The default is 2 megabytes. +.It Fl u Ar username +Only update the record for the specified user. +Utilities that +operate on a single user can use this option to avoid the +overhead of rebuilding the entire database. .El .Pp The two databases differ in that the secure version contains the user's diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 261e7951a126..f843b7eae376 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -123,14 +123,11 @@ main(int argc, char *argv[]) makeold = 0; username = NULL; oldfp = NULL; - while ((ch = getopt(argc, argv, "CNd:ips:u:v")) != -1) + while ((ch = getopt(argc, argv, "Cd:iNps:u:v")) != -1) switch(ch) { case 'C': /* verify only */ Cflag = 1; break; - case 'N': /* do not wait for lock */ - nblock = LOCK_NB; /* will fail if locked */ - break; case 'd': dflag++; strlcpy(prefix, optarg, sizeof(prefix)); @@ -138,6 +135,9 @@ main(int argc, char *argv[]) case 'i': iflag++; break; + case 'N': /* do not wait for lock */ + nblock = LOCK_NB; /* will fail if locked */ + break; case 'p': /* create V7 "file.orig" */ makeold = 1; break; @@ -675,6 +675,6 @@ usage(void) { (void)fprintf(stderr, -"usage: pwd_mkdb [-BCiLNp] [-d directory] [-s cachesize] [-u username] file\n"); +"usage: pwd_mkdb [-CiNp] [-d directory] [-s cachesize] [-u username] file\n"); exit(1); } From nobody Sat Mar 25 16:05:03 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkP6l525Lz41MhJ; Sat, 25 Mar 2023 16:05: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 4PkP6l4YYlz4DGq; Sat, 25 Mar 2023 16:05:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679760303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PUffXG+B3vEP1gPpx0tgr1v2NCvdtdQ06RxgYufuuyc=; b=GJ85LRjFO+yp5IR/6qY503IN+KmhDRoDCgwe/56Qi83GGhVrfe3OUEyp3UVShu/ghD+8e1 MuydbDhB1vs3UZzi8QIjTegWsS3CheevVzq7E0VVPDGcQ7+Cxd+yjrogv9Z1SH2jFJNKoW XbCQPerQWS0E4dMog7q6eYV/GPmNeuiitmkhLeNETh26AAmbpfxrpuwjCW81z24y2vAWT+ tMBr7JnvWnxuNmBVQhXw2+yWm88zoKBhYwy+z6g0Gs+Z6hbJkDcsRoVWwYnfx5mCc5Sz1p F/3lBnmiSSQ198gYKmbYrM4JDhbrd25JQw8e1l/yNBCxnXjonl6Lfnj4PsAoFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679760303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PUffXG+B3vEP1gPpx0tgr1v2NCvdtdQ06RxgYufuuyc=; b=lWXGj7v2fnbGN871C1LGMcwsauHGSSXMB7Fiyrje6Uz9hh5ezlnWzxUf6xl0jNd8hZHGSt shdi1R7zPUhQwHhkYtvUm11ro02d+kBmnMQwh1Wc0DJ0PD305NV+mJd5rS2clqBImGYQVQ 48JbczqzSFhdsMt7id8Kiz80fv43klBOmc9GIPgZkBIbKt6ja83z8a6dbeLiwkMwc4VODA edvuWf5YrmBHJMIEDrlikh76FCJ+SdkWnLnONk7g9Cs4DK7TKQlyd9e6L53E97iluCsOQJ JHbH+N8jM29JU6+r6oJHh8TYAFFk+7MQANpY9hLzLdGsI4zG+r6qm2U0/YvI/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679760303; a=rsa-sha256; cv=none; b=mkql6YKhftBtBQ20MqdqdEIDovVQBoIa0Hds1G9mTVptDylJFotarcoKSyKsdicV5bQv1A yhtTzAn94O6qFqKhHifWPqxPza+b4qY7LFIrLnd/ovVTG+wVdFrV75UMYeCgiAMr0KNrpl PRSr1dxbUf+liiYEIh//g6mPz22Hb9T4epd8Tpjv12/HXaooJoND44R67GRGkZ7iko9qqI cMHTAGeuils1ERfvyzsje+aN/jUhebaJE1SVluI6luCwQx3y00lJK42Jrm0fnme9gFBy4f GTKllta+NyIrt4m5TExllxJQECO+VoMFrE7/I3Nz45DiqhtFMFJ1GmBLzkFgmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkP6l3bHvz15Fd; Sat, 25 Mar 2023 16:05: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 32PG53H3079702; Sat, 25 Mar 2023 16:05:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PG53Gj079701; Sat, 25 Mar 2023 16:05:03 GMT (envelope-from git) Date: Sat, 25 Mar 2023 16:05:03 GMT Message-Id: <202303251605.32PG53Gj079701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: abba58766fdd - main - LRO: Add missing checks for invalid IP addresses List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abba58766fdd7f9720761aba39c2b9653eb4fbd3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=abba58766fdd7f9720761aba39c2b9653eb4fbd3 commit abba58766fdd7f9720761aba39c2b9653eb4fbd3 Author: Andrew Gallatin AuthorDate: 2023-03-25 15:51:51 +0000 Commit: Andrew Gallatin CommitDate: 2023-03-25 15:56:02 +0000 LRO: Add missing checks for invalid IP addresses LRO bypasses normal ip_input()/tcp_input() and lacks several checks that are present in the normal path. Without these checks, it is possible to trigger assertions added in b0ccf53f2455 Reviewed by: glebius, rrs Sponsored by: Netflix --- sys/netinet/tcp_lro.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index bde8fadbc05b..908f9cdd7ea4 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -292,6 +292,10 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, /* .. and the packet is not fragmented. */ if (parser->ip4->ip_off & htons(IP_MF|IP_OFFMASK)) break; + /* .. and the packet has valid src/dst addrs */ + if (__predict_false(parser->ip4->ip_src.s_addr == INADDR_ANY || + parser->ip4->ip_dst.s_addr == INADDR_ANY)) + break; ptr = (uint8_t *)ptr + (parser->ip4->ip_hl << 2); mlen -= sizeof(struct ip); if (update_data) { @@ -339,6 +343,10 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, parser->ip6 = ptr; if (__predict_false(mlen < sizeof(struct ip6_hdr))) return (NULL); + /* Ensure the packet has valid src/dst addrs */ + if (__predict_false(IN6_IS_ADDR_UNSPECIFIED(&parser->ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&parser->ip6->ip6_dst))) + return (NULL); ptr = (uint8_t *)ptr + sizeof(*parser->ip6); if (update_data) { parser->data.s_addr.v6 = parser->ip6->ip6_src; From nobody Sat Mar 25 16:22:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkPVf4Qqbz41NkZ; Sat, 25 Mar 2023 16:22: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 4PkPVf3z9zz4F7s; Sat, 25 Mar 2023 16:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679761338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qqrc+AJmdjNl82RkQnTCR/pI6SZ/+40QlydocnbnPdQ=; b=TjI6JXnKAD9jEDV2qpDgLpUg6T2c+6TUQydPF9ZNo8JbP/6rCDNvlsWos+A483p8IaWA4l eTwbb0PoNfbzbck8Bd491qylZN+yR6JsDvy+Rc9X2sVhWWg0e7XKenKO186QMc1xoHqNzA 0m2LWGLID4ICXPLKJ1SnlxLGobZNt/EaYTvhNugxeHvjNbiRquGn2ApKB+i8azAjZU/OAE Ss3XL6bhKAFqPd/8J9GO3uZ1em6gqWS4qvyMSosuoSkoJ5cUW0VKkITAUxkuWYqyLG+yL/ ajxAyjrMADx4opRx5fly+BwnyyRUS1ROjgiKI3Guq65wN3BCnO4hQvlKbQ0/NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679761338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qqrc+AJmdjNl82RkQnTCR/pI6SZ/+40QlydocnbnPdQ=; b=aXNhFFQWv0UnMwxmxMPiDpAkAt/AsV4xR8FaSlipoxuCux1tEXwsKu8GVWTGI+j/pUbwxk 7tyxhURVh2KZnNliUXxuIjtuqapZHXZXXAeluxvlcQqWbOD3vNbpqjkCpPojLlBsFiDZ15 jvP+u+3VE4G47Z9tP45acUCWiccDcAf+PlMjpPoA2g1uVFcDsII2eyA6/a46TjKkE//xbX PqDWivyssbYZFI3WbwoYipbTR3QuMrIBP5WfG4VIvEaUNuigHE56d/VIocyp4UbAqOWp4F utQc9lOJOkYmp2t+S0f2dG60KgQ8iZXJhe5e55S0YAxII4nPMbciWkyk/BDk1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679761338; a=rsa-sha256; cv=none; b=YrEi+Z/U1sfMVnKUfra8dV3bFO59l+PE4H9VsyFXIaeMt4/83bAJe4J9A1de9NpGsVUR+b M8E/yhWUM93AtRYruJYR9ZUqY6auFVVquEvjlo80Sgd5jjONTCgkGXvigPFXHK6mlF/hHB QQ5bGkUAy/jlK9XW74iSDp1b3xF1zYdDaBlL/W5kUkPFsSaHeuDOpJld0KxRbaowJch0Aa sncr8rciigGcHGmfjjdR1Xl4qmAhakrnySKikfDsjNoj1jp5XcBB5+XqttOSqAj6XrfE3J VtiuGft1it2Q0/q+qJp7MRmEEKxQMZPmVWEtx+0bv+53zXK6nhmDWSxFNQ1HAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkPVf32ZWz15S4; Sat, 25 Mar 2023 16:22: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 32PGMIY9011621; Sat, 25 Mar 2023 16:22:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PGMI0M011620; Sat, 25 Mar 2023 16:22:18 GMT (envelope-from git) Date: Sat, 25 Mar 2023 16:22:18 GMT Message-Id: <202303251622.32PGMI0M011620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Koshy Subject: git: 609312077684 - main - procfs: Add manual page cross references. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkoshy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60931207768437c46cbc80df1b6901f8246dc57b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jkoshy: URL: https://cgit.FreeBSD.org/src/commit/?id=60931207768437c46cbc80df1b6901f8246dc57b commit 60931207768437c46cbc80df1b6901f8246dc57b Author: Joseph Koshy AuthorDate: 2023-03-25 06:44:03 +0000 Commit: Joseph Koshy CommitDate: 2023-03-25 16:21:34 +0000 procfs: Add manual page cross references. Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D39264 --- share/man/man5/procfs.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man5/procfs.5 b/share/man/man5/procfs.5 index 37da9cf82e4b..9e1d12cf3324 100644 --- a/share/man/man5/procfs.5 +++ b/share/man/man5/procfs.5 @@ -2,7 +2,7 @@ .\" Written by Garrett Wollman .\" This file is in the public domain. .\" -.Dd October 17, 2021 +.Dd March 25, 2023 .Dt PROCFS 5 .Os .Sh NAME @@ -205,6 +205,8 @@ file system on .Xr mount 2 , .Xr sigaction 2 , .Xr unmount 2 , +.Xr kvm 3 , +.Xr libprocstat 3 , .Xr pseudofs 9 .Sh AUTHORS .An -nosplit From nobody Sat Mar 25 17:08:09 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkQWY70K5z41S1y; Sat, 25 Mar 2023 17:08: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 4PkQWY6XDjz4JKX; Sat, 25 Mar 2023 17:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J6FsDInkIU0lGs37yUqHHwOEMTytCR2ZD9IBl1KFQ+0=; b=SnzSZupOax5a5yBKGtROMwTk2/0N5lsfouaLuDynYsNsGyOdF5uFSvhwD6NDJJ8RTe3OhU 7isLs1/zUNme97Tz70yN86zyF+08fe2GdU+G0zDVqw482n/Na9xi1pyUZyue64LW0QYeYl hFl8Vb2zAGoinNcIWoAy8VdYx+gfze2PQmvj1XDbLtD2h6Cjct8S6E92dEjYO5Vtp9HpMx JRwqj2jytG/22EeA1Jxdt217ZfXE3ddKpu4x9WjhwXjq59Pfkjr9VcULw9YUXaY8fsRAoE +My/ikWN2GEDJcmtE6Cd4icML4F8FtmKZScZvvR39v3bDDFoLVzpfFjQClQuYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J6FsDInkIU0lGs37yUqHHwOEMTytCR2ZD9IBl1KFQ+0=; b=IjzoKufVIolNcTTRRk74Iue8WpbF2U+T2d1UIHHqkmkGr0sCrOtTol9GvXhADg4N1uSfL1 SFjUTFLFT0za9W3zS5+H4py1/0k2DemiLrf0AeXgrX+zYbknVmNCi96v//a/jI0YWaLEga EG0UaidaaYQdsPdxVjgcVFTTdqKVMclRdjSTFGBiqnuOlPaibkvCuk+V3Qwxe0ZdeQeSiH swoRRRQcoonwcgtzZh6MitOjyhECDWBKlnsxGgK9IJG7Eg2AkDTblnOhwbuePx5cuHoCdW QHCYlx48bOjxP/zF9jvhX1BDUNP/1q7wowncQ83DRdeNFJKOH0oECGauxpG7eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679764089; a=rsa-sha256; cv=none; b=jQGLj0jX+MCtqonGTFGGVOp2gA0NyZvn5skfHOLbNvIBzNpiISM/RR7Vus32Z0PzbavOpz ibonleR8jK2EeOj90kd2kSkauD8QtJB1QvzgmrnUZl2J8XIhwsgaSiB6GlxLd96bISWplt VVcl99XEmKEwKEyfMhlmPLFxm1XeF/b1k3UY0M3B727D+avv7fGj5yTTemTS+CDtFCHpuJ tTDx0MdOIlIIz8TY4Nj06EJ9slYqkfRi/nDXo0b6dUP0P5N96Ph/WE/3/YC5ob9ULNyDNE lAMal2EKeMqPhr+PCEH3sKTgBmBZbnQQKW4Q6WXIaIJZ1IeBqVnIJtnPwlh59Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkQWY5bZRz16jn; Sat, 25 Mar 2023 17: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 32PH89xb079139; Sat, 25 Mar 2023 17: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 32PH89cP079138; Sat, 25 Mar 2023 17:08:09 GMT (envelope-from git) Date: Sat, 25 Mar 2023 17:08:09 GMT Message-Id: <202303251708.32PH89cP079138@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: 72f501d07a02 - main - secure_getenv: Add () around return values List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72f501d07a02028a51c15614f7ac4482ce8345bd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=72f501d07a02028a51c15614f7ac4482ce8345bd commit 72f501d07a02028a51c15614f7ac4482ce8345bd Author: Warner Losh AuthorDate: 2023-03-14 15:25:04 +0000 Commit: Warner Losh CommitDate: 2023-03-25 17:06:13 +0000 secure_getenv: Add () around return values Style only change, no functional change intended. Sponsored by: Netflix --- lib/libc/stdlib/getenv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 86a846d58c69..001b9669bda9 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -455,8 +455,8 @@ char * secure_getenv(const char *name) { if (issetugid()) - return NULL; - return getenv(name); + return (NULL); + return (getenv(name)); } /* From nobody Sat Mar 25 17:08:10 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkQWb3n8Tz41S45; Sat, 25 Mar 2023 17: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 4PkQWb0bTHz4JJ0; Sat, 25 Mar 2023 17:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OzhJFfeP0m8vPIlbrmUisfJUZQUfHVLylrb1vi5rUuw=; b=VBIYto5BkvxVBGFneJ+JbWO1JcrC375XihFbi6b1LiO+srhc2BnKIAkZJm/bGub5QKHPsA 0pNokMNutIVV47Rvb8/RP6UwYfBiU2/wQ5cBxpTzPFi3zzrNUsjV7rZa7pMNgEmFcv+n6I LKKzUMVr22OlbA9fa53QYjrYkz9D+ipLQ/ofxcPwWZ52lpwMlQ3HNKbwN6g4vNx8oGCHfu MZHbUfn2dhXryoMkSAKMUyeu43TaYS6NxOB8PLDL+ZGnF1e70SWCKyGDFMDGx9CHpo7Ce2 r7xdS+2Z8+1alzlyTcwTTQ+peh58gmAhYqaXAaf9tl390mQb4fL3kPHN4NBJCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OzhJFfeP0m8vPIlbrmUisfJUZQUfHVLylrb1vi5rUuw=; b=OxICWBnC12cdHpUQvlYXj5b2ur+MHoghlgzLSeT3QPpXeLNjb5QXJ3RxF7sf/AmbVSNqSE 2ZoLavkIlqEVCqr85JH3xMd0PuYrvjS9V+eENZctN4J1HjqdKPFRgfGTo+zjJ6BBrJJrAx PAQb0JJ0w8+gP1WmhOL9jtxaPsjqiGXjnTZAQ1McFLYs62Mvk1VYYmsVcysXa9EftQAShg mnXLksVbxRMz0mmpo1qM+0FYaV3cMemhYMZRVXbLUuO4aKVegqtFfRkmYkWqig1gL6rCO8 DMQesGK/Eby0w/eyKdX7/NM0a62crHRWsGk8hl8NYO3n9MN1Lk0hLuxXSWlVgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679764091; a=rsa-sha256; cv=none; b=UnOXY+LuUX5EKZe1nfmuTNjmgjn7rmYeeHciokgTyBNFAVI2V9k0spDN8hpBuwuc1uzHb9 66VozIEoun2mo+AJBj3WZxYaqEn0ajUlfOh9Ktv1TA3U0hMjdpB6Ly/pbe+FoSoLP1Mxrk 0UPwzGLM9SWrSzYYIR7dDUstdX31p03LK5C5iN7Yfd2wtu75yq0C4LSmJaH7rexw4b5OUO rmRRPlmKqEVUm2ilOEKPuJergrQCmzKivnFULsAAP6DO8NrOImo10MAfQKlS4HOWsyEYfu t/+/YHCiHRBN9ktoBKrqPzHSYD/xV/rg6vkwdg44Qx7lyDL2SaQIaL/iRq5/Vw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkQWZ6lWCz16Fp; Sat, 25 Mar 2023 17:08: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 32PH8AtL079159; Sat, 25 Mar 2023 17: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 32PH8AUp079158; Sat, 25 Mar 2023 17:08:10 GMT (envelope-from git) Date: Sat, 25 Mar 2023 17:08:10 GMT Message-Id: <202303251708.32PH8AUp079158@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: d5df26858420 - main - secure_getenv: Improve documentation wording List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5df268584209c448d2e3f344b8b15c944e48b82 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d5df268584209c448d2e3f344b8b15c944e48b82 commit d5df268584209c448d2e3f344b8b15c944e48b82 Author: Warner Losh AuthorDate: 2023-03-14 17:02:07 +0000 Commit: Warner Losh CommitDate: 2023-03-25 17:06:13 +0000 secure_getenv: Improve documentation wording Improve the documentation wording to be more consistent with FreeBSD manual pages. Suggested by: mjg (though reworded) Sponsored by: Netflix --- lib/libc/stdlib/getenv.3 | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3 index 93c0d2ada6ad..46736635da47 100644 --- a/lib/libc/stdlib/getenv.3 +++ b/lib/libc/stdlib/getenv.3 @@ -32,7 +32,7 @@ .\" @(#)getenv.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd March 13, 2023 +.Dd March 14, 2023 .Dt GETENV 3 .Os .Sh NAME @@ -81,19 +81,16 @@ to by the .Fn getenv function. .Pp -The GNU-specific function, -.Fn secure_getenv -wraps the -.Fn getenv -function to prevent it from being run in "secure execution". -Unlike in glibc, +The .Fn secure_getenv -only checks if the -.Fa setuid -and -.Fa setgid -bits have been set or changed. -These checks are subject to extension and change. +returns +.Va NULL +when the environment cannot be trusted, otherwise it acts like +.Fn getenv . +The environment currently is not trusted when +.Xr issetugid 3 +returns a non-zero value, but other conditions may be added +in the future. .Pp The .Fn setenv @@ -222,6 +219,9 @@ and .Fn unsetenv functions conforms to .St -p1003.1-2001 . +The +.Fn secure_getenv +function is expected to be glibc-compatible. .Sh HISTORY The functions .Fn setenv @@ -249,7 +249,9 @@ specification. .Pp The .Fn clearenv -was added in +and +.Fn secure_getenv +functions were added in .Fx 14 . .Sh BUGS Successive calls to From nobody Sat Mar 25 17:08:11 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkQWc1j8bz41Rw8; Sat, 25 Mar 2023 17: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 4PkQWc1FJMz4Jby; Sat, 25 Mar 2023 17:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CO6BLp1OXSgqNXluI4qm1EWGW/Eo1pQqoMfrBC39fh4=; b=nq26AbRGdMpYghiB9V27lQMFFf2jZpIpu+A33IaWvdQKsS5ng/2OyHHrkYv+IFIxcCHFzj GqLpMsLSD1xc0MKJemQJHZn0FOWOT6n2L6+Q/fYoxKpcjCgpmrUtsxDna7+lDsjW7zR8Lp MGGxXufSc4lGS871dmcyhEpKaM1cTAw96Yqbhxx8MtAqFzMYlFmOf2W3i8I+Zu7mWZWbbT QEuAUVbpMEXzDZL6Ut4Ey/P6y3EwjoDYURzOHRJJjd+WbJzVdL/B1CChGrFQtzhw+Yn3wb k7r3euFtAe81dNcVKm34AhUPR72bLUXovKd2iZ/BcE2KU07cj2LIXHq4eAa6aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CO6BLp1OXSgqNXluI4qm1EWGW/Eo1pQqoMfrBC39fh4=; b=K131asJ6QLVqSomBb4XEZUERX+rsjdOcV2YfgR5R7vVpwbZ2A/nDSayDex/yzdAu14WWbd V2RkoVF66fRNYX8fdTAKmrGsQyi4WmzsYYnbzZ0ujx7z3tYQHmxW5TgsrECoySxkSvn8E+ GbS7VRe8CqMQ4hDFJusoJw9xP/GzWGW/g2D6vBQhRimzSEGGrsVtKXUC2BZbN7VeaXl0nU 6as2PIyghzTsypVjoNcBzDITVcenbAjldBPMGZMzLOmUnFejEiHBYpMOz66OPNRMmuiWLa T0CnsB+QDLoMWVE4JvntZC1lDy/AOKYpwboQbjTAkZjYo4l7UKPUK/IvvOIN5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679764092; a=rsa-sha256; cv=none; b=KkJUeqcOVHKl4Hzxce9yAg4eWcd5JboCJePLMV6O7xQt7i6dei18EJEvbMh//rR3yfslth 58Hj4hETwFui7fe8vrHdJN8xzL0Q+reRRjnxCviEV8MdYBfcBIYUAvDwW+k0IckSGdnOXc UrVOLzjiBRIui91gpXMfVZTv1FJcbj5rYm9aMdV8EJSXOUCLWZ12eYW9OKVWvCBjXmdNv5 pj65UjyqvcEtfSe9a2/Bi2NuBfH1nppaXzR2zvEz2DqQeaJRD50umzPtLJL+F/Elbsp3RO gJvs28r0ar18Memv/ML+IZSVC23Phya5HUSz3ATCYG4PxKYh47SitFFWDXa9vQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkQWc0BQKz16RQ; Sat, 25 Mar 2023 17: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 32PH8CDr079178; Sat, 25 Mar 2023 17: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 32PH8BUq079177; Sat, 25 Mar 2023 17:08:11 GMT (envelope-from git) Date: Sat, 25 Mar 2023 17:08:11 GMT Message-Id: <202303251708.32PH8BUq079177@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: 3a3c9242739e - main - checkstyle9.pl: Perl script to check if a change is approximately style(9) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 commit 3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 Author: Warner Losh AuthorDate: 2023-03-14 21:28:05 +0000 Commit: Warner Losh CommitDate: 2023-03-25 17:06:13 +0000 checkstyle9.pl: Perl script to check if a change is approximately style(9) This code is adapted from the QEMU checkpatch.pl script. It can check either a patch, a file or a git branch. It tries to warn about things that I believe might be style(9) violations. It's experimental, since I heavily hacked on the qemu version to get it to not complain (much) about iconic code in the tree. At the moment, it's use should be considered expermental. It will likely miss violations, and complain about code that's perfectly fine. It's offered as an experiment and to make it easier for contributors to submit patches. --- tools/build/checkstyle9.pl | 2748 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2748 insertions(+) diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl new file mode 100755 index 000000000000..5aec3819bf7c --- /dev/null +++ b/tools/build/checkstyle9.pl @@ -0,0 +1,2748 @@ +#!/usr/bin/env perl +# (c) 2001, Dave Jones. (the file handling bit) +# (c) 2005, Joel Schopp (the ugly bit) +# (c) 2007,2008, Andy Whitcroft (new conditions, test suite) +# (c) 2008-2010 Andy Whitcroft +# Licensed under the terms of the GNU GPL License version 2 + +use strict; +use warnings; +use Term::ANSIColor qw(:constants); + +my $P = $0; +$P =~ s@.*/@@g; + +our $SrcFile = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$}; + +my $V = '0.31'; + +use Getopt::Long qw(:config no_auto_abbrev); + +my $quiet = 0; +my $tree = 1; +my $chk_signoff = 1; +my $chk_patch = undef; +my $chk_branch = undef; +my $tst_only; +my $emacs = 0; +my $terse = 0; +my $file = undef; +my $color = "auto"; +my $no_warnings = 0; +my $summary = 1; +my $mailback = 0; +my $summary_file = 0; +my $root; +my %debug; +my $help = 0; + +sub help { + my ($exitcode) = @_; + + print << "EOM"; +Usage: + + $P [OPTION]... [FILE]... + $P [OPTION]... [GIT-REV-LIST] + +Version: $V + +Options: + -q, --quiet quiet + --patch treat FILE as patchfile + --branch treat args as GIT revision list + --emacs emacs compile window format + --terse one line per report + -f, --file treat FILE as regular source file + --strict fail if only warnings are found + --no-summary suppress the per-file summary + --mailback only produce a report in case of warnings/errors + --summary-file include the filename in summary + --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of + 'values', 'possible', 'type', and 'attr' (default + is all off) + --test-only=WORD report only warnings/errors containing WORD + literally + --color[=WHEN] Use colors 'always', 'never', or only when output + is a terminal ('auto'). Default is 'auto'. + -h, --help, --version display this help and exit + +When FILE is - read standard input. +EOM + + exit($exitcode); +} + +# Use at your own risk +print "\n", MAGENTA, "WARNING:", RESET, " This code is highly experimental ... likely isn't a great style(9) match yet\n\n"; + +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + +GetOptions( + 'q|quiet+' => \$quiet, + 'tree!' => \$tree, + 'signoff!' => \$chk_signoff, + 'patch!' => \$chk_patch, + 'branch!' => \$chk_branch, + 'emacs!' => \$emacs, + 'terse!' => \$terse, + 'f|file!' => \$file, + 'strict!' => \$no_warnings, + 'root=s' => \$root, + 'summary!' => \$summary, + 'mailback!' => \$mailback, + 'summary-file!' => \$summary_file, + + 'debug=s' => \%debug, + 'test-only=s' => \$tst_only, + 'color=s' => \$color, + 'no-color' => sub { $color = 'never'; }, + 'h|help' => \$help, + 'version' => \$help +) or help(1); + +help(0) if ($help); + +my $exit = 0; + +if ($#ARGV < 0) { + print "$P: no input files\n"; + exit(1); +} + +if (!defined $chk_branch && !defined $chk_patch && !defined $file) { + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; + $file = $ARGV[0] =~ /$SrcFile/ ? 1 : 0; + $chk_patch = $chk_branch || $file ? 0 : 1; +} elsif (!defined $chk_branch && !defined $chk_patch) { + if ($file) { + $chk_branch = $chk_patch = 0; + } else { + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; + $chk_patch = $chk_branch ? 0 : 1; + } +} elsif (!defined $chk_branch && !defined $file) { + if ($chk_patch) { + $chk_branch = $file = 0; + } else { + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; + $file = $chk_branch ? 0 : 1; + } +} elsif (!defined $chk_patch && !defined $file) { + if ($chk_branch) { + $chk_patch = $file = 0; + } else { + $file = $ARGV[0] =~ /$SrcFile/ ? 1 : 0; + $chk_patch = $file ? 0 : 1; + } +} elsif (!defined $chk_branch) { + $chk_branch = $chk_patch || $file ? 0 : 1; +} elsif (!defined $chk_patch) { + $chk_patch = $chk_branch || $file ? 0 : 1; +} elsif (!defined $file) { + $file = $chk_patch || $chk_branch ? 0 : 1; +} + +if (($chk_patch && $chk_branch) || + ($chk_patch && $file) || + ($chk_branch && $file)) { + die "Only one of --file, --branch, --patch is permitted\n"; +} +if (!$chk_patch && !$chk_branch && !$file) { + die "One of --file, --branch, --patch is required\n"; +} + +if ($color =~ /^always$/i) { + $color = 1; +} elsif ($color =~ /^never$/i) { + $color = 0; +} elsif ($color =~ /^auto$/i) { + $color = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + +my $dbg_values = 0; +my $dbg_possible = 0; +my $dbg_type = 0; +my $dbg_attr = 0; +my $dbg_adv_dcs = 0; +my $dbg_adv_checking = 0; +my $dbg_adv_apw = 0; +for my $key (keys %debug) { + ## no critic + eval "\${dbg_$key} = '$debug{$key}';"; + die "$@" if ($@); +} + +my $rpt_cleaners = 0; + +if ($terse) { + $emacs = 1; + $quiet++; +} + +my $emitted_corrupt = 0; + +our $Ident = qr{ + [A-Za-z_][A-Za-z\d_]* + (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* + }x; +our $Storage = qr{extern|static|asmlinkage}; +our $Sparse = qr{ + __force + }x; + +# Notes to $Attribute: +our $Attribute = qr{ + const| + volatile| + QEMU_NORETURN| + QEMU_WARN_UNUSED_RESULT| + QEMU_SENTINEL| + QEMU_PACKED| + GCC_FMT_ATTR + }x; +our $Modifier; +our $Inline = qr{inline}; +our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; +our $Lval = qr{$Ident(?:$Member)*}; + +our $Constant = qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*}; +our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; +our $Compare = qr{<=|>=|==|!=|<|>}; +our $Operators = qr{ + <=|>=|==|!=| + =>|->|<<|>>|<|>|!|~| + &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|% + }x; + +our $NonptrType; +our $Type; +our $Declare; + +our $NON_ASCII_UTF8 = qr{ + [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte + | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs + | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte + | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates + | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 + | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 + | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 +}x; + +our $UTF8 = qr{ + [\x09\x0A\x0D\x20-\x7E] # ASCII + | $NON_ASCII_UTF8 +}x; + +# some readers default to ISO-8859-1 when showing email source. detect +# when UTF-8 is incorrectly interpreted as ISO-8859-1 and reencoded back. +# False positives are possible but very unlikely. +our $UTF8_MOJIBAKE = qr{ + \xC3[\x82-\x9F] \xC2[\x80-\xBF] # c2-df 80-bf + | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF] # e0 a0-bf 80-bf + | \xC3[\xA1-\xAC\xAE\xAF] (?: \xC2[\x80-\xBF]){2} # e1-ec/ee/ef 80-bf 80-bf + | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF] # ed 80-9f 80-bf + | \xC3\xB0 \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-bf + | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3} # f1-f3 80-bf 80-bf 80-bf + | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf 80-bf +}x; + +# There are still some false positives, but this catches most +# common cases. +our $typeTypedefs = qr{(?x: + (?![KMGTPE]iB) # IEC binary prefix (do not match) + [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]* # camelcase + | [A-Z][A-Z\d_]*AIOCB # all uppercase + | [A-Z][A-Z\d_]*CPU # all uppercase + | QEMUBH # all uppercase +)}; + +our @typeList = ( + qr{void}, + qr{(?:unsigned\s+)?char}, + qr{(?:unsigned\s+)?short}, + qr{(?:unsigned\s+)?int}, + qr{(?:unsigned\s+)?long}, + qr{(?:unsigned\s+)?long\s+int}, + qr{(?:unsigned\s+)?long\s+long}, + qr{(?:unsigned\s+)?long\s+long\s+int}, + qr{unsigned}, + qr{float}, + qr{double}, + qr{bool}, + qr{struct\s+$Ident}, + qr{union\s+$Ident}, + qr{enum\s+$Ident}, + qr{${Ident}_t}, + qr{${Ident}_handler}, + qr{${Ident}_handler_fn}, + qr{target_(?:u)?long}, + qr{hwaddr}, +); + +# This can be modified by sub possible. Since it can be empty, be careful +# about regexes that always match, because they can cause infinite loops. +our @modifierList = ( +); + +sub build_types { + my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; + if (@modifierList > 0) { + my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; + $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; + } else { + $Modifier = qr{(?:$Attribute|$Sparse)}; + } + $NonptrType = qr{ + (?:$Modifier\s+|const\s+)* + (?: + (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| + (?:$typeTypedefs\b)| + (?:${all}\b) + ) + (?:\s+$Modifier|\s+const)* + }x; + $Type = qr{ + $NonptrType + (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? + (?:\s+$Inline|\s+$Modifier)* + }x; + $Declare = qr{(?:$Storage\s+)?$Type}; +} +build_types(); + +$chk_signoff = 0 if ($file); + +my @rawlines = (); +my @lines = (); +my $vname; +if ($chk_branch) { + my @patches; + my %git_commits = (); + my $HASH; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n"; + + for my $line (<$HASH>) { + $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 = $1; + my $subject = $2; + push(@patches, $sha1); + $git_commits{$sha1} = $subject; + } + + close $HASH; + + die "$P: no revisions returned for revlist '$ARGV[0]'\n" + unless @patches; + + my $i = 1; + my $num_patches = @patches; + for my $hash (@patches) { + my $FILE; + open($FILE, '-|', "git", "show", "--patch-with-stat", $hash) || + die "$P: git show $hash - $!\n"; + while (<$FILE>) { + chomp; + push(@rawlines, $_); + } + close($FILE); + $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet == 0) { + my $prefix = "$i/$num_patches"; + $prefix = BLUE . BOLD . $prefix . RESET if $color; + print "$prefix Checking commit $vname\n"; + $vname = "Patch $i/$num_patches"; + } else { + $vname = "Commit " . $vname; + } + if (!process($hash)) { + $exit = 1; + print "\n" if ($num_patches > 1 && $quiet == 0); + } + @rawlines = (); + @lines = (); + $i++; + } +} else { + for my $filename (@ARGV) { + my $FILE; + if ($file) { + open($FILE, '-|', "diff -u /dev/null $filename") || + die "$P: $filename: diff failed - $!\n"; + } elsif ($filename eq '-') { + open($FILE, '<&STDIN'); + } else { + open($FILE, '<', "$filename") || + die "$P: $filename: open failed - $!\n"; + } + if ($filename eq '-') { + $vname = 'Your patch'; + } else { + $vname = $filename; + } + print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0; + while (<$FILE>) { + chomp; + push(@rawlines, $_); + } + close($FILE); + if (!process($filename)) { + $exit = 1; + } + @rawlines = (); + @lines = (); + } +} + +exit($exit); + +sub top_of_kernel_tree { + my ($root) = @_; + + my @tree_check = ( + "Makefile.inc1", "README.md", "sys", + "usr.sbin" + ); + + foreach my $check (@tree_check) { + if (! -e $root . '/' . $check) { + return 0; + } + } + return 1; +} + +sub expand_tabs { + my ($str) = @_; + + my $res = ''; + my $n = 0; + for my $c (split(//, $str)) { + if ($c eq "\t") { + $res .= ' '; + $n++; + for (; ($n % 8) != 0; $n++) { + $res .= ' '; + } + next; + } + $res .= $c; + $n++; + } + + return $res; +} +sub copy_spacing { + (my $res = shift) =~ tr/\t/ /c; + return $res; +} + +sub line_stats { + my ($line) = @_; + + # Drop the diff line leader and expand tabs + $line =~ s/^.//; + $line = expand_tabs($line); + + # Pick the indent from the front of the line. + my ($white) = ($line =~ /^(\s*)/); + + return (length($line), length($white)); +} + +my $sanitise_quote = ''; + +sub sanitise_line_reset { + my ($in_comment) = @_; + + if ($in_comment) { + $sanitise_quote = '*/'; + } else { + $sanitise_quote = ''; + } +} +sub sanitise_line { + my ($line) = @_; + + my $res = ''; + my $l = ''; + + my $qlen = 0; + my $off = 0; + my $c; + + # Always copy over the diff marker. + $res = substr($line, 0, 1); + + for ($off = 1; $off < length($line); $off++) { + $c = substr($line, $off, 1); + + # Comments we are wacking completely including the begin + # and end, all to $;. + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') { + $sanitise_quote = '*/'; + + substr($res, $off, 2, "$;$;"); + $off++; + next; + } + if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') { + $sanitise_quote = ''; + substr($res, $off, 2, "$;$;"); + $off++; + next; + } + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { + $sanitise_quote = '//'; + + substr($res, $off, 2, $sanitise_quote); + $off++; + next; + } + + # A \ in a string means ignore the next character. + if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && + $c eq "\\") { + substr($res, $off, 2, 'XX'); + $off++; + next; + } + # Regular quotes. + if ($c eq "'" || $c eq '"') { + if ($sanitise_quote eq '') { + $sanitise_quote = $c; + + substr($res, $off, 1, $c); + next; + } elsif ($sanitise_quote eq $c) { + $sanitise_quote = ''; + } + } + + #print "c<$c> SQ<$sanitise_quote>\n"; + if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { + substr($res, $off, 1, $;); + } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { + substr($res, $off, 1, $;); + } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { + substr($res, $off, 1, 'X'); + } else { + substr($res, $off, 1, $c); + } + } + + if ($sanitise_quote eq '//') { + $sanitise_quote = ''; + } + + # The pathname on a #include may be surrounded by '<' and '>'. + if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { + my $clean = 'X' x length($1); + $res =~ s@\<.*\>@<$clean>@; + + # The whole of a #error is a string. + } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) { + my $clean = 'X' x length($1); + $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; + } + + return $res; +} + +sub ctx_statement_block { + my ($linenr, $remain, $off) = @_; + my $line = $linenr - 1; + my $blk = ''; + my $soff = $off; + my $coff = $off - 1; + my $coff_set = 0; + + my $loff = 0; + + my $type = ''; + my $level = 0; + my @stack = (); + my $p; + my $c; + my $len = 0; + + my $remainder; + while (1) { + @stack = (['', 0]) if ($#stack == -1); + + #warn "CSB: blk<$blk> remain<$remain>\n"; + # If we are about to drop off the end, pull in more + # context. + if ($off >= $len) { + for (; $remain > 0; $line++) { + last if (!defined $lines[$line]); + next if ($lines[$line] =~ /^-/); + $remain--; + $loff = $len; + $blk .= $lines[$line] . "\n"; + $len = length($blk); + $line++; + last; + } + # Bail if there is no further context. + #warn "CSB: blk<$blk> off<$off> len<$len>\n"; + if ($off >= $len) { + last; + } + } + $p = $c; + $c = substr($blk, $off, 1); + $remainder = substr($blk, $off); + + #warn "CSB: c<$c> type<$type> level<$level> remainder<$remainder> coff_set<$coff_set>\n"; + + # Handle nested #if/#else. + if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) { + push(@stack, [ $type, $level ]); + } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) { + ($type, $level) = @{$stack[$#stack - 1]}; + } elsif ($remainder =~ /^#\s*endif\b/) { + ($type, $level) = @{pop(@stack)}; + } + + # Statement ends at the ';' or a close '}' at the + # outermost level. + if ($level == 0 && $c eq ';') { + last; + } + + # An else is really a conditional as long as its not else if + if ($level == 0 && $coff_set == 0 && + (!defined($p) || $p =~ /(?:\s|\}|\+)/) && + $remainder =~ /^(else)(?:\s|{)/ && + $remainder !~ /^else\s+if\b/) { + $coff = $off + length($1) - 1; + $coff_set = 1; + #warn "CSB: mark coff<$coff> soff<$soff> 1<$1>\n"; + #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n"; + } + + if (($type eq '' || $type eq '(') && $c eq '(') { + $level++; + $type = '('; + } + if ($type eq '(' && $c eq ')') { + $level--; + $type = ($level != 0)? '(' : ''; + + if ($level == 0 && $coff < $soff) { + $coff = $off; + $coff_set = 1; + #warn "CSB: mark coff<$coff>\n"; + } + } + if (($type eq '' || $type eq '{') && $c eq '{') { + $level++; + $type = '{'; + } + if ($type eq '{' && $c eq '}') { + $level--; + $type = ($level != 0)? '{' : ''; + + if ($level == 0) { + if (substr($blk, $off + 1, 1) eq ';') { + $off++; + } + last; + } + } + $off++; + } + # We are truly at the end, so shuffle to the next line. + if ($off == $len) { + $loff = $len + 1; + $line++; + $remain--; + } + + my $statement = substr($blk, $soff, $off - $soff + 1); + my $condition = substr($blk, $soff, $coff - $soff + 1); + + #warn "STATEMENT<$statement>\n"; + #warn "CONDITION<$condition>\n"; + + #print "coff<$coff> soff<$off> loff<$loff>\n"; + + return ($statement, $condition, + $line, $remain + 1, $off - $loff + 1, $level); +} + +sub statement_lines { + my ($stmt) = @_; + + # Strip the diff line prefixes and rip blank lines at start and end. + $stmt =~ s/(^|\n)./$1/g; + $stmt =~ s/^\s*//; + $stmt =~ s/\s*$//; + + my @stmt_lines = ($stmt =~ /\n/g); + + return $#stmt_lines + 2; +} + +sub statement_rawlines { + my ($stmt) = @_; + + my @stmt_lines = ($stmt =~ /\n/g); + + return $#stmt_lines + 2; +} + +sub statement_block_size { + my ($stmt) = @_; + + $stmt =~ s/(^|\n)./$1/g; + $stmt =~ s/^\s*\{//; + $stmt =~ s/}\s*$//; + $stmt =~ s/^\s*//; + $stmt =~ s/\s*$//; + + my @stmt_lines = ($stmt =~ /\n/g); + my @stmt_statements = ($stmt =~ /;/g); + + my $stmt_lines = $#stmt_lines + 2; + my $stmt_statements = $#stmt_statements + 1; + + if ($stmt_lines > $stmt_statements) { + return $stmt_lines; + } else { + return $stmt_statements; + } +} + +sub ctx_statement_full { + my ($linenr, $remain, $off) = @_; + my ($statement, $condition, $level); + + my (@chunks); + + # Grab the first conditional/block pair. + ($statement, $condition, $linenr, $remain, $off, $level) = + ctx_statement_block($linenr, $remain, $off); + #print "F: c<$condition> s<$statement> remain<$remain>\n"; + push(@chunks, [ $condition, $statement ]); + if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) { + return ($level, $linenr, @chunks); + } + + # Pull in the following conditional/block pairs and see if they + # could continue the statement. + for (;;) { + ($statement, $condition, $linenr, $remain, $off, $level) = + ctx_statement_block($linenr, $remain, $off); + #print "C: c<$condition> s<$statement> remain<$remain>\n"; + last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s)); + #print "C: push\n"; + push(@chunks, [ $condition, $statement ]); + } + + return ($level, $linenr, @chunks); +} + +sub ctx_block_get { + my ($linenr, $remain, $outer, $open, $close, $off) = @_; + my $line; + my $start = $linenr - 1; + my $blk = ''; + my @o; + my @c; + my @res = (); + + my $level = 0; + my @stack = ($level); + for ($line = $start; $remain > 0; $line++) { + next if ($rawlines[$line] =~ /^-/); + $remain--; + + $blk .= $rawlines[$line]; + + # Handle nested #if/#else. + if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) { + push(@stack, $level); + } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) { + $level = $stack[$#stack - 1]; + } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) { + $level = pop(@stack); + } + + foreach my $c (split(//, $lines[$line])) { + ##print "C<$c>L<$level><$open$close>O<$off>\n"; + if ($off > 0) { + $off--; + next; + } + + if ($c eq $close && $level > 0) { + $level--; + last if ($level == 0); + } elsif ($c eq $open) { + $level++; + } + } + + if (!$outer || $level <= 1) { + push(@res, $rawlines[$line]); + } + + last if ($level == 0); + } + + return ($level, @res); +} +sub ctx_block_outer { + my ($linenr, $remain) = @_; + + my ($level, @r) = ctx_block_get($linenr, $remain, 1, '{', '}', 0); + return @r; +} +sub ctx_block { + my ($linenr, $remain) = @_; + + my ($level, @r) = ctx_block_get($linenr, $remain, 0, '{', '}', 0); + return @r; +} +sub ctx_statement { + my ($linenr, $remain, $off) = @_; + + my ($level, @r) = ctx_block_get($linenr, $remain, 0, '(', ')', $off); + return @r; +} +sub ctx_block_level { + my ($linenr, $remain) = @_; + + return ctx_block_get($linenr, $remain, 0, '{', '}', 0); +} +sub ctx_statement_level { + my ($linenr, $remain, $off) = @_; + + return ctx_block_get($linenr, $remain, 0, '(', ')', $off); +} + +sub ctx_locate_comment { + my ($first_line, $end_line) = @_; + + # Catch a comment on the end of the line itself. + my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@); + return $current_comment if (defined $current_comment); + + # Look through the context and try and figure out if there is a + # comment. + my $in_comment = 0; + $current_comment = ''; + for (my $linenr = $first_line; $linenr < $end_line; $linenr++) { + my $line = $rawlines[$linenr - 1]; + #warn " $line\n"; + if ($linenr == $first_line and $line =~ m@^.\s*\*@) { + $in_comment = 1; + } + if ($line =~ m@/\*@) { + $in_comment = 1; + } + if (!$in_comment && $current_comment ne '') { + $current_comment = ''; + } + $current_comment .= $line . "\n" if ($in_comment); + if ($line =~ m@\*/@) { + $in_comment = 0; + } + } + + chomp($current_comment); + return($current_comment); +} +sub ctx_has_comment { + my ($first_line, $end_line) = @_; + my $cmt = ctx_locate_comment($first_line, $end_line); + + ##print "LINE: $rawlines[$end_line - 1 ]\n"; + ##print "CMMT: $cmt\n"; + + return ($cmt ne ''); +} + +sub raw_line { + my ($linenr, $cnt) = @_; + + my $offset = $linenr - 1; + $cnt++; + + my $line; + while ($cnt) { + $line = $rawlines[$offset++]; + next if (defined($line) && $line =~ /^-/); + $cnt--; + } + + return $line; +} + +sub cat_vet { + my ($vet) = @_; + my ($res, $coded); + + $res = ''; + while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]]|$)/g) { + $res .= $1; + if ($2 ne '') { + $coded = sprintf("^%c", unpack('C', $2) + 64); + $res .= $coded; + } + } + $res =~ s/$/\$/; + + return $res; +} + +my $av_preprocessor = 0; +my $av_pending; +my @av_paren_type; +my $av_pend_colon; + +sub annotate_reset { + $av_preprocessor = 0; + $av_pending = '_'; + @av_paren_type = ('E'); + $av_pend_colon = 'O'; +} + +sub annotate_values { + my ($stream, $type) = @_; + + my $res; + my $var = '_' x length($stream); + my $cur = $stream; + + print "$stream\n" if ($dbg_values > 1); + + while (length($cur)) { + @av_paren_type = ('E') if ($#av_paren_type < 0); + print " <" . join('', @av_paren_type) . + "> <$type> <$av_pending>" if ($dbg_values > 1); + if ($cur =~ /^(\s+)/o) { + print "WS($1)\n" if ($dbg_values > 1); + if ($1 =~ /\n/ && $av_preprocessor) { + $type = pop(@av_paren_type); + $av_preprocessor = 0; + } + + } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') { + print "CAST($1)\n" if ($dbg_values > 1); + push(@av_paren_type, $type); + $type = 'C'; + + } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) { + print "DECLARE($1)\n" if ($dbg_values > 1); + $type = 'T'; + + } elsif ($cur =~ /^($Modifier)\s*/) { + print "MODIFIER($1)\n" if ($dbg_values > 1); + $type = 'T'; + + } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) { + print "DEFINE($1,$2)\n" if ($dbg_values > 1); *** 1791 LINES SKIPPED *** From nobody Sat Mar 25 17:22:21 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkQrM2wssz41SnZ; Sat, 25 Mar 2023 17:22:43 +0000 (UTC) (envelope-from gallatin@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 4PkQrM1wfBz4LVF; Sat, 25 Mar 2023 17:22:43 +0000 (UTC) (envelope-from gallatin@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+jVb+6dWe3ZJlC+84lW8iDn/fiD0U9RasmjUrWjF/bQ=; b=QMhclNRsglsAc+qAFWQqoxOHU4D6jlgIWK2u/abLONZLkUe47k0dYuEkzbdYh5iivzFldo IYZPNn9aNW3ECBCOqc/CpnZSVnzUoj2+5M8n9+//onuTth1NhFGta7efAlxue+bZWFghHC /MF9xyFhPTkaPXPkccVOywpgTPJobKDdfxZ+aQF5UwRQhRtsH01diNXX0d3BL2hrXg70bU 79kQM/TM9sCjsf/dNoJ4lj37cQ2f9gvu3YhYG6UhhVnnF2tkeh+TujqkJJVYw71cm/P5Bv gnd62AsvasqIY5YzrETK4i8or1B5/A2l4N2mTAlQ24RtgoHk1K3e1A1aCpJlxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679764963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+jVb+6dWe3ZJlC+84lW8iDn/fiD0U9RasmjUrWjF/bQ=; b=caAxG3usoPoStBIHr+yH6cHl9jTXNkhQU5myU5T4BECe1bRI8YunYnJrIA0i0Iwq1KYQ3L ufuZVQDJC83Xf9Z/UVqRpS+J1hwQmqKdX6q9PiW8h1RFaNNWutAPfEYVBnrAgzHh3Be7xn qzRF5ddwz58r6mRBv8fjeiQjl0oUgENjVi2CcQajKzSCF8aTjJpkVLv4L6TQP+qIJmGgHA R/szWwSEFwlDg+Ji6YLKVQ2PJHyMLZaBbgkSrQTwpTPGkEr2o2lf+26K38Les1HS6Q/Zyc Px/Ci47mRqGakpgfRMid9ZyJU2F2QPQl88QNF8grMSXPPcb3rEaHv9lenOTTZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679764963; a=rsa-sha256; cv=none; b=FxHKUzWHOgPh9JlCdg4zI2Xfm8Ru6e0f/1URKpfBCcOqFbhRnzJkYFqMxTGQqpfmaysi5i iHblHnYKOqRCDuUSSxMSnfGkqY9qg3mkpAeVlJlm1M9OBv2SH83wTXf6mp7FyqX2dMdYiq e44KCLcLl5nG8S1RKJ4HxFehDldAOWBnNjNWu42JCoIEysEqf7EcGanCn4bOyyTW0n1Hbk oPjsUOMXNOcUmnBv3sCE5G7Hp7QjCJuwsECbiy5s1us2x2OvT0Z3EJCKry8Ytt0MkuHb4U PygPfkAmaYWCvdRPadX527s5RZ728mMcwRlU0s2EBwguKka4/LasKSwJbjTaaA== Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: gallatin) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PkQrM0pTXzZJP; Sat, 25 Mar 2023 17:22:43 +0000 (UTC) (envelope-from gallatin@freebsd.org) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id AC6FB27C0054; Sat, 25 Mar 2023 13:22:42 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Sat, 25 Mar 2023 13:22:42 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegkedguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesrg dtreerreertdenucfhrhhomhepfdffrhgvficuifgrlhhlrghtihhnfdcuoehgrghllhgr thhinhesfhhrvggvsghsugdrohhrgheqnecuggftrfgrthhtvghrnhepvdefhfejledufe egfeejleetieeftdffueduvefggffffedugfeluedvkefhjeeinecuffhomhgrihhnpehf rhgvvggsshgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepghgrlhhlrghtihhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhi thihqddufeefheelvddvudeiqddvleehtdegudekgedqghgrlhhlrghtihhnpeepfhhrvg gvsghsugdrohhrghesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i41414658:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8435AB60086; Sat, 25 Mar 2023 13:22:42 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-236-g06c0f70e43-fm-20230313.001-g06c0f70e List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 Message-Id: <5b9c31d2-4aaf-4822-b405-cae57164f314@app.fastmail.com> In-Reply-To: <202303251708.32PH8BUq079177@gitrepo.freebsd.org> References: <202303251708.32PH8BUq079177@gitrepo.freebsd.org> Date: Sat, 25 Mar 2023 13:22:21 -0400 From: "Drew Gallatin" To: "Warner Losh" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3a3c9242739e - main - checkstyle9.pl: Perl script to check if a change is approximately style(9) Content-Type: multipart/alternative; boundary=d2b24846419d49c4ab1b06d629e431e9 X-ThisMailContainsUnwantedMimeParts: N --d2b24846419d49c4ab1b06d629e431e9 Content-Type: text/plain Thanks so much. I've wanted something like this *forever* On Sat, Mar 25, 2023, at 1:08 PM, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 > > commit 3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 > Author: Warner Losh > AuthorDate: 2023-03-14 21:28:05 +0000 > Commit: Warner Losh > CommitDate: 2023-03-25 17:06:13 +0000 > > checkstyle9.pl: Perl script to check if a change is approximately style(9) > > This code is adapted from the QEMU checkpatch.pl script. It can check > either a patch, a file or a git branch. It tries to warn about things > that I believe might be style(9) violations. It's experimental, since I > heavily hacked on the qemu version to get it to not complain (much) > about iconic code in the tree. At the moment, it's use should be > considered expermental. It will likely miss violations, and complain > about code that's perfectly fine. It's offered as an experiment > and to make it easier for contributors to submit patches. > --- > tools/build/checkstyle9.pl | 2748 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 2748 insertions(+) > > diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl > new file mode 100755 > index 000000000000..5aec3819bf7c > --- /dev/null > +++ b/tools/build/checkstyle9.pl > @@ -0,0 +1,2748 @@ > +#!/usr/bin/env perl > +# (c) 2001, Dave Jones. (the file handling bit) > +# (c) 2005, Joel Schopp (the ugly bit) > +# (c) 2007,2008, Andy Whitcroft (new conditions, test suite) > +# (c) 2008-2010 Andy Whitcroft > +# Licensed under the terms of the GNU GPL License version 2 > + > +use strict; > +use warnings; > +use Term::ANSIColor qw(:constants); > + > +my $P = $0; > +$P =~ s@.*/@@g; > + > +our $SrcFile = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$}; > + > +my $V = '0.31'; > + > +use Getopt::Long qw(:config no_auto_abbrev); > + > +my $quiet = 0; > +my $tree = 1; > +my $chk_signoff = 1; > +my $chk_patch = undef; > +my $chk_branch = undef; > +my $tst_only; > +my $emacs = 0; > +my $terse = 0; > +my $file = undef; > +my $color = "auto"; > +my $no_warnings = 0; > +my $summary = 1; > +my $mailback = 0; > +my $summary_file = 0; > +my $root; > +my %debug; > +my $help = 0; > + > +sub help { > + my ($exitcode) = @_; > + > + print << "EOM"; > +Usage: > + > + $P [OPTION]... [FILE]... > + $P [OPTION]... [GIT-REV-LIST] > + > +Version: $V > + > +Options: > + -q, --quiet quiet > + --patch treat FILE as patchfile > + --branch treat args as GIT revision list > + --emacs emacs compile window format > + --terse one line per report > + -f, --file treat FILE as regular source file > + --strict fail if only warnings are found > + --no-summary suppress the per-file summary > + --mailback only produce a report in case of warnings/errors > + --summary-file include the filename in summary > + --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of > + 'values', 'possible', 'type', and 'attr' (default > + is all off) > + --test-only=WORD report only warnings/errors containing WORD > + literally > + --color[=WHEN] Use colors 'always', 'never', or only when output > + is a terminal ('auto'). Default is 'auto'. > + -h, --help, --version display this help and exit > + > +When FILE is - read standard input. > +EOM > + > + exit($exitcode); > +} > + > +# Use at your own risk > +print "\n", MAGENTA, "WARNING:", RESET, " This code is highly experimental ... likely isn't a great style(9) match yet\n\n"; > + > +# Perl's Getopt::Long allows options to take optional arguments after a space. > +# Prevent --color by itself from consuming other arguments > +foreach (@ARGV) { > + if ($_ eq "--color" || $_ eq "-color") { > + $_ = "--color=$color"; > + } > +} > + > +GetOptions( > + 'q|quiet+' => \$quiet, > + 'tree!' => \$tree, > + 'signoff!' => \$chk_signoff, > + 'patch!' => \$chk_patch, > + 'branch!' => \$chk_branch, > + 'emacs!' => \$emacs, > + 'terse!' => \$terse, > + 'f|file!' => \$file, > + 'strict!' => \$no_warnings, > + 'root=s' => \$root, > + 'summary!' => \$summary, > + 'mailback!' => \$mailback, > + 'summary-file!' => \$summary_file, > + > + 'debug=s' => \%debug, > + 'test-only=s' => \$tst_only, > + 'color=s' => \$color, > + 'no-color' => sub { $color = 'never'; }, > + 'h|help' => \$help, > + 'version' => \$help > +) or help(1); > + > +help(0) if ($help); > + > +my $exit = 0; > + > +if ($#ARGV < 0) { > + print "$P: no input files\n"; > + exit(1); > +} > + > +if (!defined $chk_branch && !defined $chk_patch && !defined $file) { > + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; > + $file = $ARGV[0] =~ /$SrcFile/ ? 1 : 0; > + $chk_patch = $chk_branch || $file ? 0 : 1; > +} elsif (!defined $chk_branch && !defined $chk_patch) { > + if ($file) { > + $chk_branch = $chk_patch = 0; > + } else { > + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; > + $chk_patch = $chk_branch ? 0 : 1; > + } > +} elsif (!defined $chk_branch && !defined $file) { > + if ($chk_patch) { > + $chk_branch = $file = 0; > + } else { > + $chk_branch = $ARGV[0] =~ /.\.\./ ? 1 : 0; > + $file = $chk_branch ? 0 : 1; > + } > +} elsif (!defined $chk_patch && !defined $file) { > + if ($chk_branch) { > + $chk_patch = $file = 0; > + } else { > + $file = $ARGV[0] =~ /$SrcFile/ ? 1 : 0; > + $chk_patch = $file ? 0 : 1; > + } > +} elsif (!defined $chk_branch) { > + $chk_branch = $chk_patch || $file ? 0 : 1; > +} elsif (!defined $chk_patch) { > + $chk_patch = $chk_branch || $file ? 0 : 1; > +} elsif (!defined $file) { > + $file = $chk_patch || $chk_branch ? 0 : 1; > +} > + > +if (($chk_patch && $chk_branch) || > + ($chk_patch && $file) || > + ($chk_branch && $file)) { > + die "Only one of --file, --branch, --patch is permitted\n"; > +} > +if (!$chk_patch && !$chk_branch && !$file) { > + die "One of --file, --branch, --patch is required\n"; > +} > + > +if ($color =~ /^always$/i) { > + $color = 1; > +} elsif ($color =~ /^never$/i) { > + $color = 0; > +} elsif ($color =~ /^auto$/i) { > + $color = (-t STDOUT); > +} else { > + die "Invalid color mode: $color\n"; > +} > + > +my $dbg_values = 0; > +my $dbg_possible = 0; > +my $dbg_type = 0; > +my $dbg_attr = 0; > +my $dbg_adv_dcs = 0; > +my $dbg_adv_checking = 0; > +my $dbg_adv_apw = 0; > +for my $key (keys %debug) { > + ## no critic > + eval "\${dbg_$key} = '$debug{$key}';"; > + die "$@" if ($@); > +} > + > +my $rpt_cleaners = 0; > + > +if ($terse) { > + $emacs = 1; > + $quiet++; > +} > + > +my $emitted_corrupt = 0; > + > +our $Ident = qr{ > + [A-Za-z_][A-Za-z\d_]* > + (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* > + }x; > +our $Storage = qr{extern|static|asmlinkage}; > +our $Sparse = qr{ > + __force > + }x; > + > +# Notes to $Attribute: > +our $Attribute = qr{ > + const| > + volatile| > + QEMU_NORETURN| > + QEMU_WARN_UNUSED_RESULT| > + QEMU_SENTINEL| > + QEMU_PACKED| > + GCC_FMT_ATTR > + }x; > +our $Modifier; > +our $Inline = qr{inline}; > +our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; > +our $Lval = qr{$Ident(?:$Member)*}; > + > +our $Constant = qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*}; > +our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; > +our $Compare = qr{<=|>=|==|!=|<|>}; > +our $Operators = qr{ > + <=|>=|==|!=| > + =>|->|<<|>>|<|>|!|~| > + &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|% > + }x; > + > +our $NonptrType; > +our $Type; > +our $Declare; > + > +our $NON_ASCII_UTF8 = qr{ > + [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte > + | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs > + | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte > + | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates > + | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 > + | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 > + | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 > +}x; > + > +our $UTF8 = qr{ > + [\x09\x0A\x0D\x20-\x7E] # ASCII > + | $NON_ASCII_UTF8 > +}x; > + > +# some readers default to ISO-8859-1 when showing email source. detect > +# when UTF-8 is incorrectly interpreted as ISO-8859-1 and reencoded back. > +# False positives are possible but very unlikely. > +our $UTF8_MOJIBAKE = qr{ > + \xC3[\x82-\x9F] \xC2[\x80-\xBF] # c2-df 80-bf > + | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF] # e0 a0-bf 80-bf > + | \xC3[\xA1-\xAC\xAE\xAF] (?: \xC2[\x80-\xBF]){2} # e1-ec/ee/ef 80-bf 80-bf > + | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF] # ed 80-9f 80-bf > + | \xC3\xB0 \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-bf > + | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3} # f1-f3 80-bf 80-bf 80-bf > + | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf 80-bf > +}x; > + > +# There are still some false positives, but this catches most > +# common cases. > +our $typeTypedefs = qr{(?x: > + (?![KMGTPE]iB) # IEC binary prefix (do not match) > + [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]* # camelcase > + | [A-Z][A-Z\d_]*AIOCB # all uppercase > + | [A-Z][A-Z\d_]*CPU # all uppercase > + | QEMUBH # all uppercase > +)}; > + > +our @typeList = ( > + qr{void}, > + qr{(?:unsigned\s+)?char}, > + qr{(?:unsigned\s+)?short}, > + qr{(?:unsigned\s+)?int}, > + qr{(?:unsigned\s+)?long}, > + qr{(?:unsigned\s+)?long\s+int}, > + qr{(?:unsigned\s+)?long\s+long}, > + qr{(?:unsigned\s+)?long\s+long\s+int}, > + qr{unsigned}, > + qr{float}, > + qr{double}, > + qr{bool}, > + qr{struct\s+$Ident}, > + qr{union\s+$Ident}, > + qr{enum\s+$Ident}, > + qr{${Ident}_t}, > + qr{${Ident}_handler}, > + qr{${Ident}_handler_fn}, > + qr{target_(?:u)?long}, > + qr{hwaddr}, > +); > + > +# This can be modified by sub possible. Since it can be empty, be careful > +# about regexes that always match, because they can cause infinite loops. > +our @modifierList = ( > +); > + > +sub build_types { > + my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; > + if (@modifierList > 0) { > + my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; > + $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; > + } else { > + $Modifier = qr{(?:$Attribute|$Sparse)}; > + } > + $NonptrType = qr{ > + (?:$Modifier\s+|const\s+)* > + (?: > + (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| > + (?:$typeTypedefs\b)| > + (?:${all}\b) > + ) > + (?:\s+$Modifier|\s+const)* > + }x; > + $Type = qr{ > + $NonptrType > + (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? > + (?:\s+$Inline|\s+$Modifier)* > + }x; > + $Declare = qr{(?:$Storage\s+)?$Type}; > +} > +build_types(); > + > +$chk_signoff = 0 if ($file); > + > +my @rawlines = (); > +my @lines = (); > +my $vname; > +if ($chk_branch) { > + my @patches; > + my %git_commits = (); > + my $HASH; > + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) || > + die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n"; > + > + for my $line (<$HASH>) { > + $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; > + next if (!defined($1) || !defined($2)); > + my $sha1 = $1; > + my $subject = $2; > + push(@patches, $sha1); > + $git_commits{$sha1} = $subject; > + } > + > + close $HASH; > + > + die "$P: no revisions returned for revlist '$ARGV[0]'\n" > + unless @patches; > + > + my $i = 1; > + my $num_patches = @patches; > + for my $hash (@patches) { > + my $FILE; > + open($FILE, '-|', "git", "show", "--patch-with-stat", $hash) || > + die "$P: git show $hash - $!\n"; > + while (<$FILE>) { > + chomp; > + push(@rawlines, $_); > + } > + close($FILE); > + $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; > + if ($num_patches > 1 && $quiet == 0) { > + my $prefix = "$i/$num_patches"; > + $prefix = BLUE . BOLD . $prefix . RESET if $color; > + print "$prefix Checking commit $vname\n"; > + $vname = "Patch $i/$num_patches"; > + } else { > + $vname = "Commit " . $vname; > + } > + if (!process($hash)) { > + $exit = 1; > + print "\n" if ($num_patches > 1 && $quiet == 0); > + } > + @rawlines = (); > + @lines = (); > + $i++; > + } > +} else { > + for my $filename (@ARGV) { > + my $FILE; > + if ($file) { > + open($FILE, '-|', "diff -u /dev/null $filename") || > + die "$P: $filename: diff failed - $!\n"; > + } elsif ($filename eq '-') { > + open($FILE, '<&STDIN'); > + } else { > + open($FILE, '<', "$filename") || > + die "$P: $filename: open failed - $!\n"; > + } > + if ($filename eq '-') { > + $vname = 'Your patch'; > + } else { > + $vname = $filename; > + } > + print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0; > + while (<$FILE>) { > + chomp; > + push(@rawlines, $_); > + } > + close($FILE); > + if (!process($filename)) { > + $exit = 1; > + } > + @rawlines = (); > + @lines = (); > + } > +} > + > +exit($exit); > + > +sub top_of_kernel_tree { > + my ($root) = @_; > + > + my @tree_check = ( > + "Makefile.inc1", "README.md", "sys", > + "usr.sbin" > + ); > + > + foreach my $check (@tree_check) { > + if (! -e $root . '/' . $check) { > + return 0; > + } > + } > + return 1; > +} > + > +sub expand_tabs { > + my ($str) = @_; > + > + my $res = ''; > + my $n = 0; > + for my $c (split(//, $str)) { > + if ($c eq "\t") { > + $res .= ' '; > + $n++; > + for (; ($n % 8) != 0; $n++) { > + $res .= ' '; > + } > + next; > + } > + $res .= $c; > + $n++; > + } > + > + return $res; > +} > +sub copy_spacing { > + (my $res = shift) =~ tr/\t/ /c; > + return $res; > +} > + > +sub line_stats { > + my ($line) = @_; > + > + # Drop the diff line leader and expand tabs > + $line =~ s/^.//; > + $line = expand_tabs($line); > + > + # Pick the indent from the front of the line. > + my ($white) = ($line =~ /^(\s*)/); > + > + return (length($line), length($white)); > +} > + > +my $sanitise_quote = ''; > + > +sub sanitise_line_reset { > + my ($in_comment) = @_; > + > + if ($in_comment) { > + $sanitise_quote = '*/'; > + } else { > + $sanitise_quote = ''; > + } > +} > +sub sanitise_line { > + my ($line) = @_; > + > + my $res = ''; > + my $l = ''; > + > + my $qlen = 0; > + my $off = 0; > + my $c; > + > + # Always copy over the diff marker. > + $res = substr($line, 0, 1); > + > + for ($off = 1; $off < length($line); $off++) { > + $c = substr($line, $off, 1); > + > + # Comments we are wacking completely including the begin > + # and end, all to $;. > + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') { > + $sanitise_quote = '*/'; > + > + substr($res, $off, 2, "$;$;"); > + $off++; > + next; > + } > + if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') { > + $sanitise_quote = ''; > + substr($res, $off, 2, "$;$;"); > + $off++; > + next; > + } > + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { > + $sanitise_quote = '//'; > + > + substr($res, $off, 2, $sanitise_quote); > + $off++; > + next; > + } > + > + # A \ in a string means ignore the next character. > + if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && > + $c eq "\\") { > + substr($res, $off, 2, 'XX'); > + $off++; > + next; > + } > + # Regular quotes. > + if ($c eq "'" || $c eq '"') { > + if ($sanitise_quote eq '') { > + $sanitise_quote = $c; > + > + substr($res, $off, 1, $c); > + next; > + } elsif ($sanitise_quote eq $c) { > + $sanitise_quote = ''; > + } > + } > + > + #print "c<$c> SQ<$sanitise_quote>\n"; > + if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { > + substr($res, $off, 1, $;); > + } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { > + substr($res, $off, 1, $;); > + } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { > + substr($res, $off, 1, 'X'); > + } else { > + substr($res, $off, 1, $c); > + } > + } > + > + if ($sanitise_quote eq '//') { > + $sanitise_quote = ''; > + } > + > + # The pathname on a #include may be surrounded by '<' and '>'. > + if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { > + my $clean = 'X' x length($1); > + $res =~ s@\<.*\>@<$clean>@; > + > + # The whole of a #error is a string. > + } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) { > + my $clean = 'X' x length($1); > + $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; > + } > + > + return $res; > +} > + > +sub ctx_statement_block { > + my ($linenr, $remain, $off) = @_; > + my $line = $linenr - 1; > + my $blk = ''; > + my $soff = $off; > + my $coff = $off - 1; > + my $coff_set = 0; > + > + my $loff = 0; > + > + my $type = ''; > + my $level = 0; > + my @stack = (); > + my $p; > + my $c; > + my $len = 0; > + > + my $remainder; > + while (1) { > + @stack = (['', 0]) if ($#stack == -1); > + > + #warn "CSB: blk<$blk> remain<$remain>\n"; > + # If we are about to drop off the end, pull in more > + # context. > + if ($off >= $len) { > + for (; $remain > 0; $line++) { > + last if (!defined $lines[$line]); > + next if ($lines[$line] =~ /^-/); > + $remain--; > + $loff = $len; > + $blk .= $lines[$line] . "\n"; > + $len = length($blk); > + $line++; > + last; > + } > + # Bail if there is no further context. > + #warn "CSB: blk<$blk> off<$off> len<$len>\n"; > + if ($off >= $len) { > + last; > + } > + } > + $p = $c; > + $c = substr($blk, $off, 1); > + $remainder = substr($blk, $off); > + > + #warn "CSB: c<$c> type<$type> level<$level> remainder<$remainder> coff_set<$coff_set>\n"; > + > + # Handle nested #if/#else. > + if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) { > + push(@stack, [ $type, $level ]); > + } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) { > + ($type, $level) = @{$stack[$#stack - 1]}; > + } elsif ($remainder =~ /^#\s*endif\b/) { > + ($type, $level) = @{pop(@stack)}; > + } > + > + # Statement ends at the ';' or a close '}' at the > + # outermost level. > + if ($level == 0 && $c eq ';') { > + last; > + } > + > + # An else is really a conditional as long as its not else if > + if ($level == 0 && $coff_set == 0 && > + (!defined($p) || $p =~ /(?:\s|\}|\+)/) && > + $remainder =~ /^(else)(?:\s|{)/ && > + $remainder !~ /^else\s+if\b/) { > + $coff = $off + length($1) - 1; > + $coff_set = 1; > + #warn "CSB: mark coff<$coff> soff<$soff> 1<$1>\n"; > + #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n"; > + } > + > + if (($type eq '' || $type eq '(') && $c eq '(') { > + $level++; > + $type = '('; > + } > + if ($type eq '(' && $c eq ')') { > + $level--; > + $type = ($level != 0)? '(' : ''; > + > + if ($level == 0 && $coff < $soff) { > + $coff = $off; > + $coff_set = 1; > + #warn "CSB: mark coff<$coff>\n"; > + } > + } > + if (($type eq '' || $type eq '{') && $c eq '{') { > + $level++; > + $type = '{'; > + } > + if ($type eq '{' && $c eq '}') { > + $level--; > + $type = ($level != 0)? '{' : ''; > + > + if ($level == 0) { > + if (substr($blk, $off + 1, 1) eq ';') { > + $off++; > + } > + last; > + } > + } > + $off++; > + } > + # We are truly at the end, so shuffle to the next line. > + if ($off == $len) { > + $loff = $len + 1; > + $line++; > + $remain--; > + } > + > + my $statement = substr($blk, $soff, $off - $soff + 1); > + my $condition = substr($blk, $soff, $coff - $soff + 1); > + > + #warn "STATEMENT<$statement>\n"; > + #warn "CONDITION<$condition>\n"; > + > + #print "coff<$coff> soff<$off> loff<$loff>\n"; > + > + return ($statement, $condition, > + $line, $remain + 1, $off - $loff + 1, $level); > +} > + > +sub statement_lines { > + my ($stmt) = @_; > + > + # Strip the diff line prefixes and rip blank lines at start and end. > + $stmt =~ s/(^|\n)./$1/g; > + $stmt =~ s/^\s*//; > + $stmt =~ s/\s*$//; > + > + my @stmt_lines = ($stmt =~ /\n/g); > + > + return $#stmt_lines + 2; > +} > + > +sub statement_rawlines { > + my ($stmt) = @_; > + > + my @stmt_lines = ($stmt =~ /\n/g); > + > + return $#stmt_lines + 2; > +} > + > +sub statement_block_size { > + my ($stmt) = @_; > + > + $stmt =~ s/(^|\n)./$1/g; > + $stmt =~ s/^\s*\{//; > + $stmt =~ s/}\s*$//; > + $stmt =~ s/^\s*//; > + $stmt =~ s/\s*$//; > + > + my @stmt_lines = ($stmt =~ /\n/g); > + my @stmt_statements = ($stmt =~ /;/g); > + > + my $stmt_lines = $#stmt_lines + 2; > + my $stmt_statements = $#stmt_statements + 1; > + > + if ($stmt_lines > $stmt_statements) { > + return $stmt_lines; > + } else { > + return $stmt_statements; > + } > +} > + > +sub ctx_statement_full { > + my ($linenr, $remain, $off) = @_; > + my ($statement, $condition, $level); > + > + my (@chunks); > + > + # Grab the first conditional/block pair. > + ($statement, $condition, $linenr, $remain, $off, $level) = > + ctx_statement_block($linenr, $remain, $off); > + #print "F: c<$condition> s<$statement> remain<$remain>\n"; > + push(@chunks, [ $condition, $statement ]); > + if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) { > + return ($level, $linenr, @chunks); > + } > + > + # Pull in the following conditional/block pairs and see if they > + # could continue the statement. > + for (;;) { > + ($statement, $condition, $linenr, $remain, $off, $level) = > + ctx_statement_block($linenr, $remain, $off); > + #print "C: c<$condition> s<$statement> remain<$remain>\n"; > + last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s)); > + #print "C: push\n"; > + push(@chunks, [ $condition, $statement ]); > + } > + > + return ($level, $linenr, @chunks); > +} > + > +sub ctx_block_get { > + my ($linenr, $remain, $outer, $open, $close, $off) = @_; > + my $line; > + my $start = $linenr - 1; > + my $blk = ''; > + my @o; > + my @c; > + my @res = (); > + > + my $level = 0; > + my @stack = ($level); > + for ($line = $start; $remain > 0; $line++) { > + next if ($rawlines[$line] =~ /^-/); > + $remain--; > + > + $blk .= $rawlines[$line]; > + > + # Handle nested #if/#else. > + if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) { > + push(@stack, $level); > + } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) { > + $level = $stack[$#stack - 1]; > + } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) { > + $level = pop(@stack); > + } > + > + foreach my $c (split(//, $lines[$line])) { > + ##print "C<$c>L<$level><$open$close>O<$off>\n"; > + if ($off > 0) { > + $off--; > + next; > + } > + > + if ($c eq $close && $level > 0) { > + $level--; > + last if ($level == 0); > + } elsif ($c eq $open) { > + $level++; > + } > + } > + > + if (!$outer || $level <= 1) { > + push(@res, $rawlines[$line]); > + } > + > + last if ($level == 0); > + } > + > + return ($level, @res); > +} > +sub ctx_block_outer { > + my ($linenr, $remain) = @_; > + > + my ($level, @r) = ctx_block_get($linenr, $remain, 1, '{', '}', 0); > + return @r; > +} > +sub ctx_block { > + my ($linenr, $remain) = @_; > + > + my ($level, @r) = ctx_block_get($linenr, $remain, 0, '{', '}', 0); > + return @r; > +} > +sub ctx_statement { > + my ($linenr, $remain, $off) = @_; > + > + my ($level, @r) = ctx_block_get($linenr, $remain, 0, '(', ')', $off); > + return @r; > +} > +sub ctx_block_level { > + my ($linenr, $remain) = @_; > + > + return ctx_block_get($linenr, $remain, 0, '{', '}', 0); > +} > +sub ctx_statement_level { > + my ($linenr, $remain, $off) = @_; > + > + return ctx_block_get($linenr, $remain, 0, '(', ')', $off); > +} > + > +sub ctx_locate_comment { > + my ($first_line, $end_line) = @_; > + > + # Catch a comment on the end of the line itself. > + my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@); > + return $current_comment if (defined $current_comment); > + > + # Look through the context and try and figure out if there is a > + # comment. > + my $in_comment = 0; > + $current_comment = ''; > + for (my $linenr = $first_line; $linenr < $end_line; $linenr++) { > + my $line = $rawlines[$linenr - 1]; > + #warn " $line\n"; > + if ($linenr == $first_line and $line =~ m@^.\s*\*@) { > + $in_comment = 1; > + } > + if ($line =~ m@/\*@) { > + $in_comment = 1; > + } > + if (!$in_comment && $current_comment ne '') { > + $current_comment = ''; > + } > + $current_comment .= $line . "\n" if ($in_comment); > + if ($line =~ m@\*/@) { > + $in_comment = 0; > + } > + } > + > + chomp($current_comment); > + return($current_comment); > +} > +sub ctx_has_comment { > + my ($first_line, $end_line) = @_; > + my $cmt = ctx_locate_comment($first_line, $end_line); > + > + ##print "LINE: $rawlines[$end_line - 1 ]\n"; > + ##print "CMMT: $cmt\n"; > + > + return ($cmt ne ''); > +} > + > +sub raw_line { > + my ($linenr, $cnt) = @_; > + > + my $offset = $linenr - 1; > + $cnt++; > + > + my $line; > + while ($cnt) { > + $line = $rawlines[$offset++]; > + next if (defined($line) && $line =~ /^-/); > + $cnt--; > + } > + > + return $line; > +} > + > +sub cat_vet { > + my ($vet) = @_; > + my ($res, $coded); > + > + $res = ''; > + while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]]|$)/g) { > + $res .= $1; > + if ($2 ne '') { > + $coded = sprintf("^%c", unpack('C', $2) + 64); > + $res .= $coded; > + } > + } > + $res =~ s/$/\$/; > + > + return $res; > +} > + > +my $av_preprocessor = 0; > +my $av_pending; > +my @av_paren_type; > +my $av_pend_colon; > + > +sub annotate_reset { > + $av_preprocessor = 0; > + $av_pending = '_'; > + @av_paren_type = ('E'); > + $av_pend_colon = 'O'; > +} > + > +sub annotate_values { > + my ($stream, $type) = @_; > + > + my $res; > + my $var = '_' x length($stream); > + my $cur = $stream; > + > + print "$stream\n" if ($dbg_values > 1); > + > + while (length($cur)) { > + @av_paren_type = ('E') if ($#av_paren_type < 0); > + print " <" . join('', @av_paren_type) . > + "> <$type> <$av_pending>" if ($dbg_values > 1); > + if ($cur =~ /^(\s+)/o) { > + print "WS($1)\n" if ($dbg_values > 1); > + if ($1 =~ /\n/ && $av_preprocessor) { > + $type = pop(@av_paren_type); > + $av_preprocessor = 0; > + } > + > + } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') { > + print "CAST($1)\n" if ($dbg_values > 1); > + push(@av_paren_type, $type); > + $type = 'C'; > + > + } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) { > + print "DECLARE($1)\n" if ($dbg_values > 1); > + $type = 'T'; > + > + } elsif ($cur =~ /^($Modifier)\s*/) { > + print "MODIFIER($1)\n" if ($dbg_values > 1); > + $type = 'T'; > + > + } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) { > + print "DEFINE($1,$2)\n" if ($dbg_values > 1); > *** 1791 LINES SKIPPED *** > --d2b24846419d49c4ab1b06d629e431e9 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
Thanks so much.=   I've wanted something like this *forever*

On Sat, Mar 25, 2023, at 1:08 PM, Warner Losh wrote:
The branch main has been= updated by imp:


commit 3a3c9242739efb= 0c76587ffbaa54c5d10b2cbcb4
Author:    = Warner Losh <imp@FreeBSD.org&= gt;
AuthorDate: 2023-03-14 21:28:05 +0000
Co= mmit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-03-25 17= :06:13 +0000

    checkstyle9= .pl: Perl script to check if a change is approximately style(9)
    
    This cod= e is adapted from the QEMU checkpatch.pl script. It can check
<= div>    either a patch, a file or a git branch. It tries = to warn about things
    that I believe mig= ht be style(9) violations. It's experimental, since I
&nbs= p;   heavily hacked on the qemu version to get it to not compl= ain (much)
    about iconic code in the tre= e. At the moment, it's use should be
    co= nsidered expermental. It will likely miss violations, and complain
    about code that's perfectly fine.  It's= offered as an experiment
    and to make i= t easier for contributors to submit patches.
---
=
tools/build/checkstyle9.pl | 2748 +++++++++++++++++++++++++++++++++= +++++++++++
1 file changed, 2748 insertions(+)

diff --git a/tools/build/checkstyle9.pl b/tools/build/= checkstyle9.pl
new file mode 100755
index 00= 0000000000..5aec3819bf7c
--- /dev/null
+++ b= /tools/build/checkstyle9.pl
@@ -0,0 +1,2748 @@
+#!/usr/bin/env perl
+# (c) 2001, Dave Jones. (the file= handling bit)
+# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit= )
+# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
+# (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
+# Licensed under the = terms of the GNU GPL License version 2
+
+us= e strict;
+use warnings;
+use Term::ANSIColo= r qw(:constants);
+
+my $P =3D $0;
=
+$P =3D~ s@.*/@@g;
+
+our $SrcFile = ;   =3D qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
+
+my $V =3D '0.31';
+
+use Getopt::L= ong qw(:config no_auto_abbrev);
+
+my $quiet= =3D 0;
+my $tree =3D 1;
+my $chk_signoff =3D= 1;
+my $chk_patch =3D undef;
+my $chk_branc= h =3D undef;
+my $tst_only;
+my $emacs =3D 0= ;
+my $terse =3D 0;
+my $file =3D undef;
=
+my $color =3D "auto";
+my $no_warnings =3D 0;<= br>
+my $summary =3D 1;
+my $mailback =3D 0;
=
+my $summary_file =3D 0;
+my $root;
+my %debug;
+my $help =3D 0;
+
<= div>+sub help {
+ my ($exitcode) =3D @_;
+
+ print << "EOM";
+Usage:
+
+    $P [OPTION]... [FILE]...
<= div>+    $P [OPTION]... [GIT-REV-LIST]
+
+Version: $V
+
+Options:
+  -q, --quiet       &nbs= p;        quiet
+ = --patch          &nbs= p;         treat FILE as patchfi= le
+  --branch      &nb= sp;            tr= eat args as GIT revision list
+  --emacs  &= nbsp;           &= nbsp;     emacs compile window format
= +  --terse         &nb= sp;          one line per r= eport
+  -f, --file     &nbs= p;           treat FIL= E as regular source file
+  --strict   = ;            = ;    fail if only warnings are found
+ = ; --no-summary         &nbs= p;     suppress the per-file summary
+=   --mailback         &= nbsp;       only produce a report in case = of warnings/errors
+  --summary-file   = ;          include the file= name in summary
+  --debug KEY=3D[0|1]  &nb= sp;       turn on/off debugging of KEY, wh= ere KEY is one of
+      &nb= sp;           &nb= sp;          'values', 'pos= sible', 'type', and 'attr' (default
+   &nb= sp;           &nb= sp;           &nb= sp; is all off)
+  --test-only=3DWORD  &nbs= p;        report only warnings/errors= containing WORD
+      &nbs= p;           &nbs= p;          literally
+  --color[=3DWHEN]      &nb= sp;      Use colors 'always', 'never', or only = when output
+       &nb= sp;           &nb= sp;         is a terminal ('auto= '). Default is 'auto'.
+  -h, --help, --version =      display this help and exit
+
<= /div>
+When FILE is - read standard input.
+EOM
+
+ exit($exitcode);
+}
+
+# Use at your own risk
+print "\n", MAG= ENTA, "WARNING:", RESET, " This code is highly experimental ... likely i= sn't a great style(9) match yet\n\n";
+
+# P= erl's Getopt::Long allows options to take optional arguments after a spa= ce.
+# Prevent --color by itself from consuming other argu= ments
+foreach (@ARGV) {
+ if ($_ eq "--colo= r" || $_ eq "-color") {
+ $_ =3D "--color=3D$color";
<= /div>
+ }
+}
+
+GetOptions= (
+ 'q|quiet+' =3D> \$quiet,
+ 'tree!' =3D= > \$tree,
+ 'signoff!' =3D> \$chk_signoff,
=
+ 'patch!' =3D> \$chk_patch,
+ 'branch!' =3D> \= $chk_branch,
+ 'emacs!' =3D> \$emacs,
+ '= terse!' =3D> \$terse,
+ 'f|file!' =3D> \$file,
+ 'strict!' =3D> \$no_warnings,
+ 'root=3Ds' =3D= > \$root,
+ 'summary!' =3D> \$summary,
+ 'mailback!' =3D> \$mailback,
+ 'summary-file!' =3D&g= t; \$summary_file,
+
+ 'debug=3Ds' =3D> \= %debug,
+ 'test-only=3Ds' =3D> \$tst_only,
+ 'color=3Ds'       =3D> \$color,
=
+ 'no-color'      =3D> sub { $col= or =3D 'never'; },
+ 'h|help' =3D> \$help,
+ 'version' =3D> \$help
+) or help(1);
= +
+help(0) if ($help);
+
+my $= exit =3D 0;
+
+if ($#ARGV < 0) {
+ print "$P: no input files\n";
+ exit(1);
=
+}
+
+if (!defined $chk_branch &&am= p; !defined $chk_patch && !defined $file) {
+ $chk= _branch =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0;
+ $file =3D $AR= GV[0] =3D~ /$SrcFile/ ? 1 : 0;
+ $chk_patch =3D $chk_branc= h || $file ? 0 : 1;
+} elsif (!defined $chk_branch &&a= mp; !defined $chk_patch) {
+ if ($file) {
+ = $chk_branch =3D $chk_patch =3D 0;
+ } else {
+ $chk_branch =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0;
+ $ch= k_patch =3D $chk_branch ? 0 : 1;
+ }
+} elsi= f (!defined $chk_branch && !defined $file) {
+ if = ($chk_patch) {
+ $chk_branch =3D $file =3D 0;
+ } else {
+ $chk_branch =3D $ARGV[0] =3D~ /.\.\./ ? 1= : 0;
+ $file =3D $chk_branch ? 0 : 1;
+ }<= br>
+} elsif (!defined $chk_patch && !defined $file) {=
+ if ($chk_branch) {
+ $chk_patch =3D $fil= e =3D 0;
+ } else {
+ $file =3D $ARGV[0] =3D= ~ /$SrcFile/ ? 1 : 0;
+ $chk_patch =3D $file ? 0 : 1;
=
+ }
+} elsif (!defined $chk_branch) {
=
+ $chk_branch =3D $chk_patch || $file ? 0 : 1;
+} els= if (!defined $chk_patch) {
+ $chk_patch =3D $chk_branch ||= $file ? 0 : 1;
+} elsif (!defined $file) {
= + $file =3D $chk_patch || $chk_branch ? 0 : 1;
+}
+
+if (($chk_patch && $chk_branch) ||
+    ($chk_patch && $file) ||
+    ($chk_branch && $file)) {
+= die "Only one of --file, --branch, --patch is permitted\n";
+}
+if (!$chk_patch && !$chk_branch && = !$file) {
+ die "One of --file, --branch, --patch is requi= red\n";
+}
+
+if ($color =3D~ = /^always$/i) {
+ $color =3D 1;
+} elsif ($co= lor =3D~ /^never$/i) {
+ $color =3D 0;
+} el= sif ($color =3D~ /^auto$/i) {
+ $color =3D (-t STDOUT);
+} else {
+ die "Invalid color mode: $color\n"= ;
+}
+
+my $dbg_values =3D 0;<= br>
+my $dbg_possible =3D 0;
+my $dbg_type =3D 0= ;
+my $dbg_attr =3D 0;
+my $dbg_adv_dcs =3D = 0;
+my $dbg_adv_checking =3D 0;
+my $dbg_adv= _apw =3D 0;
+for my $key (keys %debug) {
+ #= # no critic
+ eval "\${dbg_$key} =3D '$debug{$key}';";
=
+ die "$@" if ($@);
+}
+
+my $rpt_cleaners =3D 0;
+
+if ($terse= ) {
+ $emacs =3D 1;
+ $quiet++;
+}
+
+my $emitted_corrupt =3D 0;
=
+
+our $Ident =3D qr{
+ [A-Za-z_][A-Z= a-z\d_]*
+ (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
+ }x;
+our $Storage =3D qr{extern|static|asmlinkage= };
+our $Sparse =3D qr{
+ __force
+ }x;
+
+# Notes to $Attribute:
+our $Attribute =3D qr{
+ const|
= + volatile|
+ QEMU_NORETURN|
+ QEMU_WA= RN_UNUSED_RESULT|
+ QEMU_SENTINEL|
+ QEM= U_PACKED|
+ GCC_FMT_ATTR
+   }x;
=
+our $Modifier;
+our $Inline =3D qr{inline};
+our $Member =3D qr{->$Ident|\.$Ident|\[[^]]*\]};
+our $Lval =3D qr{$Ident(?:$Member)*};
+
<= div>+our $Constant =3D qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*};
+our $Assignment =3D qr{(?:\*\=3D|/=3D|%=3D|\+=3D|-=3D|<<=3D|>= >=3D|&=3D|\^=3D|\|=3D|=3D)};
+our $Compare &nb= sp;  =3D qr{<=3D|>=3D|=3D=3D|!=3D|<|>};
+= our $Operators =3D qr{
+ <=3D|>=3D|=3D=3D|!=3D|
+ =3D>|->|<<|>>|<|>|!|~|
=
+ &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%
+   }x;
+
+our $NonptrType;
+our $Type;
+our $Declare;
+
=
+our $NON_ASCII_UTF8 =3D qr{
+ [\xC2-\xDF][\x80-\xBF]=             =    # non-overlong 2-byte
+ |  \xE0[\xA0-\xB= F][\x80-\xBF]        # excluding over= longs
+ | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straig= ht 3-byte
+ |  \xED[\x80-\x9F][\x80-\xBF]  =       # excluding surrogates
+ |&= nbsp; \xF0[\x90-\xBF][\x80-\xBF]{2}     # planes 1-3=
+ | [\xF1-\xF3][\x80-\xBF]{3}    &nbs= p;     # planes 4-15
+ |  \xF4[\x= 80-\x8F][\x80-\xBF]{2}     # plane 16
= +}x;
+
+our $UTF8 =3D qr{
+ [\= x09\x0A\x0D\x20-\x7E]        &nb= sp;     # ASCII
+ | $NON_ASCII_UTF8
+}x;
+
+# some readers default t= o ISO-8859-1 when showing email source. detect
+# when UTF= -8 is incorrectly interpreted as ISO-8859-1 and reencoded back.
+# False positives are possible but very unlikely.
+= our $UTF8_MOJIBAKE =3D qr{
+ \xC3[\x82-\x9F] \xC2[\x80-\xB= F]           &nbs= p;        # c2-df 80-bf
+ | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF]    &nb= sp;    # e0 a0-bf 80-bf
+ | \xC3[\xA1-\xAC\= xAE\xAF] (?: \xC2[\x80-\xBF]){2}  # e1-ec/ee/ef 80-bf 80-bf
+ | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF]   &nb= sp;     # ed 80-9f 80-bf
+ | \xC3\xB0 = \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-bf
=
+ | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3}    =       # f1-f3 80-bf 80-bf 80-bf
+= | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf 80-= bf
+}x;
+
+# There are still s= ome false positives, but this catches most
+# common cases= .
+our $typeTypedefs =3D qr{(?x:
+ &nbs= p;      (?![KMGTPE]iB)    &= nbsp;           &= nbsp;     # IEC binary prefix (do not match)
+        [A-Z][A-Z\d_]*[a-z][A= -Za-z\d_]*     # camelcase
+ &nbs= p;      | [A-Z][A-Z\d_]*AIOCB   =             # all= uppercase
+        | [= A-Z][A-Z\d_]*CPU         &n= bsp;       # all uppercase
+=         | QEMUBH   &nb= sp;           &nb= sp;            # = all uppercase
+)};
+
+our @typ= eList =3D (
+ qr{void},
+ qr{(?:unsigned\s+)= ?char},
+ qr{(?:unsigned\s+)?short},
+ qr{(?= :unsigned\s+)?int},
+ qr{(?:unsigned\s+)?long},
<= div>+ qr{(?:unsigned\s+)?long\s+int},
+ qr{(?:unsigned\s+)= ?long\s+long},
+ qr{(?:unsigned\s+)?long\s+long\s+int},
+ qr{unsigned},
+ qr{float},
+ q= r{double},
+ qr{bool},
+ qr{struct\s+$Ident}= ,
+ qr{union\s+$Ident},
+ qr{enum\s+$Ident},=
+ qr{${Ident}_t},
+ qr{${Ident}_handler},
+ qr{${Ident}_handler_fn},
+ qr{target_(?:u)?= long},
+ qr{hwaddr},
+);
+
=
+# This can be modified by sub possible.  Since it can b= e empty, be careful
+# about regexes that always match, be= cause they can cause infinite loops.
+our @modifierList =3D= (
+);
+
+sub build_types {
+ my $all =3D "(?x:  \n" . join("|\n  ", @typeList= ) . "\n)";
+ if (@modifierList > 0) {
+ = my $mods =3D "(?x:  \n" . join("|\n  ", @modifierList) . "\n)"= ;
+ $Modifier =3D qr{(?:$Attribute|$Sparse|$mods)};
+ } else {
+ $Modifier =3D qr{(?:$Attribute|$Spa= rse)};
+ }
+ $NonptrType =3D qr{
+ (?:$Modifier\s+|const\s+)*
+ (?:
+ = (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)|
+ (?= :$typeTypedefs\b)|
+ (?:${all}\b)
+ )
+ (?:\s+$Modifier|\s+const)*
+   }x;<= br>
+ $Type =3D qr{
+ $NonptrType
+ (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)?
+ (?:= \s+$Inline|\s+$Modifier)*
+   }x;
+ $D= eclare =3D qr{(?:$Storage\s+)?$Type};
+}
+bu= ild_types();
+
+$chk_signoff =3D 0 if ($file= );
+
+my @rawlines =3D ();
+my= @lines =3D ();
+my $vname;
+if ($chk_branch= ) {
+ my @patches;
+ my %git_commits =3D ();=
+ my $HASH;
+ open($HASH, "-|", "git", "log= ", "--reverse", "--no-merges", "--format=3D%H %s", $ARGV[0]) ||
+ die "$P: git log --reverse --no-merges --format=3D'%H %s' $ARGV= [0] failed - $!\n";
+
+ for my $line (<$H= ASH>) {
+ $line =3D~ /^([0-9a-fA-F]{40,40}) (.*)$/;
+ next if (!defined($1) || !defined($2));
+ = my $sha1 =3D $1;
+ my $subject =3D $2;
+ p= ush(@patches, $sha1);
+ $git_commits{$sha1} =3D $subject;=
+ }
+
+ close $HASH;
+
+ die "$P: no revisions returned for revlist '$ARG= V[0]'\n"
+     unless @patches;
+
+ my $i =3D 1;
+ my $num_patches =3D @p= atches;
+ for my $hash (@patches) {
+ my $F= ILE;
+ open($FILE, '-|', "git", "show", "--patch-with-sta= t", $hash) ||
+ die "$P: git show $hash - $!\n";
+ while (<$FILE>) {
+ chomp;
+ push(@rawlines, $_);
+ }
+ close($FIL= E);
+ $vname =3D substr($hash, 0, 12) . ' (' . $git_commi= ts{$hash} . ')';
+ if ($num_patches > 1 && $qu= iet =3D=3D 0) {
+ my $prefix =3D "$i/$num_patches";
<= /div>
+ $prefix =3D BLUE . BOLD . $prefix . RESET if $color;
+ print "$prefix Checking commit $vname\n";
+ = $vname =3D "Patch $i/$num_patches";
+ } else {
=
+ $vname =3D "Commit " . $vname;
+ }
+ if (!process($hash)) {
+ $exit =3D 1;
= + print "\n" if ($num_patches > 1 && $quiet =3D=3D 0);
<= /div>
+ }
+ @rawlines =3D ();
+ @line= s =3D ();
+ $i++;
+ }
+} else= {
+ for my $filename (@ARGV) {
+ my $FILE;=
+ if ($file) {
+ open($FILE, '-|', "diff= -u /dev/null $filename") ||
+ die "$P: $filename: diff= failed - $!\n";
+ } elsif ($filename eq '-') {
=
+ open($FILE, '<&STDIN');
+ } else {
+ open($FILE, '<', "$filename") ||
+ die "= $P: $filename: open failed - $!\n";
+ }
+ = if ($filename eq '-') {
+ $vname =3D 'Your patch';
+ } else {
+ $vname =3D $filename;
+ }
+ print "Checking $filename...\n" if @ARGV > 1= && $quiet =3D=3D 0;
+ while (<$FILE>) {
+ chomp;
+ push(@rawlines, $_);
<= div>+ }
+ close($FILE);
+ if (!process($f= ilename)) {
+ $exit =3D 1;
+ }
<= div>+ @rawlines =3D ();
+ @lines =3D ();
+= }
+}
+
+exit($exit);
+
+sub top_of_kernel_tree {
+ my ($roo= t) =3D @_;
+
+ my @tree_check =3D (
+     "Makefile.inc1", "README.md", "sys",
+     "usr.sbin"
+ );
+=
+ foreach my $check (@tree_check) {
+ if (= ! -e $root . '/' . $check) {
+ return 0;
+= }
+ }
+ return 1;
+}
+
+sub expand_tabs {
+ my ($str) =3D = @_;
+
+ my $res =3D '';
+ my $= n =3D 0;
+ for my $c (split(//, $str)) {
+ = if ($c eq "\t") {
+ $res .=3D ' ';
+ $n+= +;
+ for (; ($n % 8) !=3D 0; $n++) {
+ = $res .=3D ' ';
+ }
+ next;
+ }
+ $res .=3D $c;
+ $n++;
+ }
+
+ return $res;
+}
<= /div>
+sub copy_spacing {
+ (my $res =3D shift) =3D~ t= r/\t/ /c;
+ return $res;
+}
+<= br>
+sub line_stats {
+ my ($line) =3D @_;
+
+ # Drop the diff line leader and expand tabs
+ $line =3D~ s/^.//;
+ $line =3D expand_tabs(= $line);
+
+ # Pick the indent from the front= of the line.
+ my ($white) =3D ($line =3D~ /^(\s*)/);
=
+
+ return (length($line), length($white));
=
+}
+
+my $sanitise_quote =3D '';<= br>
+
+sub sanitise_line_reset {
+= my ($in_comment) =3D @_;
+
+ if ($in_commen= t) {
+ $sanitise_quote =3D '*/';
+ } else {=
+ $sanitise_quote =3D '';
+ }
+}
+sub sanitise_line {
+ my ($line) =3D @= _;
+
+ my $res =3D '';
+ my $l= =3D '';
+
+ my $qlen =3D 0;
+= my $off =3D 0;
+ my $c;
+
+ #= Always copy over the diff marker.
+ $res =3D substr($line= , 0, 1);
+
+ for ($off =3D 1; $off < leng= th($line); $off++) {
+ $c =3D substr($line, $off, 1);
=
+
+ # Comments we are wacking completely inclu= ding the begin
+ # and end, all to $;.
+ i= f ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') {
+ $sanitise_quote =3D '*/';
+
= + substr($res, $off, 2, "$;$;");
+ $off++;
+ next;
+ }
+ if ($sanitise_quote eq = '*/' && substr($line, $off, 2) eq '*/') {
+ $san= itise_quote =3D '';
+ substr($res, $off, 2, "$;$;");
=
+ $off++;
+ next;
+ }
+ if ($sanitise_quote eq '' && substr($line, $off, 2) e= q '//') {
+ $sanitise_quote =3D '//';
+
+ substr($res, $off, 2, $sanitise_quote);
+ = $off++;
+ next;
+ }
+
=
+ # A \ in a string means ignore the next character.
+ if (($sanitise_quote eq "'" || $sanitise_quote eq '"') &&a= mp;
+     $c eq "\\") {
+ = substr($res, $off, 2, 'XX');
+ $off++;
+ = next;
+ }
+ # Regular quotes.
+ if ($c eq "'" || $c eq '"') {
+ if ($sanitise_quot= e eq '') {
+ $sanitise_quote =3D $c;
+
+ substr($res, $off, 1, $c);
+ next;
=
+ } elsif ($sanitise_quote eq $c) {
+ $san= itise_quote =3D '';
+ }
+ }
+
+ #print "c<$c> SQ<$sanitise_quote>\n";
+ if ($off !=3D 0 && $sanitise_quote eq '*/' &&= amp; $c ne "\t") {
+ substr($res, $off, 1, $;);
+ } elsif ($off !=3D 0 && $sanitise_quote eq '//' &&a= mp; $c ne "\t") {
+ substr($res, $off, 1, $;);
=
+ } elsif ($off !=3D 0 && $sanitise_quote && $c ne= "\t") {
+ substr($res, $off, 1, 'X');
+ = } else {
+ substr($res, $off, 1, $c);
+ }=
+ }
+
+ if ($sanitise_quote e= q '//') {
+ $sanitise_quote =3D '';
+ }
=
+
+ # The pathname on a #include may be surroun= ded by '<' and '>'.
+ if ($res =3D~ /^.\s*\#\s*inclu= de\s+\<(.*)\>/) {
+ my $clean =3D 'X' x length($1);=
+ $res =3D~ s@\<.*\>@<$clean>@;
+
+ # The whole of a #error is a string.
+= } elsif ($res =3D~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
<= div>+ my $clean =3D 'X' x length($1);
+ $res =3D~ s@(\#\= s*(?:error|warning)\s+).*@$1$clean@;
+ }
+
+ return $res;
+}
+
+sub ctx_statement_block {
+ my ($linenr, $remain, $off= ) =3D @_;
+ my $line =3D $linenr - 1;
+ my $= blk =3D '';
+ my $soff =3D $off;
+ my $coff = =3D $off - 1;
+ my $coff_set =3D 0;
+
+ my $loff =3D 0;
+
+ my $type =3D '= ';
+ my $level =3D 0;
+ my @stack =3D ();
+ my $p;
+ my $c;
+ my $len =3D = 0;
+
+ my $remainder;
+ while = (1) {
+ @stack =3D (['', 0]) if ($#stack =3D=3D -1);
<= /div>
+
+ #warn "CSB: blk<$blk> remain<$rema= in>\n";
+ # If we are about to drop off the end, pull = in more
+ # context.
+ if ($off >=3D $l= en) {
+ for (; $remain > 0; $line++) {
= + last if (!defined $lines[$line]);
+ next if ($line= s[$line] =3D~ /^-/);
+ $remain--;
+ $l= off =3D $len;
+ $blk .=3D $lines[$line] . "\n";
+ $len =3D length($blk);
+ $line++;
=
+ last;
+ }
+ # Bail if there is= no further context.
+ #warn "CSB: blk<$blk> off&l= t;$off> len<$len>\n";
+ if ($off >=3D $len) = {
+ last;
+ }
+ }
+ $p =3D $c;
+ $c =3D substr($blk, $off, 1);
=
+ $remainder =3D substr($blk, $off);
+
+ #warn "CSB: c<$c> type<$type> level<$level> = remainder<$remainder> coff_set<$coff_set>\n";
= +
+ # Handle nested #if/#else.
+ if ($rema= inder =3D~ /^#\s*(?:ifndef|ifdef|if)\s/) {
+ push(@stack= , [ $type, $level ]);
+ } elsif ($remainder =3D~ /^#\s*(?= :else|elif)\b/) {
+ ($type, $level) =3D @{$stack[$#stack= - 1]};
+ } elsif ($remainder =3D~ /^#\s*endif\b/) {
<= /div>
+ ($type, $level) =3D @{pop(@stack)};
+ }
=
+
+ # Statement ends at the ';' or a close '}'= at the
+ # outermost level.
+ if ($level = =3D=3D 0 && $c eq ';') {
+ last;
+= }
+
+ # An else is really a conditional a= s long as its not else if
+ if ($level =3D=3D 0 &&= ; $coff_set =3D=3D 0 &&
+ (!defined($p) || $p =3D= ~ /(?:\s|\}|\+)/) &&
+ $remainder =3D~ /^(else)= (?:\s|{)/ &&
+ $remainder !~ /^else\s+if\b/) {<= br>
+ $coff =3D $off + length($1) - 1;
+ $co= ff_set =3D 1;
+ #warn "CSB: mark coff<$coff> soff&= lt;$soff> 1<$1>\n";
+ #warn "[" . substr($blk, = $soff, $coff - $soff + 1) . "]\n";
+ }
+
+ if (($type eq '' || $type eq '(') && $c eq '(') {=
+ $level++;
+ $type =3D '(';
<= div>+ }
+ if ($type eq '(' && $c eq ')') {
+ $level--;
+ $type =3D ($level !=3D 0)? '(' = : '';
+
+ if ($level =3D=3D 0 && $= coff < $soff) {
+ $coff =3D $off;
+ = $coff_set =3D 1;
+ #warn "CSB: mark coff<$coff>\= n";
+ }
+ }
+ if (($type e= q '' || $type eq '{') && $c eq '{') {
+ $level++= ;
+ $type =3D '{';
+ }
+ i= f ($type eq '{' && $c eq '}') {
+ $level--;
<= /div>
+ $type =3D ($level !=3D 0)? '{' : '';
+
+ if ($level =3D=3D 0) {
+ if (substr($blk, = $off + 1, 1) eq ';') {
+ $off++;
+ }<= br>
+ last;
+ }
+ }
+ $off++;
+ }
+ # We are truly at the= end, so shuffle to the next line.
+ if ($off =3D=3D $len)= {
+ $loff =3D $len + 1;
+ $line++;
+ $remain--;
+ }
+
+ = my $statement =3D substr($blk, $soff, $off - $soff + 1);
+= my $condition =3D substr($blk, $soff, $coff - $soff + 1);
+
+ #warn "STATEMENT<$statement>\n";
= + #warn "CONDITION<$condition>\n";
+
+= #print "coff<$coff> soff<$off> loff<$loff>\n";
+
+ return ($statement, $condition,
= + $line, $remain + 1, $off - $loff + 1, $level);
+}
<= /div>
+
+sub statement_lines {
+ my ($st= mt) =3D @_;
+
+ # Strip the diff line prefix= es and rip blank lines at start and end.
+ $stmt =3D~ s/(^= |\n)./$1/g;
+ $stmt =3D~ s/^\s*//;
+ $stmt =3D= ~ s/\s*$//;
+
+ my @stmt_lines =3D ($stmt =3D= ~ /\n/g);
+
+ return $#stmt_lines + 2;
+}
+
+sub statement_rawlines {
<= /div>
+ my ($stmt) =3D @_;
+
+ my @stmt_= lines =3D ($stmt =3D~ /\n/g);
+
+ return $#s= tmt_lines + 2;
+}
+
+sub state= ment_block_size {
+ my ($stmt) =3D @_;
+
=
+ $stmt =3D~ s/(^|\n)./$1/g;
+ $stmt =3D~ s/^\s= *\{//;
+ $stmt =3D~ s/}\s*$//;
+ $stmt =3D~ = s/^\s*//;
+ $stmt =3D~ s/\s*$//;
+
=
+ my @stmt_lines =3D ($stmt =3D~ /\n/g);
+ my @stmt_s= tatements =3D ($stmt =3D~ /;/g);
+
+ my $stm= t_lines =3D $#stmt_lines + 2;
+ my $stmt_statements =3D $#= stmt_statements + 1;
+
+ if ($stmt_lines >= ; $stmt_statements) {
+ return $stmt_lines;
+ } else {
+ return $stmt_statements;
+ }<= br>
+}
+
+sub ctx_statement_full {=
+ my ($linenr, $remain, $off) =3D @_;
+ my = ($statement, $condition, $level);
+
+ my (@c= hunks);
+
+ # Grab the first conditional/blo= ck pair.
+ ($statement, $condition, $linenr, $remain, $off= , $level) =3D
+ ctx_statement_block($linenr, $remain, $= off);
+ #print "F: c<$condition> s<$statement>= remain<$remain>\n";
+ push(@chunks, [ $condition, $= statement ]);
+ if (!($remain > 0 && $condition= =3D~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
+ return = ($level, $linenr, @chunks);
+ }
+
<= div>+ # Pull in the following conditional/block pairs and see if they
+ # could continue the statement.
+ for (;;) {=
+ ($statement, $condition, $linenr, $remain, $off, $leve= l) =3D
+ ctx_statement_block($linenr, $remain, $off);
+ #print "C: c<$condition> s<$statement> remai= n<$remain>\n";
+ last if (!($remain > 0 &&am= p; $condition =3D~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
+= #print "C: push\n";
+ push(@chunks, [ $condition, $stat= ement ]);
+ }
+
+ return ($lev= el, $linenr, @chunks);
+}
+
+s= ub ctx_block_get {
+ my ($linenr, $remain, $outer, $open, = $close, $off) =3D @_;
+ my $line;
+ my $star= t =3D $linenr - 1;
+ my $blk =3D '';
+ my @o= ;
+ my @c;
+ my @res =3D ();
+=
+ my $level =3D 0;
+ my @stack =3D ($level)= ;
+ for ($line =3D $start; $remain > 0; $line++) {
<= /div>
+ next if ($rawlines[$line] =3D~ /^-/);
+ $rem= ain--;
+
+ $blk .=3D $rawlines[$line];
<= /div>
+
+ # Handle nested #if/#else.
+ = if ($lines[$line] =3D~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) {
+ push(@stack, $level);
+ } elsif ($lines[$line] =3D~= /^.\s*#\s*(?:else|elif)\b/) {
+ $level =3D $stack[$#sta= ck - 1];
+ } elsif ($lines[$line] =3D~ /^.\s*#\s*endif\b/= ) {
+ $level =3D pop(@stack);
+ }
+
+ foreach my $c (split(//, $lines[$line])) {
=
+ ##print "C<$c>L<$level><$open$close>O&l= t;$off>\n";
+ if ($off > 0) {
+ $= off--;
+ next;
+ }
+
<= /div>
+ if ($c eq $close && $level > 0) {
+ $level--;
+ last if ($level =3D=3D 0);
<= div>+ } elsif ($c eq $open) {
+ $level++;
+ }
+ }
+
+ if (!$outer= || $level <=3D 1) {
+ push(@res, $rawlines[$line]);<= br>
+ }
+
+ last if ($level =3D=3D= 0);
+ }
+
+ return ($level, @= res);
+}
+sub ctx_block_outer {
+ my ($linenr, $remain) =3D @_;
+
+ my ($l= evel, @r) =3D ctx_block_get($linenr, $remain, 1, '{', '}', 0);
=
+ return @r;
+}
+sub ctx_block {
+ my ($linenr, $remain) =3D @_;
+
+ = my ($level, @r) =3D ctx_block_get($linenr, $remain, 0, '{', '}', 0);
=
+ return @r;
+}
+sub ctx_statemen= t {
+ my ($linenr, $remain, $off) =3D @_;
+<= br>
+ my ($level, @r) =3D ctx_block_get($linenr, $remain, 0, '= (', ')', $off);
+ return @r;
+}
+sub ctx_block_level {
+ my ($linenr, $remain) =3D @_;
+
+ return ctx_block_get($linenr, $remain, 0,= '{', '}', 0);
+}
+sub ctx_statement_level {=
+ my ($linenr, $remain, $off) =3D @_;
+
=
+ return ctx_block_get($linenr, $remain, 0, '(', ')', $off);<= br>
+}
+
+sub ctx_locate_comment {=
+ my ($first_line, $end_line) =3D @_;
+
=
+ # Catch a comment on the end of the line itself.
<= div>+ my ($current_comment) =3D ($rawlines[$end_line - 1] =3D~ m@.*(/\*.= *\*/)\s*(?:\\\s*)?$@);
+ return $current_comment if (defin= ed $current_comment);
+
+ # Look through the= context and try and figure out if there is a
+ # comment.=
+ my $in_comment =3D 0;
+ $current_comment = =3D '';
+ for (my $linenr =3D $first_line; $linenr < $e= nd_line; $linenr++) {
+ my $line =3D $rawlines[$linenr - = 1];
+ #warn "       &n= bsp;   $line\n";
+ if ($linenr =3D=3D $first_li= ne and $line =3D~ m@^.\s*\*@) {
+ $in_comment =3D 1;
=
+ }
+ if ($line =3D~ m@/\*@) {
= + $in_comment =3D 1;
+ }
+ if (!$in_comm= ent && $current_comment ne '') {
+ $current_comm= ent =3D '';
+ }
+ $current_comment .=3D $l= ine . "\n" if ($in_comment);
+ if ($line =3D~ m@\*/@) {
+ $in_comment =3D 0;
+ }
+ }=
+
+ chomp($current_comment);
= + return($current_comment);
+}
+sub ctx_has_= comment {
+ my ($first_line, $end_line) =3D @_;
<= div>+ my $cmt =3D ctx_locate_comment($first_line, $end_line);
<= div>+
+ ##print "LINE: $rawlines[$end_line - 1 ]\n";
+ ##print "CMMT: $cmt\n";
+
+ retur= n ($cmt ne '');
+}
+
+sub raw_= line {
+ my ($linenr, $cnt) =3D @_;
+
+ my $offset =3D $linenr - 1;
+ $cnt++;
<= div>+
+ my $line;
+ while ($cnt) {
=
+ $line =3D $rawlines[$offset++];
+ next if (define= d($line) && $line =3D~ /^-/);
+ $cnt--;
=
+ }
+
+ return $line;
+}<= br>
+
+sub cat_vet {
+ my ($vet) =3D= @_;
+ my ($res, $coded);
+
+ = $res =3D '';
+ while ($vet =3D~ /([^[:cntrl:]]*)([[:cntrl:= ]]|$)/g) {
+ $res .=3D $1;
+ if ($2 ne '')= {
+ $coded =3D sprintf("^%c", unpack('C', $2) + 64);
+ $res .=3D $coded;
+ }
+ }
+ $res =3D~ s/$/\$/;
+
+ return= $res;
+}
+
+my $av_preprocess= or =3D 0;
+my $av_pending;
+my @av_paren_typ= e;
+my $av_pend_colon;
+
+sub = annotate_reset {
+ $av_preprocessor =3D 0;
+= $av_pending =3D '_';
+ @av_paren_type =3D ('E');
+ $av_pend_colon =3D 'O';
+}
+
+sub annotate_values {
+ my ($stream, $type) =3D @_= ;
+
+ my $res;
+ my $var =3D '= _' x length($stream);
+ my $cur =3D $stream;
+
+ print "$stream\n" if ($dbg_values > 1);
<= div>+
+ while (length($cur)) {
+ @av_paren_= type =3D ('E') if ($#av_paren_type < 0);
+ print " <= ;" . join('', @av_paren_type) .
+ "> <$type> &= lt;$av_pending>" if ($dbg_values > 1);
+ if ($cur =3D= ~ /^(\s+)/o) {
+ print "WS($1)\n" if ($dbg_values > 1= );
+ if ($1 =3D~ /\n/ && $av_preprocessor) {
=
+ $type =3D pop(@av_paren_type);
+ $av_pr= eprocessor =3D 0;
+ }
+
+ }= elsif ($cur =3D~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {<= br>
+ print "CAST($1)\n" if ($dbg_values > 1);
<= div>+ push(@av_paren_type, $type);
+ $type =3D 'C';
+
+ } elsif ($cur =3D~ /^($Type)\s*(?:$Ident|= ,|\)|\(|\s*$)/) {
+ print "DECLARE($1)\n" if ($dbg_value= s > 1);
+ $type =3D 'T';
+
+ } elsif ($cur =3D~ /^($Modifier)\s*/) {
+ print "MO= DIFIER($1)\n" if ($dbg_values > 1);
+ $type =3D 'T';<= br>
+
+ } elsif ($cur =3D~ /^(\#\s*define\s*$Id= ent)(\(?)/o) {
+ print "DEFINE($1,$2)\n" if ($dbg_values= > 1);
*** 1791 LINES SKIPPED ***


--d2b24846419d49c4ab1b06d629e431e9-- From nobody Sat Mar 25 17:32:37 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkR3p0Qwzz41Tfn; Sat, 25 Mar 2023 17:32: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 4PkR3n5HhCz4MXF; Sat, 25 Mar 2023 17:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679765557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TMJc4QL1hdOADwnDEHQ9xZFp/Aozqt9lTt050lY12TU=; b=TwbNMbqT7vD6FVmyx5r095X9cnN3bwLZ8AOQ/MW5yN5XjtZHc0EzA+Kk5jhtxqsibwqKCm QCcdD9g8cSW7IDJFyyA5FbYoqvFDLJcPOgIQvz+dSXzYIJLLgAcOtKCmRd/3l17YUeuoNE bl4PmRff9Ezpd7AACir44xrwiD2T8oeIrDEZEEa+bu4BgUyWKbDFdYVihWQySWAy2sipPL yMQanCEf19Q6SR+gQerMrevG9eIGkZbgXrqhZHXDhURw/T/gw9m9KwQaxJ2+/LNazgv+pX NGTfARXz/by7b2n/t576DkWThdNsSysBtugUFq4+ZiBG4iFq3wTMtStk/fdGlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679765557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TMJc4QL1hdOADwnDEHQ9xZFp/Aozqt9lTt050lY12TU=; b=FeHhBOQ4ri3eZqJJ5GxQvf0criXq/3dmis5c1zUF0FuTBYImWx3d/IaZ3iWE0keKpF18YV QQU/SBtLDnoemMA5y9CcDCeDc2oFijhfRet/HrOSYlLSUcmfGbUwTfHrd65vLZf9QgL+0t RdrePrGAjKTBZvI4zkgcZUCO3g+TpNW4UaU2HG2x3l+qtae1jxfMfcs1n/H5fLTIMEoIWP mX1E/FuGy4rSLGaF/XafKh1Kz06fBVs5ec5F8SXnAo//VtewfGMInsfQ2JYT89/YWO6MvB Eo6VXtNEQZZf6AabDXi42SsHxIqgWH8Q0uKWV3sgJAhL/IoPwLnTUcpiDJHt1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679765557; a=rsa-sha256; cv=none; b=BocRe5NdDhxENrSllvjlXrl0hIC2fpK1+CMk7HTUnhQMIrXHxTWcHaptc2emR38cxF3V0y t4jR4942Dr4qKfxJdtoqiF3kDmGZjZ47RM6qFBX+KnSGnmqyaDBOJ/cWOrk9toWbV3scWG SiFf+evEAGSj8PREGIm3Rnm1kYLVWx0/f9ohk0lo2dUgoQCNKo/nLu8Ru9TaHhmmetI9NB 5uCMFrJlDLDqF+rTx42UwqwaaOU9l4XQZwmR92QBgZmVdoAGDK3n9E/brJh5bsETft4z8+ J2lACFJUR/8NFHyKQgVXPd4eRBIOMiUO1brHSNN+P6vz2Z/CE7vkdb2S4uxacg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkR3n4NhYz172Z; Sat, 25 Mar 2023 17:32: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 32PHWbNT027555; Sat, 25 Mar 2023 17:32:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PHWbuR027554; Sat, 25 Mar 2023 17:32:37 GMT (envelope-from git) Date: Sat, 25 Mar 2023 17:32:37 GMT Message-Id: <202303251732.32PHWbuR027554@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: 9c43d5ca20d7 - main - CONTRIBUTING.md: Suggest using checkstyle9.pl List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c43d5ca20d71af5b0885ab2d70e8246f988bb06 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c43d5ca20d71af5b0885ab2d70e8246f988bb06 commit 9c43d5ca20d71af5b0885ab2d70e8246f988bb06 Author: Warner Losh AuthorDate: 2023-03-21 08:08:12 +0000 Commit: Warner Losh CommitDate: 2023-03-21 08:08:12 +0000 CONTRIBUTING.md: Suggest using checkstyle9.pl --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad221be66afc..8aedda5f4e69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,7 @@ A pull request will be considered if: * Fixup commits should be squashed with the commit they are fixing. Each commit in your branch should be suitable for FreeBSD's repository. * Commits should include one or more `Signed-off-by:` lines with full name and email address certifying [Developer Certificate of Origin](https://developercertificate.org/). * The commits follow FreeBSD's style guide. See [Style](#Style). +* Run tools/build/checkstlye9.pl on your git branch and eliminate all errors * The commits should not introduce trailing white space. * If the commmit fixes a bug, please add 'PR: ' to the comment message. * If there's a code review in phabricator, please include a link as a 'Differential Revision: ' line. From nobody Sat Mar 25 17:24:54 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkR3y1RCjz41Tfv for ; Sat, 25 Mar 2023 17:32:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PkR3x4mMXz4N4D for ; Sat, 25 Mar 2023 17:32:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x533.google.com with SMTP id y4so20055973edo.2 for ; Sat, 25 Mar 2023 10:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1679765564; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wKEkJPPYazbsf5iVeTiA5BWQwVqFs5GB8pjrV+t9v1M=; b=24ef7Houoz9FmUNBh+RPPGSs8w0GxGCskIMA/bfwQtRLBlImDn0STEPXBkUJw0NI+W e1T2mX/CNTTu1divt4K+BWYwpquQblnwxkxIF6G6Z4Rp3y2CO96Sn2Ie684la1GuGh+f ILwr+zZjqn6fPL7x8dvkNuaTuMoiUJxpkXW0vaWA+J6Sp8A8xN9QaMvOT5IDP+l1ilRQ YvFRQ8XcoNBH0/kAK7JAkj0nIiUCwtUzQcUd7jlYYl6Y3FITvqDokJ4V2P51gWr2FX71 d/WeEcDmF7o+AufVPQkEg7BgsLRmPutVDUyioHEuawiT/ETQ5rK9TTKy17zLw04rd+pU iKbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765564; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wKEkJPPYazbsf5iVeTiA5BWQwVqFs5GB8pjrV+t9v1M=; b=JXIVf+DTce9r2bNOHmrnj8TV36ShsqmddokkgeYOd697mj0CHEGpFTOp49Bg76M5ku I6MFqmvlPyOZtBXVTuPJmPEFNMvun6HUT7v+umQfhNgzRgkvDjq2xDTj06mdk3DhzVCG dnMitnfbojoYLWsunW4tb6JPB/3Ub0itGXsE5DetvDzJMwMG77bRcHpz5VCG/7YMoPLp 2GyqyuBGCeOownYV37KozyxWq49lez9Ul+mUy6RspPsqnXpARGh7dBn9ay97b9K5bSGo JLferL9D0fWWtYpFNndV48LqilNslXdGPXuHwiz9clZN56H/TsfMhsZWo7tYwcGrvhPh wOuQ== X-Gm-Message-State: AAQBX9dg3YaP7HDWRv5fhbIc31KFyr7qtB7VtOphDH12rN+H/DAjZ84q HCwCIcRTXOyEVrMfWEyRNa5s3IS93qnF4xWjf6sljvkp/PXf88eSofc= X-Google-Smtp-Source: AKy350attlIJkvLsFhRxpIxm+S/JhnIKU3/Bw3fXJ1hUiMJy1RvigavGSnV5gL0NNrNL+vVdM0NCalhOUw//BbHpRLs= X-Received: by 2002:a50:d68c:0:b0:4fb:80cf:898b with SMTP id r12-20020a50d68c000000b004fb80cf898bmr3087599edi.7.1679765105457; Sat, 25 Mar 2023 10:25:05 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202303251708.32PH8BUq079177@gitrepo.freebsd.org> <5b9c31d2-4aaf-4822-b405-cae57164f314@app.fastmail.com> In-Reply-To: <5b9c31d2-4aaf-4822-b405-cae57164f314@app.fastmail.com> From: Warner Losh Date: Sat, 25 Mar 2023 18:24:54 +0100 Message-ID: Subject: Re: git: 3a3c9242739e - main - checkstyle9.pl: Perl script to check if a change is approximately style(9) To: Drew Gallatin Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000006acd1f05f7bcca27" X-Rspamd-Queue-Id: 4PkR3x4mMXz4N4D X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000006acd1f05f7bcca27 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yea, I did most of the work on this 18 months ago or so, but the shit in core and subsequent nastiness derailed it til now. It's gotten to 'decent or better' at things, but far from perfect. I'm sure that now the bug reports will come. Warner On Sat, Mar 25, 2023 at 6:22=E2=80=AFPM Drew Gallatin wrote: > Thanks so much. I've wanted something like this *forever* > > On Sat, Mar 25, 2023, at 1:08 PM, Warner Losh wrote: > > The branch main has been updated by imp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D3a3c9242739efb0c76587ffbaa54c5d= 10b2cbcb4 > > commit 3a3c9242739efb0c76587ffbaa54c5d10b2cbcb4 > Author: Warner Losh > AuthorDate: 2023-03-14 21:28:05 +0000 > Commit: Warner Losh > CommitDate: 2023-03-25 17:06:13 +0000 > > checkstyle9.pl: Perl script to check if a change is approximately > style(9) > > This code is adapted from the QEMU checkpatch.pl script. It can check > either a patch, a file or a git branch. It tries to warn about things > that I believe might be style(9) violations. It's experimental, since= I > heavily hacked on the qemu version to get it to not complain (much) > about iconic code in the tree. At the moment, it's use should be > considered expermental. It will likely miss violations, and complain > about code that's perfectly fine. It's offered as an experiment > and to make it easier for contributors to submit patches. > --- > tools/build/checkstyle9.pl | 2748 > ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 2748 insertions(+) > > diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl > new file mode 100755 > index 000000000000..5aec3819bf7c > --- /dev/null > +++ b/tools/build/checkstyle9.pl > @@ -0,0 +1,2748 @@ > +#!/usr/bin/env perl > +# (c) 2001, Dave Jones. (the file handling bit) > +# (c) 2005, Joel Schopp (the ugly bit) > +# (c) 2007,2008, Andy Whitcroft (new conditions, test > suite) > +# (c) 2008-2010 Andy Whitcroft > +# Licensed under the terms of the GNU GPL License version 2 > + > +use strict; > +use warnings; > +use Term::ANSIColor qw(:constants); > + > +my $P =3D $0; > +$P =3D~ s@.*/@@g; > + > +our $SrcFile =3D qr{\.(?:h|c|cpp|s|S|pl|py|sh)$}; > + > +my $V =3D '0.31'; > + > +use Getopt::Long qw(:config no_auto_abbrev); > + > +my $quiet =3D 0; > +my $tree =3D 1; > +my $chk_signoff =3D 1; > +my $chk_patch =3D undef; > +my $chk_branch =3D undef; > +my $tst_only; > +my $emacs =3D 0; > +my $terse =3D 0; > +my $file =3D undef; > +my $color =3D "auto"; > +my $no_warnings =3D 0; > +my $summary =3D 1; > +my $mailback =3D 0; > +my $summary_file =3D 0; > +my $root; > +my %debug; > +my $help =3D 0; > + > +sub help { > + my ($exitcode) =3D @_; > + > + print << "EOM"; > +Usage: > + > + $P [OPTION]... [FILE]... > + $P [OPTION]... [GIT-REV-LIST] > + > +Version: $V > + > +Options: > + -q, --quiet quiet > + --patch treat FILE as patchfile > + --branch treat args as GIT revision list > + --emacs emacs compile window format > + --terse one line per report > + -f, --file treat FILE as regular source file > + --strict fail if only warnings are found > + --no-summary suppress the per-file summary > + --mailback only produce a report in case of > warnings/errors > + --summary-file include the filename in summary > + --debug KEY=3D[0|1] turn on/off debugging of KEY, where KEY i= s > one of > + 'values', 'possible', 'type', and 'attr' > (default > + is all off) > + --test-only=3DWORD report only warnings/errors containing WO= RD > + literally > + --color[=3DWHEN] Use colors 'always', 'never', or only whe= n > output > + is a terminal ('auto'). Default is 'auto'. > + -h, --help, --version display this help and exit > + > +When FILE is - read standard input. > +EOM > + > + exit($exitcode); > +} > + > +# Use at your own risk > +print "\n", MAGENTA, "WARNING:", RESET, " This code is highly > experimental ... likely isn't a great style(9) match yet\n\n"; > + > +# Perl's Getopt::Long allows options to take optional arguments after a > space. > +# Prevent --color by itself from consuming other arguments > +foreach (@ARGV) { > + if ($_ eq "--color" || $_ eq "-color") { > + $_ =3D "--color=3D$color"; > + } > +} > + > +GetOptions( > + 'q|quiet+' =3D> \$quiet, > + 'tree!' =3D> \$tree, > + 'signoff!' =3D> \$chk_signoff, > + 'patch!' =3D> \$chk_patch, > + 'branch!' =3D> \$chk_branch, > + 'emacs!' =3D> \$emacs, > + 'terse!' =3D> \$terse, > + 'f|file!' =3D> \$file, > + 'strict!' =3D> \$no_warnings, > + 'root=3Ds' =3D> \$root, > + 'summary!' =3D> \$summary, > + 'mailback!' =3D> \$mailback, > + 'summary-file!' =3D> \$summary_file, > + > + 'debug=3Ds' =3D> \%debug, > + 'test-only=3Ds' =3D> \$tst_only, > + 'color=3Ds' =3D> \$color, > + 'no-color' =3D> sub { $color =3D 'never'; }, > + 'h|help' =3D> \$help, > + 'version' =3D> \$help > +) or help(1); > + > +help(0) if ($help); > + > +my $exit =3D 0; > + > +if ($#ARGV < 0) { > + print "$P: no input files\n"; > + exit(1); > +} > + > +if (!defined $chk_branch && !defined $chk_patch && !defined $file) { > + $chk_branch =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0; > + $file =3D $ARGV[0] =3D~ /$SrcFile/ ? 1 : 0; > + $chk_patch =3D $chk_branch || $file ? 0 : 1; > +} elsif (!defined $chk_branch && !defined $chk_patch) { > + if ($file) { > + $chk_branch =3D $chk_patch =3D 0; > + } else { > + $chk_branch =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0; > + $chk_patch =3D $chk_branch ? 0 : 1; > + } > +} elsif (!defined $chk_branch && !defined $file) { > + if ($chk_patch) { > + $chk_branch =3D $file =3D 0; > + } else { > + $chk_branch =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0; > + $file =3D $chk_branch ? 0 : 1; > + } > +} elsif (!defined $chk_patch && !defined $file) { > + if ($chk_branch) { > + $chk_patch =3D $file =3D 0; > + } else { > + $file =3D $ARGV[0] =3D~ /$SrcFile/ ? 1 : 0; > + $chk_patch =3D $file ? 0 : 1; > + } > +} elsif (!defined $chk_branch) { > + $chk_branch =3D $chk_patch || $file ? 0 : 1; > +} elsif (!defined $chk_patch) { > + $chk_patch =3D $chk_branch || $file ? 0 : 1; > +} elsif (!defined $file) { > + $file =3D $chk_patch || $chk_branch ? 0 : 1; > +} > + > +if (($chk_patch && $chk_branch) || > + ($chk_patch && $file) || > + ($chk_branch && $file)) { > + die "Only one of --file, --branch, --patch is permitted\n"; > +} > +if (!$chk_patch && !$chk_branch && !$file) { > + die "One of --file, --branch, --patch is required\n"; > +} > + > +if ($color =3D~ /^always$/i) { > + $color =3D 1; > +} elsif ($color =3D~ /^never$/i) { > + $color =3D 0; > +} elsif ($color =3D~ /^auto$/i) { > + $color =3D (-t STDOUT); > +} else { > + die "Invalid color mode: $color\n"; > +} > + > +my $dbg_values =3D 0; > +my $dbg_possible =3D 0; > +my $dbg_type =3D 0; > +my $dbg_attr =3D 0; > +my $dbg_adv_dcs =3D 0; > +my $dbg_adv_checking =3D 0; > +my $dbg_adv_apw =3D 0; > +for my $key (keys %debug) { > + ## no critic > + eval "\${dbg_$key} =3D '$debug{$key}';"; > + die "$@" if ($@); > +} > + > +my $rpt_cleaners =3D 0; > + > +if ($terse) { > + $emacs =3D 1; > + $quiet++; > +} > + > +my $emitted_corrupt =3D 0; > + > +our $Ident =3D qr{ > + [A-Za-z_][A-Za-z\d_]* > + (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* > + }x; > +our $Storage =3D qr{extern|static|asmlinkage}; > +our $Sparse =3D qr{ > + __force > + }x; > + > +# Notes to $Attribute: > +our $Attribute =3D qr{ > + const| > + volatile| > + QEMU_NORETURN| > + QEMU_WARN_UNUSED_RESULT| > + QEMU_SENTINEL| > + QEMU_PACKED| > + GCC_FMT_ATTR > + }x; > +our $Modifier; > +our $Inline =3D qr{inline}; > +our $Member =3D qr{->$Ident|\.$Ident|\[[^]]*\]}; > +our $Lval =3D qr{$Ident(?:$Member)*}; > + > +our $Constant =3D qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*}; > +our $Assignment =3D qr{(?:\*\=3D|/=3D|%=3D|\+=3D|-=3D|<<=3D|>>=3D|&=3D|\= ^=3D|\|=3D|=3D)}; > +our $Compare =3D qr{<=3D|>=3D|=3D=3D|!=3D|<|>}; > +our $Operators =3D qr{ > + <=3D|>=3D|=3D=3D|!=3D| > + =3D>|->|<<|>>|<|>|!|~| > + &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|% > + }x; > + > +our $NonptrType; > +our $Type; > +our $Declare; > + > +our $NON_ASCII_UTF8 =3D qr{ > + [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte > + | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs > + | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte > + | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates > + | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 > + | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 > + | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 > +}x; > + > +our $UTF8 =3D qr{ > + [\x09\x0A\x0D\x20-\x7E] # ASCII > + | $NON_ASCII_UTF8 > +}x; > + > +# some readers default to ISO-8859-1 when showing email source. detect > +# when UTF-8 is incorrectly interpreted as ISO-8859-1 and reencoded back= . > +# False positives are possible but very unlikely. > +our $UTF8_MOJIBAKE =3D qr{ > + \xC3[\x82-\x9F] \xC2[\x80-\xBF] # c2-df 80-bf > + | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF] # e0 a0-bf 80-bf > + | \xC3[\xA1-\xAC\xAE\xAF] (?: \xC2[\x80-\xBF]){2} # e1-ec/ee/ef 80-bf > 80-bf > + | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF] # ed 80-9f 80-bf > + | \xC3\xB0 \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-= bf > + | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3} # f1-f3 80-bf 80-bf > 80-bf > + | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf 80-= bf > +}x; > + > +# There are still some false positives, but this catches most > +# common cases. > +our $typeTypedefs =3D qr{(?x: > + (?![KMGTPE]iB) # IEC binary prefix (do not > match) > + [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]* # camelcase > + | [A-Z][A-Z\d_]*AIOCB # all uppercase > + | [A-Z][A-Z\d_]*CPU # all uppercase > + | QEMUBH # all uppercase > +)}; > + > +our @typeList =3D ( > + qr{void}, > + qr{(?:unsigned\s+)?char}, > + qr{(?:unsigned\s+)?short}, > + qr{(?:unsigned\s+)?int}, > + qr{(?:unsigned\s+)?long}, > + qr{(?:unsigned\s+)?long\s+int}, > + qr{(?:unsigned\s+)?long\s+long}, > + qr{(?:unsigned\s+)?long\s+long\s+int}, > + qr{unsigned}, > + qr{float}, > + qr{double}, > + qr{bool}, > + qr{struct\s+$Ident}, > + qr{union\s+$Ident}, > + qr{enum\s+$Ident}, > + qr{${Ident}_t}, > + qr{${Ident}_handler}, > + qr{${Ident}_handler_fn}, > + qr{target_(?:u)?long}, > + qr{hwaddr}, > +); > + > +# This can be modified by sub possible. Since it can be empty, be caref= ul > +# about regexes that always match, because they can cause infinite loops= . > +our @modifierList =3D ( > +); > + > +sub build_types { > + my $all =3D "(?x: \n" . join("|\n ", @typeList) . "\n)"; > + if (@modifierList > 0) { > + my $mods =3D "(?x: \n" . join("|\n ", @modifierList) . "\n)"; > + $Modifier =3D qr{(?:$Attribute|$Sparse|$mods)}; > + } else { > + $Modifier =3D qr{(?:$Attribute|$Sparse)}; > + } > + $NonptrType =3D qr{ > + (?:$Modifier\s+|const\s+)* > + (?: > + (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| > + (?:$typeTypedefs\b)| > + (?:${all}\b) > + ) > + (?:\s+$Modifier|\s+const)* > + }x; > + $Type =3D qr{ > + $NonptrType > + (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? > + (?:\s+$Inline|\s+$Modifier)* > + }x; > + $Declare =3D qr{(?:$Storage\s+)?$Type}; > +} > +build_types(); > + > +$chk_signoff =3D 0 if ($file); > + > +my @rawlines =3D (); > +my @lines =3D (); > +my $vname; > +if ($chk_branch) { > + my @patches; > + my %git_commits =3D (); > + my $HASH; > + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format= =3D%H > %s", $ARGV[0]) || > + die "$P: git log --reverse --no-merges --format=3D'%H %s' $ARGV[0] fail= ed > - $!\n"; > + > + for my $line (<$HASH>) { > + $line =3D~ /^([0-9a-fA-F]{40,40}) (.*)$/; > + next if (!defined($1) || !defined($2)); > + my $sha1 =3D $1; > + my $subject =3D $2; > + push(@patches, $sha1); > + $git_commits{$sha1} =3D $subject; > + } > + > + close $HASH; > + > + die "$P: no revisions returned for revlist '$ARGV[0]'\n" > + unless @patches; > + > + my $i =3D 1; > + my $num_patches =3D @patches; > + for my $hash (@patches) { > + my $FILE; > + open($FILE, '-|', "git", "show", "--patch-with-stat", $hash) || > + die "$P: git show $hash - $!\n"; > + while (<$FILE>) { > + chomp; > + push(@rawlines, $_); > + } > + close($FILE); > + $vname =3D substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; > + if ($num_patches > 1 && $quiet =3D=3D 0) { > + my $prefix =3D "$i/$num_patches"; > + $prefix =3D BLUE . BOLD . $prefix . RESET if $color; > + print "$prefix Checking commit $vname\n"; > + $vname =3D "Patch $i/$num_patches"; > + } else { > + $vname =3D "Commit " . $vname; > + } > + if (!process($hash)) { > + $exit =3D 1; > + print "\n" if ($num_patches > 1 && $quiet =3D=3D 0); > + } > + @rawlines =3D (); > + @lines =3D (); > + $i++; > + } > +} else { > + for my $filename (@ARGV) { > + my $FILE; > + if ($file) { > + open($FILE, '-|', "diff -u /dev/null $filename") || > + die "$P: $filename: diff failed - $!\n"; > + } elsif ($filename eq '-') { > + open($FILE, '<&STDIN'); > + } else { > + open($FILE, '<', "$filename") || > + die "$P: $filename: open failed - $!\n"; > + } > + if ($filename eq '-') { > + $vname =3D 'Your patch'; > + } else { > + $vname =3D $filename; > + } > + print "Checking $filename...\n" if @ARGV > 1 && $quiet =3D=3D 0; > + while (<$FILE>) { > + chomp; > + push(@rawlines, $_); > + } > + close($FILE); > + if (!process($filename)) { > + $exit =3D 1; > + } > + @rawlines =3D (); > + @lines =3D (); > + } > +} > + > +exit($exit); > + > +sub top_of_kernel_tree { > + my ($root) =3D @_; > + > + my @tree_check =3D ( > + "Makefile.inc1", "README.md", "sys", > + "usr.sbin" > + ); > + > + foreach my $check (@tree_check) { > + if (! -e $root . '/' . $check) { > + return 0; > + } > + } > + return 1; > +} > + > +sub expand_tabs { > + my ($str) =3D @_; > + > + my $res =3D ''; > + my $n =3D 0; > + for my $c (split(//, $str)) { > + if ($c eq "\t") { > + $res .=3D ' '; > + $n++; > + for (; ($n % 8) !=3D 0; $n++) { > + $res .=3D ' '; > + } > + next; > + } > + $res .=3D $c; > + $n++; > + } > + > + return $res; > +} > +sub copy_spacing { > + (my $res =3D shift) =3D~ tr/\t/ /c; > + return $res; > +} > + > +sub line_stats { > + my ($line) =3D @_; > + > + # Drop the diff line leader and expand tabs > + $line =3D~ s/^.//; > + $line =3D expand_tabs($line); > + > + # Pick the indent from the front of the line. > + my ($white) =3D ($line =3D~ /^(\s*)/); > + > + return (length($line), length($white)); > +} > + > +my $sanitise_quote =3D ''; > + > +sub sanitise_line_reset { > + my ($in_comment) =3D @_; > + > + if ($in_comment) { > + $sanitise_quote =3D '*/'; > + } else { > + $sanitise_quote =3D ''; > + } > +} > +sub sanitise_line { > + my ($line) =3D @_; > + > + my $res =3D ''; > + my $l =3D ''; > + > + my $qlen =3D 0; > + my $off =3D 0; > + my $c; > + > + # Always copy over the diff marker. > + $res =3D substr($line, 0, 1); > + > + for ($off =3D 1; $off < length($line); $off++) { > + $c =3D substr($line, $off, 1); > + > + # Comments we are wacking completely including the begin > + # and end, all to $;. > + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') { > + $sanitise_quote =3D '*/'; > + > + substr($res, $off, 2, "$;$;"); > + $off++; > + next; > + } > + if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') { > + $sanitise_quote =3D ''; > + substr($res, $off, 2, "$;$;"); > + $off++; > + next; > + } > + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { > + $sanitise_quote =3D '//'; > + > + substr($res, $off, 2, $sanitise_quote); > + $off++; > + next; > + } > + > + # A \ in a string means ignore the next character. > + if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && > + $c eq "\\") { > + substr($res, $off, 2, 'XX'); > + $off++; > + next; > + } > + # Regular quotes. > + if ($c eq "'" || $c eq '"') { > + if ($sanitise_quote eq '') { > + $sanitise_quote =3D $c; > + > + substr($res, $off, 1, $c); > + next; > + } elsif ($sanitise_quote eq $c) { > + $sanitise_quote =3D ''; > + } > + } > + > + #print "c<$c> SQ<$sanitise_quote>\n"; > + if ($off !=3D 0 && $sanitise_quote eq '*/' && $c ne "\t") { > + substr($res, $off, 1, $;); > + } elsif ($off !=3D 0 && $sanitise_quote eq '//' && $c ne "\t") { > + substr($res, $off, 1, $;); > + } elsif ($off !=3D 0 && $sanitise_quote && $c ne "\t") { > + substr($res, $off, 1, 'X'); > + } else { > + substr($res, $off, 1, $c); > + } > + } > + > + if ($sanitise_quote eq '//') { > + $sanitise_quote =3D ''; > + } > + > + # The pathname on a #include may be surrounded by '<' and '>'. > + if ($res =3D~ /^.\s*\#\s*include\s+\<(.*)\>/) { > + my $clean =3D 'X' x length($1); > + $res =3D~ s@\<.*\>@<$clean>@; > + > + # The whole of a #error is a string. > + } elsif ($res =3D~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) { > + my $clean =3D 'X' x length($1); > + $res =3D~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; > + } > + > + return $res; > +} > + > +sub ctx_statement_block { > + my ($linenr, $remain, $off) =3D @_; > + my $line =3D $linenr - 1; > + my $blk =3D ''; > + my $soff =3D $off; > + my $coff =3D $off - 1; > + my $coff_set =3D 0; > + > + my $loff =3D 0; > + > + my $type =3D ''; > + my $level =3D 0; > + my @stack =3D (); > + my $p; > + my $c; > + my $len =3D 0; > + > + my $remainder; > + while (1) { > + @stack =3D (['', 0]) if ($#stack =3D=3D -1); > + > + #warn "CSB: blk<$blk> remain<$remain>\n"; > + # If we are about to drop off the end, pull in more > + # context. > + if ($off >=3D $len) { > + for (; $remain > 0; $line++) { > + last if (!defined $lines[$line]); > + next if ($lines[$line] =3D~ /^-/); > + $remain--; > + $loff =3D $len; > + $blk .=3D $lines[$line] . "\n"; > + $len =3D length($blk); > + $line++; > + last; > + } > + # Bail if there is no further context. > + #warn "CSB: blk<$blk> off<$off> len<$len>\n"; > + if ($off >=3D $len) { > + last; > + } > + } > + $p =3D $c; > + $c =3D substr($blk, $off, 1); > + $remainder =3D substr($blk, $off); > + > + #warn "CSB: c<$c> type<$type> level<$level> remainder<$remainder> > coff_set<$coff_set>\n"; > + > + # Handle nested #if/#else. > + if ($remainder =3D~ /^#\s*(?:ifndef|ifdef|if)\s/) { > + push(@stack, [ $type, $level ]); > + } elsif ($remainder =3D~ /^#\s*(?:else|elif)\b/) { > + ($type, $level) =3D @{$stack[$#stack - 1]}; > + } elsif ($remainder =3D~ /^#\s*endif\b/) { > + ($type, $level) =3D @{pop(@stack)}; > + } > + > + # Statement ends at the ';' or a close '}' at the > + # outermost level. > + if ($level =3D=3D 0 && $c eq ';') { > + last; > + } > + > + # An else is really a conditional as long as its not else if > + if ($level =3D=3D 0 && $coff_set =3D=3D 0 && > + (!defined($p) || $p =3D~ /(?:\s|\}|\+)/) && > + $remainder =3D~ /^(else)(?:\s|{)/ && > + $remainder !~ /^else\s+if\b/) { > + $coff =3D $off + length($1) - 1; > + $coff_set =3D 1; > + #warn "CSB: mark coff<$coff> soff<$soff> 1<$1>\n"; > + #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n"; > + } > + > + if (($type eq '' || $type eq '(') && $c eq '(') { > + $level++; > + $type =3D '('; > + } > + if ($type eq '(' && $c eq ')') { > + $level--; > + $type =3D ($level !=3D 0)? '(' : ''; > + > + if ($level =3D=3D 0 && $coff < $soff) { > + $coff =3D $off; > + $coff_set =3D 1; > + #warn "CSB: mark coff<$coff>\n"; > + } > + } > + if (($type eq '' || $type eq '{') && $c eq '{') { > + $level++; > + $type =3D '{'; > + } > + if ($type eq '{' && $c eq '}') { > + $level--; > + $type =3D ($level !=3D 0)? '{' : ''; > + > + if ($level =3D=3D 0) { > + if (substr($blk, $off + 1, 1) eq ';') { > + $off++; > + } > + last; > + } > + } > + $off++; > + } > + # We are truly at the end, so shuffle to the next line. > + if ($off =3D=3D $len) { > + $loff =3D $len + 1; > + $line++; > + $remain--; > + } > + > + my $statement =3D substr($blk, $soff, $off - $soff + 1); > + my $condition =3D substr($blk, $soff, $coff - $soff + 1); > + > + #warn "STATEMENT<$statement>\n"; > + #warn "CONDITION<$condition>\n"; > + > + #print "coff<$coff> soff<$off> loff<$loff>\n"; > + > + return ($statement, $condition, > + $line, $remain + 1, $off - $loff + 1, $level); > +} > + > +sub statement_lines { > + my ($stmt) =3D @_; > + > + # Strip the diff line prefixes and rip blank lines at start and end. > + $stmt =3D~ s/(^|\n)./$1/g; > + $stmt =3D~ s/^\s*//; > + $stmt =3D~ s/\s*$//; > + > + my @stmt_lines =3D ($stmt =3D~ /\n/g); > + > + return $#stmt_lines + 2; > +} > + > +sub statement_rawlines { > + my ($stmt) =3D @_; > + > + my @stmt_lines =3D ($stmt =3D~ /\n/g); > + > + return $#stmt_lines + 2; > +} > + > +sub statement_block_size { > + my ($stmt) =3D @_; > + > + $stmt =3D~ s/(^|\n)./$1/g; > + $stmt =3D~ s/^\s*\{//; > + $stmt =3D~ s/}\s*$//; > + $stmt =3D~ s/^\s*//; > + $stmt =3D~ s/\s*$//; > + > + my @stmt_lines =3D ($stmt =3D~ /\n/g); > + my @stmt_statements =3D ($stmt =3D~ /;/g); > + > + my $stmt_lines =3D $#stmt_lines + 2; > + my $stmt_statements =3D $#stmt_statements + 1; > + > + if ($stmt_lines > $stmt_statements) { > + return $stmt_lines; > + } else { > + return $stmt_statements; > + } > +} > + > +sub ctx_statement_full { > + my ($linenr, $remain, $off) =3D @_; > + my ($statement, $condition, $level); > + > + my (@chunks); > + > + # Grab the first conditional/block pair. > + ($statement, $condition, $linenr, $remain, $off, $level) =3D > + ctx_statement_block($linenr, $remain, $off); > + #print "F: c<$condition> s<$statement> remain<$remain>\n"; > + push(@chunks, [ $condition, $statement ]); > + if (!($remain > 0 && $condition =3D~ > /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) { > + return ($level, $linenr, @chunks); > + } > + > + # Pull in the following conditional/block pairs and see if they > + # could continue the statement. > + for (;;) { > + ($statement, $condition, $linenr, $remain, $off, $level) =3D > + ctx_statement_block($linenr, $remain, $off); > + #print "C: c<$condition> s<$statement> remain<$remain>\n"; > + last if (!($remain > 0 && $condition =3D~ > /^(?:\s*\n[+-])*\s*(?:else|do)\b/s)); > + #print "C: push\n"; > + push(@chunks, [ $condition, $statement ]); > + } > + > + return ($level, $linenr, @chunks); > +} > + > +sub ctx_block_get { > + my ($linenr, $remain, $outer, $open, $close, $off) =3D @_; > + my $line; > + my $start =3D $linenr - 1; > + my $blk =3D ''; > + my @o; > + my @c; > + my @res =3D (); > + > + my $level =3D 0; > + my @stack =3D ($level); > + for ($line =3D $start; $remain > 0; $line++) { > + next if ($rawlines[$line] =3D~ /^-/); > + $remain--; > + > + $blk .=3D $rawlines[$line]; > + > + # Handle nested #if/#else. > + if ($lines[$line] =3D~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) { > + push(@stack, $level); > + } elsif ($lines[$line] =3D~ /^.\s*#\s*(?:else|elif)\b/) { > + $level =3D $stack[$#stack - 1]; > + } elsif ($lines[$line] =3D~ /^.\s*#\s*endif\b/) { > + $level =3D pop(@stack); > + } > + > + foreach my $c (split(//, $lines[$line])) { > + ##print "C<$c>L<$level><$open$close>O<$off>\n"; > + if ($off > 0) { > + $off--; > + next; > + } > + > + if ($c eq $close && $level > 0) { > + $level--; > + last if ($level =3D=3D 0); > + } elsif ($c eq $open) { > + $level++; > + } > + } > + > + if (!$outer || $level <=3D 1) { > + push(@res, $rawlines[$line]); > + } > + > + last if ($level =3D=3D 0); > + } > + > + return ($level, @res); > +} > +sub ctx_block_outer { > + my ($linenr, $remain) =3D @_; > + > + my ($level, @r) =3D ctx_block_get($linenr, $remain, 1, '{', '}', 0); > + return @r; > +} > +sub ctx_block { > + my ($linenr, $remain) =3D @_; > + > + my ($level, @r) =3D ctx_block_get($linenr, $remain, 0, '{', '}', 0); > + return @r; > +} > +sub ctx_statement { > + my ($linenr, $remain, $off) =3D @_; > + > + my ($level, @r) =3D ctx_block_get($linenr, $remain, 0, '(', ')', $off); > + return @r; > +} > +sub ctx_block_level { > + my ($linenr, $remain) =3D @_; > + > + return ctx_block_get($linenr, $remain, 0, '{', '}', 0); > +} > +sub ctx_statement_level { > + my ($linenr, $remain, $off) =3D @_; > + > + return ctx_block_get($linenr, $remain, 0, '(', ')', $off); > +} > + > +sub ctx_locate_comment { > + my ($first_line, $end_line) =3D @_; > + > + # Catch a comment on the end of the line itself. > + my ($current_comment) =3D ($rawlines[$end_line - 1] =3D~ m@ > .*(/\*.*\*/)\s*(?:\\\s*)?$@); > + return $current_comment if (defined $current_comment); > + > + # Look through the context and try and figure out if there is a > + # comment. > + my $in_comment =3D 0; > + $current_comment =3D ''; > + for (my $linenr =3D $first_line; $linenr < $end_line; $linenr++) { > + my $line =3D $rawlines[$linenr - 1]; > + #warn " $line\n"; > + if ($linenr =3D=3D $first_line and $line =3D~ m@^.\s*\*@) { > + $in_comment =3D 1; > + } > + if ($line =3D~ m@/\*@) { > + $in_comment =3D 1; > + } > + if (!$in_comment && $current_comment ne '') { > + $current_comment =3D ''; > + } > + $current_comment .=3D $line . "\n" if ($in_comment); > + if ($line =3D~ m@\*/@) { > + $in_comment =3D 0; > + } > + } > + > + chomp($current_comment); > + return($current_comment); > +} > +sub ctx_has_comment { > + my ($first_line, $end_line) =3D @_; > + my $cmt =3D ctx_locate_comment($first_line, $end_line); > + > + ##print "LINE: $rawlines[$end_line - 1 ]\n"; > + ##print "CMMT: $cmt\n"; > + > + return ($cmt ne ''); > +} > + > +sub raw_line { > + my ($linenr, $cnt) =3D @_; > + > + my $offset =3D $linenr - 1; > + $cnt++; > + > + my $line; > + while ($cnt) { > + $line =3D $rawlines[$offset++]; > + next if (defined($line) && $line =3D~ /^-/); > + $cnt--; > + } > + > + return $line; > +} > + > +sub cat_vet { > + my ($vet) =3D @_; > + my ($res, $coded); > + > + $res =3D ''; > + while ($vet =3D~ /([^[:cntrl:]]*)([[:cntrl:]]|$)/g) { > + $res .=3D $1; > + if ($2 ne '') { > + $coded =3D sprintf("^%c", unpack('C', $2) + 64); > + $res .=3D $coded; > + } > + } > + $res =3D~ s/$/\$/; > + > + return $res; > +} > + > +my $av_preprocessor =3D 0; > +my $av_pending; > +my @av_paren_type; > +my $av_pend_colon; > + > +sub annotate_reset { > + $av_preprocessor =3D 0; > + $av_pending =3D '_'; > + @av_paren_type =3D ('E'); > + $av_pend_colon =3D 'O'; > +} > + > +sub annotate_values { > + my ($stream, $type) =3D @_; > + > + my $res; > + my $var =3D '_' x length($stream); > + my $cur =3D $stream; > + > + print "$stream\n" if ($dbg_values > 1); > + > + while (length($cur)) { > + @av_paren_type =3D ('E') if ($#av_paren_type < 0); > + print " <" . join('', @av_paren_type) . > + "> <$type> <$av_pending>" if ($dbg_values > 1); > + if ($cur =3D~ /^(\s+)/o) { > + print "WS($1)\n" if ($dbg_values > 1); > + if ($1 =3D~ /\n/ && $av_preprocessor) { > + $type =3D pop(@av_paren_type); > + $av_preprocessor =3D 0; > + } > + > + } elsif ($cur =3D~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') { > + print "CAST($1)\n" if ($dbg_values > 1); > + push(@av_paren_type, $type); > + $type =3D 'C'; > + > + } elsif ($cur =3D~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) { > + print "DECLARE($1)\n" if ($dbg_values > 1); > + $type =3D 'T'; > + > + } elsif ($cur =3D~ /^($Modifier)\s*/) { > + print "MODIFIER($1)\n" if ($dbg_values > 1); > + $type =3D 'T'; > + > + } elsif ($cur =3D~ /^(\#\s*define\s*$Ident)(\(?)/o) { > + print "DEFINE($1,$2)\n" if ($dbg_values > 1); > *** 1791 LINES SKIPPED *** > > > --0000000000006acd1f05f7bcca27 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yea, I did most of the work on this 18 months ago or so, b= ut the shit in core and subsequent nastiness derailed it til now.

<= /div>
It's gotten to 'decent or better' at things, but far = from perfect. I'm sure that now the bug reports will come.
Warner

On Sat, Mar 25, 2023 at 6:22=E2=80=AFPM Drew Galla= tin <gallatin@freebsd.org>= ; wrote:
Thanks so much.=C2=A0 I'= ;ve wanted something like this *forever*

On Sa= t, Mar 25, 2023, at 1:08 PM, Warner Losh wrote:
The branch main has been upda= ted by imp:


commit 3a3c9242739ef= b0c76587ffbaa54c5d10b2cbcb4
Author:=C2=A0=C2=A0=C2=A0=C2=A0 W= arner Losh <imp@Fre= eBSD.org>
AuthorDate: 2023-03-14 21:28:05 +0000
Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Warner Losh <imp@FreeBSD.org>
Com= mitDate: 2023-03-25 17:06:13 +0000

=C2=A0=C2= =A0=C2=A0 checkstyle9.p= l: Perl script to check if a change is approximately style(9)
=
=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 This code is= adapted from the QEMU c= heckpatch.pl script. It can check
=C2=A0=C2=A0=C2=A0 eith= er a patch, a file or a git branch. It tries to warn about things
=
=C2=A0=C2=A0=C2=A0 that I believe might be style(9) violations. It'= ;s experimental, since I
=C2=A0=C2=A0=C2=A0 heavily hacked on= the qemu version to get it to not complain (much)
=C2=A0=C2= =A0=C2=A0 about iconic code in the tree. At the moment, it's use should= be
=C2=A0=C2=A0=C2=A0 considered expermental. It will likely= miss violations, and complain
=C2=A0=C2=A0=C2=A0 about code = that's perfectly fine.=C2=A0 It's offered as an experiment
=C2=A0=C2=A0=C2=A0 and to make it easier for contributors to submit p= atches.
---
tools/build/checkstyle9.pl | 2748 ++++++++++++++++++++= ++++++++++++++++++++++++
1 file changed, 2748 insertions(+)

diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl
ne= w file mode 100755
index 000000000000..5aec3819bf7c
=
--- /dev/null
+++ b/tools/build/checkstyle9.pl
@@ -0,0 +1,274= 8 @@
+#!/usr/bin/env perl
+# (c) 2001, Dave Jon= es. (the file handling bit)
+# (c) 2005, Joel Schopp <jschopp@austin.ibm.= com> (the ugly bit)
+# (c) 2007,2008, Andy Whitcroft &= lt;apw@uk.ibm.com&g= t; (new conditions, test suite)
+# (c) 2008-2010 Andy Whitcro= ft <apw@canonical= .com>
+# Licensed under the terms of the GNU GPL Licen= se version 2
+
+use strict;
+use = warnings;
+use Term::ANSIColor qw(:constants);
= +
+my $P =3D $0;
+$P =3D~ s@.*/@@g;
+
+our $SrcFile=C2=A0=C2=A0=C2=A0 =3D qr{\.(?:h|c|cpp|s|S|= pl|py|sh)$};
+
+my $V =3D '0.31';
+
+use Getopt::Long qw(:config no_auto_abbrev);
<= /div>
+
+my $quiet =3D 0;
+my $tree =3D 1;<= br>
+my $chk_signoff =3D 1;
+my $chk_patch =3D unde= f;
+my $chk_branch =3D undef;
+my $tst_only;
+my $emacs =3D 0;
+my $terse =3D 0;
+my $file =3D undef;
+my $color =3D "auto";
+my $no_warnings =3D 0;
+my $summary =3D 1;
=
+my $mailback =3D 0;
+my $summary_file =3D 0;
<= div>+my $root;
+my %debug;
+my $help =3D 0;
=
+
+sub help {
+ my ($exitcode) =3D @= _;
+
+ print << "EOM";
+Usage:
+
+=C2=A0=C2=A0=C2=A0 $P [OPTION]= ... [FILE]...
+=C2=A0=C2=A0=C2=A0 $P [OPTION]... [GIT-REV-LIS= T]
+
+Version: $V
+
+Options:
+=C2=A0 -q, --quiet=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 quiet
+=C2=A0 --patch=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 treat FILE as = patchfile
+=C2=A0 --branch=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= treat args as GIT revision list
+=C2=A0 --emacs=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 emacs compile window format
+=C2= =A0 --terse=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 one line per report
=
+=C2=A0 -f, --file=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 treat FILE as regular s= ource file
+=C2=A0 --strict=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= fail if only warnings are found
+=C2=A0 --no-summary=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 suppress the per-file summary
+=C2=A0 --mailback=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 only produce a report in case of warnings/errors
+=C2=A0 --summary-file=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 include the filename in summary
+=C2=A0= --debug KEY=3D[0|1]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = turn on/off debugging of KEY, where KEY is one of
+=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 'values', 'possible', 'type', and 'at= tr' (default
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 is all off)
+=C2=A0 --test-only=3DWORD=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 report only warnings/errors containing WORD
+= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 literally
+=C2=A0 --color[=3DWHEN]=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Use colo= rs 'always', 'never', or only when output
+= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 is a terminal ('auto'). Default is 'auto'= ;.
+=C2=A0 -h, --help, --version=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 display this help and exit
+
+When FILE is = - read standard input.
+EOM
+
+ e= xit($exitcode);
+}
+
+# Use at yo= ur own risk
+print "\n", MAGENTA, "WARNING:&qu= ot;, RESET, " This code is highly experimental ... likely isn't a = great style(9) match yet\n\n";
+
+# Perl&#= 39;s Getopt::Long allows options to take optional arguments after a space.<= br>
+# Prevent --color by itself from consuming other arguments
+foreach (@ARGV) {
+ if ($_ eq "--color&quo= t; || $_ eq "-color") {
+ $_ =3D "--color=3D$= color";
+ }
+}
+
+GetOptions(
+ 'q|quiet+' =3D> \$quiet,
+ 'tree!' =3D> \$tree,
+ 'signoff!'= ; =3D> \$chk_signoff,
+ 'patch!' =3D> \$chk_pat= ch,
+ 'branch!' =3D> \$chk_branch,
+= 'emacs!' =3D> \$emacs,
+ 'terse!' =3D>= \$terse,
+ 'f|file!' =3D> \$file,
+= 'strict!' =3D> \$no_warnings,
+ 'root=3Ds'= ; =3D> \$root,
+ 'summary!' =3D> \$summary,
=
+ 'mailback!' =3D> \$mailback,
+ 's= ummary-file!' =3D> \$summary_file,
+
+ &= #39;debug=3Ds' =3D> \%debug,
+ 'test-only=3Ds'= =3D> \$tst_only,
+ 'color=3Ds'=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =3D> \$color,
+ 'no-color'=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D> sub { $color =3D 'never'; },
+ 'h|help' =3D> \$help,
+ 'version= ' =3D> \$help
+) or help(1);
+
=
+help(0) if ($help);
+
+my $exit =3D 0;
+
+if ($#ARGV < 0) {
+ print &qu= ot;$P: no input files\n";
+ exit(1);
+}
+
+if (!defined $chk_branch && !defined $= chk_patch && !defined $file) {
+ $chk_branch =3D $ARG= V[0] =3D~ /.\.\./ ? 1 : 0;
+ $file =3D $ARGV[0] =3D~ /$SrcFil= e/ ? 1 : 0;
+ $chk_patch =3D $chk_branch || $file ? 0 : 1;
+} elsif (!defined $chk_branch && !defined $chk_patch) = {
+ if ($file) {
+ $chk_branch =3D $chk_patch = =3D 0;
+ } else {
+ $chk_branch =3D $ARGV[0] = =3D~ /.\.\./ ? 1 : 0;
+ $chk_patch =3D $chk_branch ? 0 : 1;<= br>
+ }
+} elsif (!defined $chk_branch && != defined $file) {
+ if ($chk_patch) {
+ $chk_br= anch =3D $file =3D 0;
+ } else {
+ $chk_branch= =3D $ARGV[0] =3D~ /.\.\./ ? 1 : 0;
+ $file =3D $chk_branch = ? 0 : 1;
+ }
+} elsif (!defined $chk_patch &= ;& !defined $file) {
+ if ($chk_branch) {
+= $chk_patch =3D $file =3D 0;
+ } else {
+ $fi= le =3D $ARGV[0] =3D~ /$SrcFile/ ? 1 : 0;
+ $chk_patch =3D $f= ile ? 0 : 1;
+ }
+} elsif (!defined $chk_branch= ) {
+ $chk_branch =3D $chk_patch || $file ? 0 : 1;
<= div>+} elsif (!defined $chk_patch) {
+ $chk_patch =3D $chk_br= anch || $file ? 0 : 1;
+} elsif (!defined $file) {
<= div>+ $file =3D $chk_patch || $chk_branch ? 0 : 1;
+}
+
+if (($chk_patch && $chk_branch) ||
+=C2=A0=C2=A0=C2=A0 ($chk_patch && $file) ||
+= =C2=A0=C2=A0=C2=A0 ($chk_branch && $file)) {
+ die &q= uot;Only one of --file, --branch, --patch is permitted\n";
+}
+if (!$chk_patch && !$chk_branch && !$f= ile) {
+ die "One of --file, --branch, --patch is requir= ed\n";
+}
+
+if ($color =3D~= /^always$/i) {
+ $color =3D 1;
+} elsif ($colo= r =3D~ /^never$/i) {
+ $color =3D 0;
+} elsif (= $color =3D~ /^auto$/i) {
+ $color =3D (-t STDOUT);
<= div>+} else {
+ die "Invalid color mode: $color\n";=
+}
+
+my $dbg_values =3D 0;
<= /div>
+my $dbg_possible =3D 0;
+my $dbg_type =3D 0;
+my $dbg_attr =3D 0;
+my $dbg_adv_dcs =3D 0;
+my $dbg_adv_checking =3D 0;
+my $dbg_adv_apw =3D 0;
+for my $key (keys %debug) {
+ ## no critic
<= /div>
+ eval "\${dbg_$key} =3D '$debug{$key}';";
<= /div>
+ die "$@" if ($@);
+}
+
+my $rpt_cleaners =3D 0;
+
+if ($te= rse) {
+ $emacs =3D 1;
+ $quiet++;
+}
+
+my $emitted_corrupt =3D 0;
+
+our $Ident =3D qr{
+ [A-Za-z_][A-Za-z\d_= ]*
+ (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
+ = }x;
+our $Storage =3D qr{extern|static|asmlinkage};
=
+our $Sparse =3D qr{
+ __force
+ }x;
+
+# Notes to $Attribute:
+our $Att= ribute =3D qr{
+ const|
+ volatile|
+ QEMU_NORETURN|
+ QEMU_WARN_UNUSED_RESULT|
+ QEMU_SENTINEL|
+ QEMU_PACKED|
+ = GCC_FMT_ATTR
+ =C2=A0 }x;
+our $Modifier;
=
+our $Inline =3D qr{inline};
+our $Member =3D qr{-= >$Ident|\.$Ident|\[[^]]*\]};
+our $Lval =3D qr{$Ident(?:$M= ember)*};
+
+our $Constant =3D qr{(?:[0-9]+|0x[= 0-9a-fA-F]+)[UL]*};
+our $Assignment =3D qr{(?:\*\=3D|/=3D|%= =3D|\+=3D|-=3D|<<=3D|>>=3D|&=3D|\^=3D|\|=3D|=3D)};
+our $Compare=C2=A0=C2=A0=C2=A0 =3D qr{<=3D|>=3D|=3D=3D|!=3D|&l= t;|>};
+our $Operators =3D qr{
+ <=3D|&= gt;=3D|=3D=3D|!=3D|
+ =3D>|->|<<|>>|<|= >|!|~|
+ &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\= /|%
+ =C2=A0 }x;
+
+our $NonptrT= ype;
+our $Type;
+our $Declare;
+=
+our $NON_ASCII_UTF8 =3D qr{
+ [\xC2-\xDF][\x8= 0-\xBF]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 # non-overlong 2-byte
+ |=C2=A0 \xE0[\xA0-= \xBF][\x80-\xBF]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # excluding over= longs
+ | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}=C2=A0 # straight = 3-byte
+ |=C2=A0 \xED[\x80-\x9F][\x80-\xBF]=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 # excluding surrogates
+ |=C2=A0 \xF= 0[\x90-\xBF][\x80-\xBF]{2}=C2=A0=C2=A0=C2=A0=C2=A0 # planes 1-3
+ | [\xF1-\xF3][\x80-\xBF]{3}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 # planes 4-15
+ |=C2=A0 \xF4[\x80-\x8F][\x80-\xB= F]{2}=C2=A0=C2=A0=C2=A0=C2=A0 # plane 16
+}x;
+=
+our $UTF8 =3D qr{
+ [\x09\x0A\x0D\x20-\x7E]= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 # ASCII
+ | $NON_ASCII_UTF8
+}x;
<= div>+
+# some readers default to ISO-8859-1 when showing emai= l source. detect
+# when UTF-8 is incorrectly interpreted as = ISO-8859-1 and reencoded back.
+# False positives are possibl= e but very unlikely.
+our $UTF8_MOJIBAKE =3D qr{
+ \xC3[\x82-\x9F] \xC2[\x80-\xBF]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= # c2-df 80-bf
+ | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF]= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # e0 a0-bf 80-bf
=
+ | \xC3[\xA1-\xAC\xAE\xAF] (?: \xC2[\x80-\xBF]){2}=C2=A0 # e1-ec/ee/e= f 80-bf 80-bf
+ | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF]=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # ed 80-9f 80-bf
+ | \xC3\xB0 \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-= bf
+ | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3}=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # f1-f3 80-bf 80-bf 80-bf
=
+ | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf = 80-bf
+}x;
+
+# There are still s= ome false positives, but this catches most
+# common cases.
+our $typeTypedefs =3D qr{(?x:
+=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (?![KMGTPE]iB)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 # IEC binary prefix (do not match)
+=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]*=C2=A0= =C2=A0=C2=A0=C2=A0 # camelcase
+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 | [A-Z][A-Z\d_]*AIOCB=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # all uppercase
<= div>+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | [A-Z][A-Z\d_]*CPU=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 # all uppercase
+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 | QEMUBH=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # all uppercase
+)};
=
+
+our @typeList =3D (
+ qr{void},
+ qr{(?:unsigned\s+)?char},
+ qr{(?:unsigned\s+)= ?short},
+ qr{(?:unsigned\s+)?int},
+ qr{(?:uns= igned\s+)?long},
+ qr{(?:unsigned\s+)?long\s+int},
<= div>+ qr{(?:unsigned\s+)?long\s+long},
+ qr{(?:unsigned\s+)?l= ong\s+long\s+int},
+ qr{unsigned},
+ qr{float},=
+ qr{double},
+ qr{bool},
+ qr{s= truct\s+$Ident},
+ qr{union\s+$Ident},
+ qr{enu= m\s+$Ident},
+ qr{${Ident}_t},
+ qr{${Ident}_ha= ndler},
+ qr{${Ident}_handler_fn},
+ qr{target_= (?:u)?long},
+ qr{hwaddr},
+);
+<= br>
+# This can be modified by sub possible.=C2=A0 Since it can b= e empty, be careful
+# about regexes that always match, becau= se they can cause infinite loops.
+our @modifierList =3D (
+);
+
+sub build_types {
<= div>+ my $all =3D "(?x:=C2=A0 \n" . join("|\n=C2=A0 ", = @typeList) . "\n)";
+ if (@modifierList > 0) {
+ my $mods =3D "(?x:=C2=A0 \n" . join("|\n=C2= =A0 ", @modifierList) . "\n)";
+ $Modifier = =3D qr{(?:$Attribute|$Sparse|$mods)};
+ } else {
+ $Modifier =3D qr{(?:$Attribute|$Sparse)};
+ }
<= div>+ $NonptrType =3D qr{
+ (?:$Modifier\s+|const\s+)*
<= /div>
+ (?:
+ (?:typeof|__typeof__)\s*\(\s*\**\s*$Id= ent\s*\)|
+ (?:$typeTypedefs\b)|
+ (?:${a= ll}\b)
+ )
+ (?:\s+$Modifier|\s+const)*
=
+ =C2=A0 }x;
+ $Type =3D qr{
+ $N= onptrType
+ (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)?
+ (?:\s+$Inline|\s+$Modifier)*
+ =C2=A0 }x;
+ $Declare =3D qr{(?:$Storage\s+)?$Type};
+}
<= /div>
+build_types();
+
+$chk_signoff =3D 0= if ($file);
+
+my @rawlines =3D ();
<= div>+my @lines =3D ();
+my $vname;
+if ($chk_br= anch) {
+ my @patches;
+ my %git_commits =3D ()= ;
+ my $HASH;
+ open($HASH, "-|", &qu= ot;git", "log", "--reverse", "--no-merges&quo= t;, "--format=3D%H %s", $ARGV[0]) ||
+ die "$= P: git log --reverse --no-merges --format=3D'%H %s' $ARGV[0] failed= - $!\n";
+
+ for my $line (<$HASH>)= {
+ $line =3D~ /^([0-9a-fA-F]{40,40}) (.*)$/;
+ next if (!defined($1) || !defined($2));
+ my $sha1 =3D $= 1;
+ my $subject =3D $2;
+ push(@patches, $sh= a1);
+ $git_commits{$sha1} =3D $subject;
+ }
+
+ close $HASH;
+
+= die "$P: no revisions returned for revlist '$ARGV[0]'\n"=
+ =C2=A0=C2=A0=C2=A0 unless @patches;
+
+ my $i =3D 1;
+ my $num_patches =3D @patches;
+ for my $hash (@patches) {
+ my $FILE;
+ open($FILE, '-|', "git", "show", "--p= atch-with-stat", $hash) ||
+ die "$P: git show $h= ash - $!\n";
+ while (<$FILE>) {
+ = chomp;
+ push(@rawlines, $_);
+ }
+ close($FILE);
+ $vname =3D substr($hash, 0, 12) . &= #39; (' . $git_commits{$hash} . ')';
+ if ($num_= patches > 1 && $quiet =3D=3D 0) {
+ my $prefix = =3D "$i/$num_patches";
+ $prefix =3D BLUE . BOLD = . $prefix . RESET if $color;
+ print "$prefix Checking= commit $vname\n";
+ $vname =3D "Patch $i/$num_pa= tches";
+ } else {
+ $vname =3D "C= ommit " . $vname;
+ }
+ if (!process($ha= sh)) {
+ $exit =3D 1;
+ print "\n"= ; if ($num_patches > 1 && $quiet =3D=3D 0);
+ }
+ @rawlines =3D ();
+ @lines =3D ();
=
+ $i++;
+ }
+} else {
+ for= my $filename (@ARGV) {
+ my $FILE;
+ if ($fi= le) {
+ open($FILE, '-|', "diff -u /dev/null $= filename") ||
+ die "$P: $filename: diff failed = - $!\n";
+ } elsif ($filename eq '-') {
+ open($FILE, '<&STDIN');
+ } else {=
+ open($FILE, '<', "$filename") ||
+ die "$P: $filename: open failed - $!\n";
+ }
+ if ($filename eq '-') {
= + $vname =3D 'Your patch';
+ } else {
+ $vname =3D $filename;
+ }
+ print "= ;Checking $filename...\n" if @ARGV > 1 && $quiet =3D=3D 0;<= br>
+ while (<$FILE>) {
+ chomp;
=
+ push(@rawlines, $_);
+ }
+ close($FI= LE);
+ if (!process($filename)) {
+ $exit = =3D 1;
+ }
+ @rawlines =3D ();
= + @lines =3D ();
+ }
+}
+
+exit($exit);
+
+sub top_of_kernel_tree= {
+ my ($root) =3D @_;
+
+ my @t= ree_check =3D (
+ =C2=A0=C2=A0=C2=A0 "Makefile.inc1"= ;, "README.md", "sys",
+ =C2=A0=C2=A0=C2= =A0 "usr.sbin"
+ );
+
+= foreach my $check (@tree_check) {
+ if (! -e $root . '/= ' . $check) {
+ return 0;
+ }
<= div>+ }
+ return 1;
+}
+
+sub expand_tabs {
+ my ($str) =3D @_;
+<= br>
+ my $res =3D '';
+ my $n =3D 0;
+ for my $c (split(//, $str)) {
+ if ($c eq "\t= ") {
+ $res .=3D ' ';
+ $n++;<= br>
+ for (; ($n % 8) !=3D 0; $n++) {
+ $res .= =3D ' ';
+ }
+ next;
= + }
+ $res .=3D $c;
+ $n++;
+ = }
+
+ return $res;
+}
+sub copy_spacing {
+ (my $res =3D shift) =3D~ tr/\t/ /c;<= br>
+ return $res;
+}
+
+sub line_stats {
+ my ($line) =3D @_;
+
+ # Drop the diff line leader and expand tabs
+ $lin= e =3D~ s/^.//;
+ $line =3D expand_tabs($line);
= +
+ # Pick the indent from the front of the line.
+ my ($white) =3D ($line =3D~ /^(\s*)/);
+
+= return (length($line), length($white));
+}
+
+my $sanitise_quote =3D '';
+
<= div>+sub sanitise_line_reset {
+ my ($in_comment) =3D @_;
=
+
+ if ($in_comment) {
+ $sanitise_= quote =3D '*/';
+ } else {
+ $sanitise= _quote =3D '';
+ }
+}
+su= b sanitise_line {
+ my ($line) =3D @_;
+
+ my $res =3D '';
+ my $l =3D '';
=
+
+ my $qlen =3D 0;
+ my $off =3D 0;=
+ my $c;
+
+ # Always copy over = the diff marker.
+ $res =3D substr($line, 0, 1);
+
+ for ($off =3D 1; $off < length($line); $off++) {
=
+ $c =3D substr($line, $off, 1);
+
= + # Comments we are wacking completely including the begin
+= # and end, all to $;.
+ if ($sanitise_quote eq '' = && substr($line, $off, 2) eq '/*') {
+ $san= itise_quote =3D '*/';
+
+ substr($res= , $off, 2, "$;$;");
+ $off++;
+ n= ext;
+ }
+ if ($sanitise_quote eq '*/'= ; && substr($line, $off, 2) eq '*/') {
+ $s= anitise_quote =3D '';
+ substr($res, $off, 2, "= ;$;$;");
+ $off++;
+ next;
+ }
+ if ($sanitise_quote eq '' && subst= r($line, $off, 2) eq '//') {
+ $sanitise_quote =3D = '//';
+
+ substr($res, $off, 2, $sani= tise_quote);
+ $off++;
+ next;
+ }
+
+ # A \ in a string means ignore the = next character.
+ if (($sanitise_quote eq "'" = || $sanitise_quote eq '"') &&
+ =C2=A0= =C2=A0=C2=A0 $c eq "\\") {
+ substr($res, $off, 2= , 'XX');
+ $off++;
+ next;
+ }
+ # Regular quotes.
+ if ($c eq &q= uot;'" || $c eq '"') {
+ if ($sanitis= e_quote eq '') {
+ $sanitise_quote =3D $c;
+
+ substr($res, $off, 1, $c);
+ n= ext;
+ } elsif ($sanitise_quote eq $c) {
+ = $sanitise_quote =3D '';
+ }
+ }
=
+
+ #print "c<$c> SQ<$sanitise_quot= e>\n";
+ if ($off !=3D 0 && $sanitise_quote = eq '*/' && $c ne "\t") {
+ substr= ($res, $off, 1, $;);
+ } elsif ($off !=3D 0 && $sani= tise_quote eq '//' && $c ne "\t") {
+ substr($res, $off, 1, $;);
+ } elsif ($off !=3D 0 &= & $sanitise_quote && $c ne "\t") {
+ = substr($res, $off, 1, 'X');
+ } else {
+ substr($res, $off, 1, $c);
+ }
+ }
+
+ if ($sanitise_quote eq '//') {
<= div>+ $sanitise_quote =3D '';
+ }
+
+ # The pathname on a #include may be surrounded by '<&#= 39; and '>'.
+ if ($res =3D~ /^.\s*\#\s*include\s+= \<(.*)\>/) {
+ my $clean =3D 'X' x length($1);=
+ $res =3D~ s@\<.*\>@<$clean>@;
+=
+ # The whole of a #error is a string.
+ } els= if ($res =3D~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
+ my= $clean =3D 'X' x length($1);
+ $res =3D~ s@(\#\s*(?= :error|warning)\s+).*@$1$clean@;
+ }
+
+ return $res;
+}
+
+sub ct= x_statement_block {
+ my ($linenr, $remain, $off) =3D @_;
=
+ my $line =3D $linenr - 1;
+ my $blk =3D '= 9;;
+ my $soff =3D $off;
+ my $coff =3D $off - = 1;
+ my $coff_set =3D 0;
+
+ my $= loff =3D 0;
+
+ my $type =3D '';
+ my $level =3D 0;
+ my @stack =3D ();
= + my $p;
+ my $c;
+ my $len =3D 0;
+
+ my $remainder;
+ while (1) {
+ @stack =3D (['', 0]) if ($#stack =3D=3D -1);
+
+ #warn "CSB: blk<$blk> remain<$remain>\n&qu= ot;;
+ # If we are about to drop off the end, pull in more
+ # context.
+ if ($off >=3D $len) {
+ for (; $remain > 0; $line++) {
+ last if (!= defined $lines[$line]);
+ next if ($lines[$line] =3D~ /^-/= );
+ $remain--;
+ $loff =3D $len;
+ $blk .=3D $lines[$line] . "\n";
+ $l= en =3D length($blk);
+ $line++;
+ last;
+ }
+ # Bail if there is no further context.=
+ #warn "CSB: blk<$blk> off<$off> len<= $len>\n";
+ if ($off >=3D $len) {
= + last;
+ }
+ }
+ $p =3D $= c;
+ $c =3D substr($blk, $off, 1);
+ $remaind= er =3D substr($blk, $off);
+
+ #warn "CSB= : c<$c> type<$type> level<$level> remainder<$remainder= > coff_set<$coff_set>\n";
+
+ # = Handle nested #if/#else.
+ if ($remainder =3D~ /^#\s*(?:ifnd= ef|ifdef|if)\s/) {
+ push(@stack, [ $type, $level ]);
+ } elsif ($remainder =3D~ /^#\s*(?:else|elif)\b/) {
+ ($type, $level) =3D @{$stack[$#stack - 1]};
+ } elsif = ($remainder =3D~ /^#\s*endif\b/) {
+ ($type, $level) =3D @{= pop(@stack)};
+ }
+
+ # Stateme= nt ends at the ';' or a close '}' at the
+ #= outermost level.
+ if ($level =3D=3D 0 && $c eq = 9;;') {
+ last;
+ }
+
<= /div>
+ # An else is really a conditional as long as its not else if
+ if ($level =3D=3D 0 && $coff_set =3D=3D 0 &&= ;
+ (!defined($p) || $p =3D~ /(?:\s|\}|\+)/) &&
+ $remainder =3D~ /^(else)(?:\s|{)/ &&
+ $remainder !~ /^else\s+if\b/) {
+ $coff =3D $off + le= ngth($1) - 1;
+ $coff_set =3D 1;
+ #warn &q= uot;CSB: mark coff<$coff> soff<$soff> 1<$1>\n";
<= /div>
+ #warn "[" . substr($blk, $soff, $coff - $soff + 1) = . "]\n";
+ }
+
+ if (= ($type eq '' || $type eq '(') && $c eq '(')= {
+ $level++;
+ $type =3D '(';
=
+ }
+ if ($type eq '(' && $c eq = ')') {
+ $level--;
+ $type =3D ($le= vel !=3D 0)? '(' : '';
+
+ if= ($level =3D=3D 0 && $coff < $soff) {
+ $coff = =3D $off;
+ $coff_set =3D 1;
+ #warn &quo= t;CSB: mark coff<$coff>\n";
+ }
+ = }
+ if (($type eq '' || $type eq '{') &= & $c eq '{') {
+ $level++;
+ $t= ype =3D '{';
+ }
+ if ($type eq '= {' && $c eq '}') {
+ $level--;
+ $type =3D ($level !=3D 0)? '{' : '';
+
+ if ($level =3D=3D 0) {
+ if (substr(= $blk, $off + 1, 1) eq ';') {
+ $off++;
<= div>+ }
+ last;
+ }
+ }<= br>
+ $off++;
+ }
+ # We are truly a= t the end, so shuffle to the next line.
+ if ($off =3D=3D $le= n) {
+ $loff =3D $len + 1;
+ $line++;
+ $remain--;
+ }
+
+ my $= statement =3D substr($blk, $soff, $off - $soff + 1);
+ my $co= ndition =3D substr($blk, $soff, $coff - $soff + 1);
+
+ #warn "STATEMENT<$statement>\n";
+ #= warn "CONDITION<$condition>\n";
+
+ #print "coff<$coff> soff<$off> loff<$loff>\n&qu= ot;;
+
+ return ($statement, $condition,
+ $line, $remain + 1, $off - $loff + 1, $level);
+}=
+
+sub statement_lines {
+ my ($= stmt) =3D @_;
+
+ # Strip the diff line prefixe= s and rip blank lines at start and end.
+ $stmt =3D~ s/(^|\n)= ./$1/g;
+ $stmt =3D~ s/^\s*//;
+ $stmt =3D~ s/\= s*$//;
+
+ my @stmt_lines =3D ($stmt =3D~ /\n/g= );
+
+ return $#stmt_lines + 2;
+= }
+
+sub statement_rawlines {
+ m= y ($stmt) =3D @_;
+
+ my @stmt_lines =3D ($stmt= =3D~ /\n/g);
+
+ return $#stmt_lines + 2;
<= /div>
+}
+
+sub statement_block_size {
<= /div>
+ my ($stmt) =3D @_;
+
+ $stmt =3D~ s= /(^|\n)./$1/g;
+ $stmt =3D~ s/^\s*\{//;
+ $stmt= =3D~ s/}\s*$//;
+ $stmt =3D~ s/^\s*//;
+ $stmt= =3D~ s/\s*$//;
+
+ my @stmt_lines =3D ($stmt = =3D~ /\n/g);
+ my @stmt_statements =3D ($stmt =3D~ /;/g);
=
+
+ my $stmt_lines =3D $#stmt_lines + 2;
=
+ my $stmt_statements =3D $#stmt_statements + 1;
+
+ if ($stmt_lines > $stmt_statements) {
+ return= $stmt_lines;
+ } else {
+ return $stmt_statem= ents;
+ }
+}
+
+sub= ctx_statement_full {
+ my ($linenr, $remain, $off) =3D @_;
+ my ($statement, $condition, $level);
+
+ my (@chunks);
+
+ # Grab the first con= ditional/block pair.
+ ($statement, $condition, $linenr, $rem= ain, $off, $level) =3D
+ ctx_statement_block($linenr, $rem= ain, $off);
+ #print "F: c<$condition> s<$state= ment> remain<$remain>\n";
+ push(@chunks, [ $co= ndition, $statement ]);
+ if (!($remain > 0 && $co= ndition =3D~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
+ ret= urn ($level, $linenr, @chunks);
+ }
+
=
+ # Pull in the following conditional/block pairs and see if they
<= /div>
+ # could continue the statement.
+ for (;;) {
<= /div>
+ ($statement, $condition, $linenr, $remain, $off, $level) =3D
+ ctx_statement_block($linenr, $remain, $off);
+ #print "C: c<$condition> s<$statement> remain<$rem= ain>\n";
+ last if (!($remain > 0 && $con= dition =3D~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
+ #print &= quot;C: push\n";
+ push(@chunks, [ $condition, $stateme= nt ]);
+ }
+
+ return ($level, $l= inenr, @chunks);
+}
+
+sub ctx_bl= ock_get {
+ my ($linenr, $remain, $outer, $open, $close, $off= ) =3D @_;
+ my $line;
+ my $start =3D $linenr -= 1;
+ my $blk =3D '';
+ my @o;
+ my @c;
+ my @res =3D ();
+
+ my $level =3D 0;
+ my @stack =3D ($level);
= + for ($line =3D $start; $remain > 0; $line++) {
+ next i= f ($rawlines[$line] =3D~ /^-/);
+ $remain--;
+=
+ $blk .=3D $rawlines[$line];
+
+ # Handle nested #if/#else.
+ if ($lines[$line] =3D~ /^.\= s*#\s*(?:ifndef|ifdef|if)\s/) {
+ push(@stack, $level);
=
+ } elsif ($lines[$line] =3D~ /^.\s*#\s*(?:else|elif)\b/) {
=
+ $level =3D $stack[$#stack - 1];
+ } elsif ($l= ines[$line] =3D~ /^.\s*#\s*endif\b/) {
+ $level =3D pop(@st= ack);
+ }
+
+ foreach my $c (sp= lit(//, $lines[$line])) {
+ ##print "C<$c>L<$= level><$open$close>O<$off>\n";
+ if ($o= ff > 0) {
+ $off--;
+ next;
<= div>+ }
+
+ if ($c eq $close && $le= vel > 0) {
+ $level--;
+ last if ($lev= el =3D=3D 0);
+ } elsif ($c eq $open) {
+ = $level++;
+ }
+ }
+
<= div>+ if (!$outer || $level <=3D 1) {
+ push(@res, $raw= lines[$line]);
+ }
+
+ last if = ($level =3D=3D 0);
+ }
+
+ return= ($level, @res);
+}
+sub ctx_block_outer {
<= /div>
+ my ($linenr, $remain) =3D @_;
+
+ m= y ($level, @r) =3D ctx_block_get($linenr, $remain, 1, '{', '}&#= 39;, 0);
+ return @r;
+}
+sub ctx= _block {
+ my ($linenr, $remain) =3D @_;
+
<= /div>
+ my ($level, @r) =3D ctx_block_get($linenr, $remain, 0, '{&#= 39;, '}', 0);
+ return @r;
+}
=
+sub ctx_statement {
+ my ($linenr, $remain, $off) =3D @= _;
+
+ my ($level, @r) =3D ctx_block_get($linen= r, $remain, 0, '(', ')', $off);
+ return @r;<= br>
+}
+sub ctx_block_level {
+ my ($= linenr, $remain) =3D @_;
+
+ return ctx_block_g= et($linenr, $remain, 0, '{', '}', 0);
+}
<= /div>
+sub ctx_statement_level {
+ my ($linenr, $remain, = $off) =3D @_;
+
+ return ctx_block_get($linenr,= $remain, 0, '(', ')', $off);
+}
+
+sub ctx_locate_comment {
+ my ($first_line= , $end_line) =3D @_;
+
+ # Catch a comment on t= he end of the line itself.
+ my ($current_comment) =3D ($rawl= ines[$end_line - 1] =3D~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
+ re= turn $current_comment if (defined $current_comment);
+
+ # Look through the context and try and figure out if there is a
+ # comment.
+ my $in_comment =3D 0;
+ $current_comment =3D '';
+ for (my $linenr =3D $= first_line; $linenr < $end_line; $linenr++) {
+ my $line = =3D $rawlines[$linenr - 1];
+ #warn "=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $line\n";
+ = if ($linenr =3D=3D $first_line and $line =3D~ m@^.\s*\*@) {
+= $in_comment =3D 1;
+ }
+ if ($line =3D~ m@= /\*@) {
+ $in_comment =3D 1;
+ }
+ if (!$in_comment && $current_comment ne '') {
+ $current_comment =3D '';
+ }
+ $current_comment .=3D $line . "\n" if ($in_comment);
+ if ($line =3D~ m@\*/@) {
+ $in_comment =3D 0;
=
+ }
+ }
+
+ chomp($cu= rrent_comment);
+ return($current_comment);
+}<= br>
+sub ctx_has_comment {
+ my ($first_line, $end_= line) =3D @_;
+ my $cmt =3D ctx_locate_comment($first_line, $= end_line);
+
+ ##print "LINE: $rawlines[$e= nd_line - 1 ]\n";
+ ##print "CMMT: $cmt\n";
+
+ return ($cmt ne '');
+}=
+
+sub raw_line {
+ my ($linenr,= $cnt) =3D @_;
+
+ my $offset =3D $linenr - 1;<= br>
+ $cnt++;
+
+ my $line;
=
+ while ($cnt) {
+ $line =3D $rawlines[$offset++];
<= /div>
+ next if (defined($line) && $line =3D~ /^-/);
=
+ $cnt--;
+ }
+
+ return $l= ine;
+}
+
+sub cat_vet {
+ my ($vet) =3D @_;
+ my ($res, $coded);
= +
+ $res =3D '';
+ while ($vet =3D~ /([= ^[:cntrl:]]*)([[:cntrl:]]|$)/g) {
+ $res .=3D $1;
<= div>+ if ($2 ne '') {
+ $coded =3D sprintf("^= %c", unpack('C', $2) + 64);
+ $res .=3D $coded= ;
+ }
+ }
+ $res =3D~ s/$/\$/;
+
+ return $res;
+}
= +
+my $av_preprocessor =3D 0;
+my $av_pending;<= br>
+my @av_paren_type;
+my $av_pend_colon;
+
+sub annotate_reset {
+ $av_preprocess= or =3D 0;
+ $av_pending =3D '_';
+ @av_= paren_type =3D ('E');
+ $av_pend_colon =3D 'O'= ;;
+}
+
+sub annotate_values {
+ my ($stream, $type) =3D @_;
+
+ m= y $res;
+ my $var =3D '_' x length($stream);
+ my $cur =3D $stream;
+
+ print "$s= tream\n" if ($dbg_values > 1);
+
+ whil= e (length($cur)) {
+ @av_paren_type =3D ('E') if ($#= av_paren_type < 0);
+ print " <" . join('= ;', @av_paren_type) .
+ "> <$type> <$= av_pending>" if ($dbg_values > 1);
+ if ($cur =3D= ~ /^(\s+)/o) {
+ print "WS($1)\n" if ($dbg_values= > 1);
+ if ($1 =3D~ /\n/ && $av_preprocessor) {=
+ $type =3D pop(@av_paren_type);
+ $av_p= reprocessor =3D 0;
+ }
+
+ } e= lsif ($cur =3D~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_')= {
+ print "CAST($1)\n" if ($dbg_values > 1);<= br>
+ push(@av_paren_type, $type);
+ $type =3D = 'C';
+
+ } elsif ($cur =3D~ /^($Type)\= s*(?:$Ident|,|\)|\(|\s*$)/) {
+ print "DECLARE($1)\n&q= uot; if ($dbg_values > 1);
+ $type =3D 'T';
<= /div>
+
+ } elsif ($cur =3D~ /^($Modifier)\s*/) {
+ print "MODIFIER($1)\n" if ($dbg_values > 1);
+ $type =3D 'T';
+
+ } elsi= f ($cur =3D~ /^(\#\s*define\s*$Ident)(\(?)/o) {
+ print &qu= ot;DEFINE($1,$2)\n" if ($dbg_values > 1);
*** 1791 LI= NES SKIPPED ***


<= /div>
--0000000000006acd1f05f7bcca27-- From nobody Sat Mar 25 20:55:12 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkWYX45dfz41hxL; Sat, 25 Mar 2023 20:55: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 4PkWYX3cfjz3sPJ; Sat, 25 Mar 2023 20:55:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679777712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Y7KYzU+iHQu0Axam/ljx/6Yqm5Sy1XFdwvFrc4yM5c=; b=LIn00/YF0d6p+zBbgKFxUUOpuQRIXnQBBIAzal0bEA/jKd5fFXgdxQ1AShH36HyPVFsIDh uax4M3dinDf4JmHvn4WGvgMz+0m4hR6AA+Uiz/zuHNoTE69xaflm/czmirBU+TLChvh8mx gxACRJMf/KgUqLnmSsStsyHF8ujgp27Q676joyTHJW144Ajr5w7uKQuSnqCGlVoK6ywhwQ ciSsQd9P7cUFodyWokt0hdDk8j8fOoU/LXeMX60jxbcdPXxcu0uhnoEiNUVQIKKSXZeQYZ fvvPjMg4p4iHThzrZYYtcRgwcAS1BfGXinTf1vBZX+pv245tktsAAEK5vtDf7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679777712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Y7KYzU+iHQu0Axam/ljx/6Yqm5Sy1XFdwvFrc4yM5c=; b=QNI5GuExi6feB5CTtiI9hKwH1+0LPChQaEqwprKj4Iphn1mQHN2OnWmCNybJLYLVZGg2eN nzsOEAKRaEw8mh+4GBbmkbac3og2iVnNnbVXNZccLC5izFoCtT9xiWnABYWFeNs4hnXX1u qWzUSFy/ogQqua1xCm2UaYa08pbrOQQ93Wq8Kt+K7ni5XwyLgw2W/pPYQar3TLkciGpik/ OayKavjW0jqQRvCho9LLvUqAenoMf76db+gzBsbUscGwL+w7N+LWXo8nXz31zGESfLrL3w 7PnWvIdEXm1376v2C6e/G0xNrV0FkyhK7EFrXvcNPKw8SM8fBmUI2hy6naNQKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679777712; a=rsa-sha256; cv=none; b=to3XBMKDNVsChyKtmPehmabNVRR1pZSa35/0gbN4wmVk2PNpegNJWN+8XI7ZAMadcxZ9so +sBwb+Wkz7V7JaNnvrcquMSMto0YgSuTJgMlBsHes2M0SiMmxHqLF2oxfe/eYtFDuwO0FA b5qCj9K8IB7RYHUGOJ+NrAjpvmmDoeSLW0ksgs6DC8QjAQfuJdPPr5gxFRE+D7i0qSsQqQ 9GREbCW0hmgQAH2uRKzDn+x5ykxlsKJ2RFeiOn/9ojSKbB4BSVFtVMZlCtPCGC4rKVxvu5 kSkJRVW1pSl8nHjmhLSyNFD56PY2c94lvriRAenbgNTu7N459dEeCo/LInaB5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkWYX2gtszF2H; Sat, 25 Mar 2023 20:55: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 32PKtCbt055930; Sat, 25 Mar 2023 20:55:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PKtCfF055929; Sat, 25 Mar 2023 20:55:12 GMT (envelope-from git) Date: Sat, 25 Mar 2023 20:55:12 GMT Message-Id: <202303252055.32PKtCfF055929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: f0fe68a965a2 - main - i386: ansify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0fe68a965a2f0b42c296fef2c756f168a57b326 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f0fe68a965a2f0b42c296fef2c756f168a57b326 commit f0fe68a965a2f0b42c296fef2c756f168a57b326 Author: Dmitry Chagin AuthorDate: 2023-03-25 20:21:03 +0000 Commit: Dmitry Chagin CommitDate: 2023-03-25 20:21:03 +0000 i386: ansify Reported by: clang 15 --- sys/i386/i386/db_disasm.c | 20 +++++--------------- sys/i386/i386/db_trace.c | 12 +++--------- sys/i386/i386/in_cksum_machdep.c | 5 +---- sys/i386/i386/machdep.c | 7 ++----- sys/i386/i386/sys_machdep.c | 8 ++------ 5 files changed, 13 insertions(+), 39 deletions(-) diff --git a/sys/i386/i386/db_disasm.c b/sys/i386/i386/db_disasm.c index 2d5a65fe31d3..46b0a1b8a895 100644 --- a/sys/i386/i386/db_disasm.c +++ b/sys/i386/i386/db_disasm.c @@ -938,11 +938,8 @@ static db_addr_t * Read address at location and return updated location. */ static db_addr_t -db_read_address(loc, short_addr, regmodrm, addrp) - db_addr_t loc; - int short_addr; - int regmodrm; - struct i_addr * addrp; /* out */ +db_read_address(db_addr_t loc, int short_addr, int regmodrm, + struct i_addr *addrp) { int mod, rm, sib, index, disp; @@ -1026,10 +1023,7 @@ db_read_address(loc, short_addr, regmodrm, addrp) } static void -db_print_address(seg, size, addrp) - const char * seg; - int size; - struct i_addr * addrp; +db_print_address(const char *seg, int size, struct i_addr *addrp) { if (addrp->is_reg) { db_printf("%s", db_reg[size][addrp->disp]); @@ -1059,12 +1053,8 @@ db_print_address(seg, size, addrp) * and return updated location. */ static db_addr_t -db_disasm_esc(loc, inst, short_addr, size, seg) - db_addr_t loc; - int inst; - int short_addr; - int size; - const char * seg; +db_disasm_esc(db_addr_t loc, int inst, int short_addr, int size, + const char *seg) { int regmodrm; const struct finst * fp; diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 47057906fa58..cc386cb88a8c 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -200,8 +200,7 @@ static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, * Figure out how many arguments were passed into the frame at "fp". */ static int -db_numargs(fp) - struct i386_frame *fp; +db_numargs(struct i386_frame *fp) { char *argp; int inst; @@ -232,13 +231,8 @@ retry: } static void -db_print_stack_entry(name, narg, argnp, argp, callpc, frame) - const char *name; - int narg; - char **argnp; - int *argp; - db_addr_t callpc; - void *frame; +db_print_stack_entry(const char *name, int narg, char **argnp, int *argp, + db_addr_t callpc, void *frame) { int n = narg >= 0 ? narg : 5; diff --git a/sys/i386/i386/in_cksum_machdep.c b/sys/i386/i386/in_cksum_machdep.c index 31ecd2baa7ca..528ce5ac80ff 100644 --- a/sys/i386/i386/in_cksum_machdep.c +++ b/sys/i386/i386/in_cksum_machdep.c @@ -69,10 +69,7 @@ __FBSDID("$FreeBSD$"); * other calculations. */ u_short -in_cksum_skip(m, len, skip) - struct mbuf *m; - int len; - int skip; +in_cksum_skip(struct mbuf *m, int len, int skip) { u_short *w; unsigned sum = 0; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 8e3b21dbe195..d59e95ed1a99 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -212,8 +212,7 @@ i386_clock_source_init(void) } static void -cpu_startup(dummy) - void *dummy; +cpu_startup(void *dummy) { uintmax_t memsize; char *sysenv; @@ -739,9 +738,7 @@ DB_SHOW_COMMAND(frame, db_show_frame) #endif void -sdtossd(sd, ssd) - struct segment_descriptor *sd; - struct soft_segment_descriptor *ssd; +sdtossd(struct segment_descriptor *sd, struct soft_segment_descriptor *ssd) { ssd->ssd_base = (sd->sd_hibase << 24) | sd->sd_lobase; ssd->ssd_limit = (sd->sd_hilimit << 16) | sd->sd_lolimit; diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index a0a1c273f467..eeff4b280696 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -334,9 +334,7 @@ i386_extend_pcb(struct thread *td) } int -i386_set_ioperm(td, uap) - struct thread *td; - struct i386_ioperm_args *uap; +i386_set_ioperm(struct thread *td, struct i386_ioperm_args *uap) { char *iomap; u_int i; @@ -372,9 +370,7 @@ i386_set_ioperm(td, uap) } int -i386_get_ioperm(td, uap) - struct thread *td; - struct i386_ioperm_args *uap; +i386_get_ioperm(struct thread *td, struct i386_ioperm_args *uap) { int i, state; char *iomap; From nobody Sat Mar 25 21:59:17 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkXzV0WJgz41mSF; Sat, 25 Mar 2023 21:59: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 4PkXzT6wtLz42Ty; Sat, 25 Mar 2023 21:59:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679781558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cIzQkRf/O2wAxn+BhqFUreVvWfB0NQTkLx3PL/T64Ro=; b=pvcZKrjEC+mBOHmkmy8795ZqwvUoetov2OhkzRgK6bO01CjxGdQZJ7pLOMwjY6w21FSQqI IRK7BgR9OWKhtpqsVXqpP/1fcwgRyABRlDgudGzWKIEm50DYItFmYbjk4VEpDDu3dGYYja EZqkwjhCngXmJeEAl5b6XX9Nhv0CD3kjlvOSaCX5P3Nr7ImxQcECK5da5hXypTLpohNnEx +IVKlBpqlZKP+/+c6z8uFB/vv/bTSOA3zjcaxarYRe0EcUxWGQTgQNelJdbSQN3k8uqMQS r64VJkDRbn5ytz4UEtEMVA19ssopNF31Jui40MclU6Au8YV/yaSgCy4Eu0CzkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679781558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cIzQkRf/O2wAxn+BhqFUreVvWfB0NQTkLx3PL/T64Ro=; b=pCx5CVy6YiN65lYDoVxsSVtC6ymjC+eIKITN9r3FNnAaJEqZmFIA2MLXc00sG48bSOAa40 DSvGWC/+XJlRjdlq0hJeiuenphgPYpNfffD76LIywrZhulAEbMAyn4TPt1Pzl4njICsAxh qWl44HJAWnIygVOl3jCYgjHJp4Odx+SpAb/ZbUuk0KmAW915ngsi9DAJ2zv5IM3iGoEcVz uaLtpjmvf/QbkoWeQ2YVqb0wV6ZGmwZtR+3zqOfe09hPZIrzWna37meA+QKXXXqCA2xIfx kqCCq9BZnAW8XkpBGUeMgDudu8Y9kFQgkYqDud7RUmUTg1Zk1a8MeMcPHhh1wg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679781558; a=rsa-sha256; cv=none; b=iKWtG2yZ5HMdInFN8ILnbjmJ8KLMc5qUS0fCOYjB+SoGG3c9qY6IkXJsbHOhrZbKNCIbAa Z55qBOLIioiyR/K+6kkmHDo6d9Uu/9UMUkqiJqAGgyCngUl+krQ04AxVwiRxLtoyIRjU+f dio/ZDBRaPT79qdgF5BDajZt+WwBMYUBi5t1hHwCyYyzvRmnzKwNbppR3CPxyGoC2FZVFx zhSg/H6XkR5Tq5Im9Ya6IVgubsGkWQRaJfaU+uiVNlpx7MLbZTJdbKKRi8BOZ4NMhrj9YU 2jMC6BFTtRUR+9oVcmO8Grfai8LkHPhADbsQ+lSzJ6Cmk/nFc8V0jxs0wOvx1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkXzT5ls2zGM9; Sat, 25 Mar 2023 21:59: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 32PLxHda055647; Sat, 25 Mar 2023 21:59:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PLxHoU055646; Sat, 25 Mar 2023 21:59:17 GMT (envelope-from git) Date: Sat, 25 Mar 2023 21:59:17 GMT Message-Id: <202303252159.32PLxHoU055646@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: 22eb66d961dc - main - vfs cache: always assert on ndp->ni_resflags List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 22eb66d961dc919538e0a418e7ad97c89aa4ac5b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=22eb66d961dc919538e0a418e7ad97c89aa4ac5b commit 22eb66d961dc919538e0a418e7ad97c89aa4ac5b Author: Mateusz Guzik AuthorDate: 2023-03-23 23:27:54 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-25 21:57:55 +0000 vfs cache: always assert on ndp->ni_resflags --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index e716113e6085..cc93158078d3 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -6148,6 +6148,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, ("%s: internal flags found in cn_flags %" PRIx64, __func__, cnp->cn_flags)); MPASS(cnp->cn_nameptr == cnp->cn_pnbuf); + MPASS(ndp->ni_resflags == 0); if (__predict_false(!cache_can_fplookup(&fpl))) { *status = fpl.status; @@ -6172,7 +6173,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, if (cnp->cn_pnbuf[0] == '/') { dvp = cache_fpl_handle_root(&fpl); - MPASS(ndp->ni_resflags == 0); ndp->ni_resflags = NIRES_ABS; } else { if (ndp->ni_dirfd == AT_FDCWD) { From nobody Sat Mar 25 22:16:36 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkYMS4FgCz41nXs; Sat, 25 Mar 2023 22:16: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 4PkYMS3jQxz45fQ; Sat, 25 Mar 2023 22:16:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679782596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZUA4MSoYUGBC1Wz2yoyAPJrWjfMRR9L0UWiyve0l6/I=; b=rfZP80BaqvzwHLpyFOw4QPW1zrl4SHhHi0ouDMjqafu4DzDBV0EuHvTJFzxCXoLH2zaR3W Uq9YdBuncDXCIq7EGDKXRqlRaxiUu7yRgm+yzvf6ifjmH4A+Ka39Mzi9tmTHo+Cd7Ba702 LtAKVdeXGiMeopQecjplcf4IWJm4PUJr+taNgJ8NtEXptYVoPZEsUfyozXX5/JlSmcVuys 00+w1m3ZcCcgGqVdZydko7wrBeTc0Q6RKRojLw7+x4kVkFMuOGlQ/YIbe8Rc91/InFK/fa fyMk4DdvZEVt9Phe3tndjG16v1Sxv5AsvHbxFwopHlWrciUFHsAt8mx5IAbbog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679782596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZUA4MSoYUGBC1Wz2yoyAPJrWjfMRR9L0UWiyve0l6/I=; b=KQGbsvZ6F0ct8aQMcHctyf307sozxGgcDFZIRNCghyLKoCQH4SiOZnQguE7O2WdZoOVTpN S2adsle4wNgszOo2E4QSr6oMAnW0cz1aoyiYJX/+bJyv6ofX++hrQVoonPTw0Itsp9eZpJ b1O2yR3Z3bdMw7efBiDfJeH/W7WKx5Tltb0neJsb05TxJb9kzXWX5A4gdRcS+P7PBv3pYI io+IxUJd7DQ0G4hVVo2bO9fcwqCkk3H4vQKPnjtRjVHNCWQfheDOkEw6xfr0v2CU9q8rFT vybVpfqojHObBlEekrZJ+sS5StC+kkRq2E5If5Vvjh2ke74GG+EMqznWjr3tCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679782596; a=rsa-sha256; cv=none; b=xpBRtC2f1sDIxnLqQvxy5m1HEfYht4uE/7QGyNOm3R3O3SF/0ltUy7zMkAfPrMTsdUrhuN W42ODaDcbhRhmPtgRtYgKHjHM8lF3ALTO3nqM4iqUppA1JnJ6KYTFsKVHobmx2tEbZ5Uxj 2yBsNQWEv7lvTrvZkbC+HDCF7gJhGAc5cSbPzpDXwncwMmAhdKfdxajHrhA+NjZAZLe2OG JfmMVSUkkZDLJmrNTlIctX75Q3vlwCXV5E6W2Eqjixav/sbJqwtCp7PWE7BBWuMvoIEhsp +UqsDQC7ynVWcAE4B3v57CrprwS7TPZsFNv/+EDAhVyfqdVuq82Wvcds3MF7Eg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkYMS2bjvzGjV; Sat, 25 Mar 2023 22:16: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 32PMGaN9089134; Sat, 25 Mar 2023 22:16:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PMGavs089133; Sat, 25 Mar 2023 22:16:36 GMT (envelope-from git) Date: Sat, 25 Mar 2023 22:16:36 GMT Message-Id: <202303252216.32PMGavs089133@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: 0e71f4f77c01 - main - vm: add unlocked page lookup before trying vm_fault_soft_fast List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 0e71f4f77c016b4087106e7c58b958667df8e1b2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0e71f4f77c016b4087106e7c58b958667df8e1b2 commit 0e71f4f77c016b4087106e7c58b958667df8e1b2 Author: Mateusz Guzik AuthorDate: 2023-03-25 14:40:55 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-25 22:14:59 +0000 vm: add unlocked page lookup before trying vm_fault_soft_fast Shaves a read lock + tryupgrade trip most of the time. Stats from doing a kernel build (counters not present in the tree): vm.fault_soft_fast_ok: 262653 vm.fault_soft_fast_failed_other: 41 vm.fault_soft_fast_failed_no_page: 39595772 vm.fault_soft_fast_failed_page_busy: 1929 vm.fault_soft_fast_failed_page_invalid: 22183 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39268 --- sys/vm/vm_fault.c | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 056e6e12e8c8..1f9063a5988a 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -348,13 +348,38 @@ vm_fault_soft_fast(struct faultstate *fs) MPASS(fs->vp == NULL); + /* + * If we fail, vast majority of the time it is because the page is not + * there to begin with. Opportunistically perform the lookup and + * subsequent checks without the object lock, revalidate later. + * + * Note: a busy page can be mapped for read|execute access. + */ + m = vm_page_lookup_unlocked(fs->first_object, fs->first_pindex); + if (m == NULL || !vm_page_all_valid(m) || + ((fs->prot & VM_PROT_WRITE) != 0 && vm_page_busied(m))) { + VM_OBJECT_WLOCK(fs->first_object); + return (FAULT_FAILURE); + } + vaddr = fs->vaddr; - vm_object_busy(fs->first_object); - m = vm_page_lookup(fs->first_object, fs->first_pindex); - /* A busy page can be mapped for read|execute access. */ - if (m == NULL || ((fs->prot & VM_PROT_WRITE) != 0 && - vm_page_busied(m)) || !vm_page_all_valid(m)) + + VM_OBJECT_RLOCK(fs->first_object); + + /* + * Now that we stabilized the state, revalidate the page is in the shape + * we encountered above. + */ + + if (m->object != fs->first_object || m->pindex != fs->first_pindex) goto fail; + + vm_object_busy(fs->first_object); + + if (!vm_page_all_valid(m) || + ((fs->prot & VM_PROT_WRITE) != 0 && vm_page_busied(m))) + goto fail_busy; + m_map = m; psind = 0; #if VM_NRESERVLEVEL > 0 @@ -390,7 +415,7 @@ vm_fault_soft_fast(struct faultstate *fs) if (pmap_enter(fs->map->pmap, vaddr, m_map, fs->prot, fs->fault_type | PMAP_ENTER_NOSLEEP | (fs->wired ? PMAP_ENTER_WIRED : 0), psind) != KERN_SUCCESS) - goto fail; + goto fail_busy; if (fs->m_hold != NULL) { (*fs->m_hold) = m; vm_page_wire(m); @@ -403,8 +428,13 @@ vm_fault_soft_fast(struct faultstate *fs) vm_map_lookup_done(fs->map, fs->entry); curthread->td_ru.ru_minflt++; return (FAULT_SUCCESS); -fail: +fail_busy: vm_object_unbusy(fs->first_object); +fail: + if (!VM_OBJECT_TRYUPGRADE(fs->first_object)) { + VM_OBJECT_RUNLOCK(fs->first_object); + VM_OBJECT_WLOCK(fs->first_object); + } return (FAULT_FAILURE); } @@ -1556,14 +1586,12 @@ RetryFault: if (fs.vp == NULL /* avoid locked vnode leak */ && (fs.entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) == 0 && (fs.fault_flags & (VM_FAULT_WIRE | VM_FAULT_DIRTY)) == 0) { - VM_OBJECT_RLOCK(fs.first_object); res = vm_fault_soft_fast(&fs); - if (res == FAULT_SUCCESS) + if (res == FAULT_SUCCESS) { + VM_OBJECT_ASSERT_UNLOCKED(fs.first_object); return (KERN_SUCCESS); - if (!VM_OBJECT_TRYUPGRADE(fs.first_object)) { - VM_OBJECT_RUNLOCK(fs.first_object); - VM_OBJECT_WLOCK(fs.first_object); } + VM_OBJECT_ASSERT_WLOCKED(fs.first_object); } else { VM_OBJECT_WLOCK(fs.first_object); } From nobody Sat Mar 25 22:55:49 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PkZDk1ZQbz41rKg; Sat, 25 Mar 2023 22:55: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 4PkZDk11twz4F0m; Sat, 25 Mar 2023 22:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679784950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pr5dstzAT0HCcYtPD6UjalzHR5A15IEey8AoN0Hnz94=; b=GAa/ODOcPF6ZXqfHVrIfThihFjFXS1RWT3DDxMuV22e5s7iVWfbI89FV2aglO+nm9EORQL +sMG0+2+7wUvUHt795DeNpz+Oq3h8nhwnXiQcdRi0GoQcO8lSUel6MdqkJ7cX9+EikE1Vy fKSdEBFKerozXrHj5HSTUC9UC9Qx0N9U571zdEMfTFtzrchPYwbvSm0SViXD9KxKQYk0Fq qnimF+Xm2sxRaNRogJbgfdM3hdUmVfhq3QNvduqjdDk50bN4P51gjBjwZ+FFrTZpn9Gctt 1wQ78JgCaBTGJAaX3DQqNEvma+zfps51+DY2UT3BZZTpEAEwNCUDS8iRqCEjsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679784950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pr5dstzAT0HCcYtPD6UjalzHR5A15IEey8AoN0Hnz94=; b=JB+q4x1flkNxp2SmptswYh8pC3UVI2l4feLPxSRz3yYRwt2ef3whJeiVFNu6lOX7I0dXBw wqlAXi+XBLXIuMn3kgjQE7gKc0znQsWh/R1M1NnGcwv82swWE0CgqAh7ZibNtnsXlwET1J YzPDSL4iSvDzPONeY8o8M+JyDf2q6QVpU9idcvZVbB6X0nKX1/LO7AYy07IA9YZdXwvAAv CHrqw9M7zgRY4s+KYyb32GH1sRllxfyO+IcTTlqnC0kvme8gZUqnMVP9rT898Kl/Ko4z5o FiG5fBhdsOTiR1Pyc7LGc73LU9TiRDkTAu6zjuQ30vLUhbpLAPEBhyfnot6Vnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679784950; a=rsa-sha256; cv=none; b=arpmXOQCRwXLouqpk7v8I3X257izSsDH5pRri7Fvn/sfVX0Lf66Ya8AdRNArFD3nzhu+dK 3U97VoGojJosqNInHwrF83zb1IiNg6yP0LRaZdQyzc6CSVuT4DzvhKhjw2SVPPZF7T4LkA RE3+6o3OxuuYYXtSUtnG1oSc2MTaR9atcvgR+FTiKdccTozn0yeA9VI0iyg7WC2LErdCgs A5Msz6Mpmf8iHSu9+ApSKX3xPMbDIqPKC8OP+Lc/kBIcxz59SoRVye59VkOSFclcDkSBfA Xt91dUdjYNb9ByMkBVq/EWEAYqPy/4xWpSQFtPHix/WBjhK10aTnXBXRxFv3Cw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PkZDk04qPzHKJ; Sat, 25 Mar 2023 22:55: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 32PMtn4k054031; Sat, 25 Mar 2023 22:55:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32PMtnil054030; Sat, 25 Mar 2023 22:55:49 GMT (envelope-from git) Date: Sat, 25 Mar 2023 22:55:49 GMT Message-Id: <202303252255.32PMtnil054030@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: 28f957b8b3a2 - main - vnode_pager_input: return runningbufspace back List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28f957b8b3a22086927451fee89789fdf596260b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28f957b8b3a22086927451fee89789fdf596260b commit 28f957b8b3a22086927451fee89789fdf596260b Author: Konstantin Belousov AuthorDate: 2023-03-24 21:12:21 +0000 Commit: Konstantin Belousov CommitDate: 2023-03-25 22:55:29 +0000 vnode_pager_input: return runningbufspace back Both vnode_pager_input_smlfs() and vnode_pager_generic_getpages() increment runningbufspace, but also both delegate io completion handling on the pbuf to either plain bdone() or filesystem-specific strategy routine. Accidentally, for e.g. UFS it is g_vfs_strategy()/g_vfs_done(). The later calls bufdone() which handles runningbufspace reclamation. For plain bdone() io done handler, nothing would return accounted b_runningbufspace back. Do it in the new helper vnode_pager_input_bdone(), as well as in vnode_pager_generic_getpages_done() explicitly. Note that potential multiple calls to runningbufwakeup() for the same pbuf or buf completion are safe. runningbufwakeup() clears accounting for the buffer, so second and later calls are nop. The problem was found due to tarfs using small vnode pager input but not g_vfs_strategy(). Reported by: des Reviewed by: markj, sjg Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39263 --- sys/vm/vnode_pager.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 56caf75d7f90..6103daaf13c2 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -640,6 +640,13 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t address, daddr_t *rtaddress, return (err); } +static void +vnode_pager_input_bdone(struct buf *bp) +{ + runningbufwakeup(bp); + bdone(bp); +} + /* * small block filesystem vnode pager input */ @@ -686,7 +693,7 @@ vnode_pager_input_smlfs(vm_object_t object, vm_page_t m) /* build a minimal buffer header */ bp->b_iocmd = BIO_READ; - bp->b_iodone = bdone; + bp->b_iodone = vnode_pager_input_bdone; KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred")); KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred")); bp->b_rcred = crhold(curthread->td_ucred); @@ -1204,6 +1211,8 @@ vnode_pager_generic_getpages_done(struct buf *bp) error = (bp->b_ioflags & BIO_ERROR) != 0 ? bp->b_error : 0; object = bp->b_vp->v_object; + runningbufwakeup(bp); + if (error == 0 && bp->b_bcount != bp->b_npages * PAGE_SIZE) { if (!buf_mapped(bp)) { bp->b_data = bp->b_kvabase;