From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53E345DB1EC; Mon, 19 Apr 2021 00:17: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 4FNnSG1wRRz4j23; Mon, 19 Apr 2021 00:17:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30C4B15815; Mon, 19 Apr 2021 00:17: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 13J0H2lH078801; Mon, 19 Apr 2021 00:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H2gN078800; Mon, 19 Apr 2021 00:17:02 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:02 GMT Message-Id: <202104190017.13J0H2gN078800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 5232a35f1ed7 - main - bhyve.8: Clean up block storage device backends description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5232a35f1ed7b8fa4f378897598438c2056ef60e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:02 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5232a35f1ed7b8fa4f378897598438c2056ef60e commit 5232a35f1ed7b8fa4f378897598438c2056ef60e Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 21:39:53 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:12 +0000 bhyve.8: Clean up block storage device backends description MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 4eba24455b69..5c73852b422c 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -405,29 +405,33 @@ must comply with .Xr netgraph 4 addressing rules. .Pp -Block storage devices: -.Bl -tag -width 10n -.It Pa /filename Ns Oo , Ns Ar block-device-options Oc -.It Pa /dev/xxx Ns Oo , Ns Ar block-device-options Oc +Block storage device backends: +.Sm off +.Bl -bullet +.It +.Ar /filename Op Cm \&, Ar block-device-options +.It +.Ar /dev/xxx Op Cm \&, Ar block-device-options .El +.Sm on .Pp The .Ar block-device-options are: -.Bl -tag -width 8n -.It Li nocache +.Bl -tag -width 10n +.It Cm nocache Open the file with .Dv O_DIRECT . -.It Li direct +.It Cm direct Open the file using .Dv O_SYNC . -.It Li ro +.It Cm ro Force the file to be opened read-only. -.It Li sectorsize= Ns Ar logical Ns Oo / Ns Ar physical Oc +.It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc Specify the logical and physical sector sizes of the emulated disk. The physical sector size is optional and is equal to the logical sector size if not explicitly specified. -.It Li nodelete +.It Cm nodelete Disable emulation of guest trim requests via .Dv DIOCGDELETE requests. @@ -647,7 +651,6 @@ Playback device, typically Recording device, typically .Ar /dev/dsp0 . .El -.El .It Fl U Ar uuid Set the universally unique identifier .Pq UUID From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7779A5DB48C; Mon, 19 Apr 2021 00:17: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 4FNnSH2rXrz4hrD; Mon, 19 Apr 2021 00:17:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE1015A23; Mon, 19 Apr 2021 00:17: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 13J0H31w078829; Mon, 19 Apr 2021 00:17:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H39r078828; Mon, 19 Apr 2021 00:17:03 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:03 GMT Message-Id: <202104190017.13J0H39r078828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 7c5829c94282 - main - bhyve.8: Clean up SCSI device backends section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c5829c942822561688c9b8239900773c6d82db4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:03 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7c5829c942822561688c9b8239900773c6d82db4 commit 7c5829c942822561688c9b8239900773c6d82db4 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 21:49:18 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:12 +0000 bhyve.8: Clean up SCSI device backends section MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 5c73852b422c..f0109fa3d969 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -437,16 +437,19 @@ Disable emulation of guest trim requests via requests. .El .Pp -SCSI devices: -.Bl -tag -width 10n -.It Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ns Oo , Ns Ar scsi-device-options Oc +SCSI device backends: +.Sm off +.Bl -bullet +.It +.Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc .El +.Sm on .Pp The .Ar scsi-device-options are: .Bl -tag -width 10n -.It Li iid= Ns Ar IID +.It Cm iid= Ns Ar IID Initiator ID to use when sending requests to specified CTL port. The default value is 0. .El From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47CBB5DB35B; Mon, 19 Apr 2021 00:17:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FNnSJ5WZJz4j0J; Mon, 19 Apr 2021 00:17:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80AB315816; Mon, 19 Apr 2021 00:17: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 13J0H4X8078850; Mon, 19 Apr 2021 00:17:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H4a7078849; Mon, 19 Apr 2021 00:17:04 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:04 GMT Message-Id: <202104190017.13J0H4a7078849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 2d00b57022f0 - main - bhyve.8: Clean up 9P device backends section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d00b57022f09561706afef9050e0b527c41314a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:05 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2d00b57022f09561706afef9050e0b527c41314a commit 2d00b57022f09561706afef9050e0b527c41314a Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 21:52:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:12 +0000 bhyve.8: Clean up 9P device backends section MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index f0109fa3d969..1410769d8a37 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -454,16 +454,19 @@ Initiator ID to use when sending requests to specified CTL port. The default value is 0. .El .Pp -9P devices: -.Bl -tag -width 10n -.It Pa sharename=/path/to/share[,9p-device-options] +9P device backends: +.Sm off +.Bl -bullet +.It +.Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options .El +.Sm on .Pp The .Ar 9p-device-options are: .Bl -tag -width 10n -.It Li ro +.It Cm ro Expose the share in read-only mode. .El .Pp From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F005C5DB2B8; Mon, 19 Apr 2021 00:17:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FNnSK5YGtz4htV; Mon, 19 Apr 2021 00:17:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E67515817; Mon, 19 Apr 2021 00:17:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13J0H5dQ078871; Mon, 19 Apr 2021 00:17:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H5DY078870; Mon, 19 Apr 2021 00:17:05 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:05 GMT Message-Id: <202104190017.13J0H5DY078870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 2fda01a1b7e9 - main - bhyve.8: Clean up TTY, boot ROM, and pass-through descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2fda01a1b7e958e6cfffda512954b8d6c40a064e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:06 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2fda01a1b7e958e6cfffda512954b8d6c40a064e commit 2fda01a1b7e958e6cfffda512954b8d6c40a064e Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 22:09:22 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:12 +0000 bhyve.8: Clean up TTY, boot ROM, and pass-through descriptions MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 1410769d8a37..06356a64f596 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -470,28 +470,28 @@ are: Expose the share in read-only mode. .El .Pp -TTY devices: +TTY device backends: .Bl -tag -width 10n -.It Li stdio +.It Cm stdio Connect the serial port to the standard input and output of the .Nm process. -.It Pa /dev/xxx +.It Ar /dev/xxx Use the host TTY device for serial port I/O. .El .Pp -Boot ROM device: +Boot ROM device backends: .Bl -tag -width 10n -.It Pa romfile +.It Ar romfile Map .Ar romfile in the guest address space reserved for boot firmware. .El .Pp -Pass-through devices: +Pass-through device backends: .Bl -tag -width 10n -.It Ns Ar slot Ns / Ns Ar bus Ns / Ns Ar function +.It Ns Ar slot Ns Cm \&/ Ns Ar bus Ns Cm \&/ Ns Ar function Connect to a PCI device on the host at the selector described by .Ar slot , .Ar bus , From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB0475DB51B; Mon, 19 Apr 2021 00:17: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 4FNnSN3NPPz4hcs; Mon, 19 Apr 2021 00:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD73D156C5; Mon, 19 Apr 2021 00:17:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13J0H7Gm078913; Mon, 19 Apr 2021 00:17:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H7JG078912; Mon, 19 Apr 2021 00:17:07 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:07 GMT Message-Id: <202104190017.13J0H7JG078912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 8b97e97548bd - main - bhyve.8: Improve framebuffer backends description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b97e97548bdc74cf3b4939a0b21cfdd27d8c11c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:09 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8b97e97548bdc74cf3b4939a0b21cfdd27d8c11c commit 8b97e97548bdc74cf3b4939a0b21cfdd27d8c11c Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 22:59:44 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:13 +0000 bhyve.8: Improve framebuffer backends description - Use appropriate mdoc macros - Document that tcp= is a synonym to rfb= (tcp is used in the examples, but never mentioned) - Clarify the IP address specification MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 62 +++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 88be882039c4..afc3a5c615c8 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -540,35 +540,52 @@ resize at present. Emergency write is advertised, but no-op at present. .El .Pp -Framebuffer devices: +Framebuffer devices backends: +.Bl -bullet +.Sm off +.It +.Op Cm rfb= Ar ip-and-port +.Op Cm ,w= Ar width +.Op Cm ,h= Ar height +.Op Cm ,vga= Ar vgaconf +.Op Cm ,wait +.Op Cm ,password= Ar password +.Sm on +.El +.Pp +Configuration options are defined as follows: .Bl -tag -width 10n -.It Xo -.Oo rfb= Ns Oo Ar IP\&: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns -.Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= Ns -.Ar password Oc -.Xc -.Bl -tag -width 8n -.It Ar IPv4:port No or Ar [IPv6%zone]:port -An -.Ar IP -address and a +.It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port +An IP address and a port VNC should listen on. +There are two formats: +.Pp +.Bl -bullet -compact +.It IPv4 +.Sm off +.Op Ar IPv4 Cm \&: .Ar port -VNC should listen on. +.Sm on +.It IPv6 +.Sm off +.Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port +.Sm on +.El +.Pp The default is to listen on localhost IPv4 address and default VNC port 5900. An IPv6 address must be enclosed in square brackets and may contain an optional zone identifier. -.It Ar width No and Ar height +.It Cm w= Ns Ar width No and Cm h= Ns Ar height A display resolution, width and height, respectively. If not specified, a default resolution of 1024x768 pixels will be used. Minimal supported resolution is 640x480 pixels, and maximum is 1920x1200 pixels. -.It Ar vgaconf +.It Cm vga= Ns Ar vgaconf Possible values for this option are -.Dq io +.Cm io (default), -.Dq on +.Cm on , and -.Dq off . +.Cm off . PCI graphics cards have a dual personality in that they are standard PCI devices with BAR addressing, but may also implicitly decode legacy VGA I/O space @@ -576,18 +593,18 @@ implicitly decode legacy VGA I/O space and memory space .Pq 64KB at Ad 0xA0000 . The default -.Dq io +.Cm io option should be used for guests that attempt to issue BIOS calls which result in I/O port queries, and fail to boot if I/O decode is disabled. .Pp The -.Dq on +.Cm on option should be used along with the CSM BIOS capability in UEFI to boot traditional BIOS guests that require the legacy VGA I/O and memory regions to be available. .Pp The -.Dq off +.Cm off option should be used for the UEFI guests that assume that VGA adapter is present if they detect the I/O ports. An example of such a guest is @@ -600,19 +617,18 @@ Please refer to the wiki page .Pq Lk https://wiki.freebsd.org/bhyve for configuration notes of particular guests. -.It wait +.It Cm wait Instruct .Nm to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use. -.It password +.It Cm password= Ns Ar password This type of authentication is known to be cryptographically weak and is not intended for use on untrusted networks. Many implementations will want to use stronger security, such as running the session over an encrypted channel provided by IPsec or SSH. .El -.El .Pp xHCI USB devices: .Bl -tag -width 10n From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FDDF5DB39C; Mon, 19 Apr 2021 00:17: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 4FNnSQ20mPz4hnl; Mon, 19 Apr 2021 00:17:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18D4515A24; Mon, 19 Apr 2021 00:17: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 13J0HAdN078961; Mon, 19 Apr 2021 00:17:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0HAt7078960; Mon, 19 Apr 2021 00:17:10 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:10 GMT Message-Id: <202104190017.13J0HAt7078960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: d5fcc4b6066e - main - bhyve.8: Improve AHCI backends documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5fcc4b6066e878ed70bce7a52d6aca605befde5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:10 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d5fcc4b6066e878ed70bce7a52d6aca605befde5 commit d5fcc4b6066e878ed70bce7a52d6aca605befde5 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 23:44:23 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:13 +0000 bhyve.8: Improve AHCI backends documentation - Document the backend format. MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index e5eec5288204..7bbb663665d7 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -681,15 +681,29 @@ and .Cm disable . .El .Pp -AHCI devices: +AHCI device backends: +.Bl -bullet +.It +.Sm off +.Op Oo Cm hd\&: | cd\&: Oc Ar path +.Op Cm ,nmrr= Ar nmrr +.Op Cm ,ser= Ar # +.Op Cm ,rev= Ar # +.Op Cm ,model= Ar # +.Sm on +.El +.Pp +Configuration options are defined as follows: .Bl -tag -width 10n -.It Li nmrr -Nominal Media Rotation Rate, known as RPM. value 1 will indicate device as Solid State Disk. default value is 0, not report. -.It Li ser +.It Cm nmrr +Nominal Media Rotation Rate, known as RPM. +Value 1 will indicate device as Solid State Disk. +Default value is 0, not report. +.It Cm ser Serial Number with maximum 20 characters. -.It Li rev +.It Cm rev Revision Number with maximum 8 characters. -.It Li model +.It Cm model Model Number with maximum 40 characters. .El .Pp From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 447265DB444; Mon, 19 Apr 2021 00:17: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 4FNnSR3Svtz4j0b; Mon, 19 Apr 2021 00:17:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3917E15A25; Mon, 19 Apr 2021 00:17: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 13J0HBMb078982; Mon, 19 Apr 2021 00:17:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0HBnQ078981; Mon, 19 Apr 2021 00:17:11 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:11 GMT Message-Id: <202104190017.13J0HBnQ078981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 061f37d28097 - main - bhyve: Document the format for HD audio backends MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 061f37d280976e0f79f823c732fa80825ce48ded Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:14 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=061f37d280976e0f79f823c732fa80825ce48ded commit 061f37d280976e0f79f823c732fa80825ce48ded Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 23:50:29 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:14 +0000 bhyve: Document the format for HD audio backends - This change is done for consistency with other backend definitions. MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 7bbb663665d7..bf3c792dd235 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -707,12 +707,21 @@ Revision Number with maximum 8 characters. Model Number with maximum 40 characters. .El .Pp -HD Audio devices: +HD Audio device backends: +.Bl -bullet +.It +.Sm off +.Op Cm play= Ar playback +.Op Cm ,rec= Ar recording +.Sm on +.El +.Pp +Configuration options are defined as follows: .Bl -tag -width 10n -.It Li play +.It Cm play Playback device, typically .Ar /dev/dsp0 . -.It Li rec +.It Cm rec Recording device, typically .Ar /dev/dsp0 . .El From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB4BE5DB492; Mon, 19 Apr 2021 00:17:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FNnSM3yjZz4hrL; Mon, 19 Apr 2021 00:17:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C56E2156C4; Mon, 19 Apr 2021 00:17:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13J0H6he078892; Mon, 19 Apr 2021 00:17:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H6Lw078891; Mon, 19 Apr 2021 00:17:06 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:06 GMT Message-Id: <202104190017.13J0H6Lw078891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 3f4c771f64e8 - main - bhyve.8: Clean up virtio console device backends description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f4c771f64e816750de08ab6fd7e7bf29398f5fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:08 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3f4c771f64e816750de08ab6fd7e7bf29398f5fb commit 3f4c771f64e816750de08ab6fd7e7bf29398f5fb Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 22:23:26 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:13 +0000 bhyve.8: Clean up virtio console device backends description MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 06356a64f596..88be882039c4 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -509,9 +509,14 @@ The host device must have been reserved at boot-time using the loader variable as described in .Xr vmm 4 . .Pp -Virtio console devices: -.Bl -tag -width 10n -.It Li port1= Ns Pa /path/to/port1.sock Ns ,anotherport= Ns Pa ... +Virtio console device backends: +.Bl -bullet +.Sm off +.It +.Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ... +.Sm on +.El +.Pp A maximum of 16 ports per device can be created. Every port is named and corresponds to a Unix domain socket created by .Nm . @@ -519,7 +524,7 @@ Every port is named and corresponds to a Unix domain socket created by accepts at most one connection per port at a time. .Pp Limitations: -.Bl -bullet -offset 2n +.Bl -bullet -offset .It Due to lack of destructors in .Nm , @@ -527,12 +532,13 @@ sockets on the filesystem must be cleaned up manually after .Nm exits. .It -There is no way to use the "console port" feature, nor the console port +There is no way to use the +.Dq console port +feature, nor the console port resize at present. .It Emergency write is advertised, but no-op at present. .El -.El .Pp Framebuffer devices: .Bl -tag -width 10n From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A72E05DB43B; Mon, 19 Apr 2021 00:17: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 4FNnSP1Vn7z4j4W; Mon, 19 Apr 2021 00:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEE50156C6; Mon, 19 Apr 2021 00:17: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 13J0H8NO078940; Mon, 19 Apr 2021 00:17:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0H8Rl078939; Mon, 19 Apr 2021 00:17:08 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:08 GMT Message-Id: <202104190017.13J0H8Rl078939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 6eff58acc776 - main - bhyve.8: Improve documentation of NVME backend MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6eff58acc776d8308863f49b89664997d4642a4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:09 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6eff58acc776d8308863f49b89664997d4642a4e commit 6eff58acc776d8308863f49b89664997d4642a4e Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 23:16:51 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:13 +0000 bhyve.8: Improve documentation of NVME backend - Document the configuration format. - Document two additional configuration options: eui64 and dsm. MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index afc3a5c615c8..e5eec5288204 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -630,32 +630,55 @@ Many implementations will want to use stronger security, such as running the session over an encrypted channel provided by IPsec or SSH. .El .Pp -xHCI USB devices: +xHCI USB device backends: .Bl -tag -width 10n -.It Li tablet +.It Cm tablet A USB tablet device which provides precise cursor synchronization when using VNC. .El .Pp -NVMe devices: +NVMe device backends: +.Bl -bullet +.Sm off +.It +.Ar devpath +.Op Cm ,maxq= Ar # +.Op Cm ,qsz= Ar # +.Op Cm ,ioslots= Ar # +.Op Cm ,sectsz= Ar # +.Op Cm ,ser= Ar # +.Op Cm ,eui64= Ar # +.Op Cm ,dsm= Ar opt +.Sm on +.El +.Pp +Configuration options are defined as follows: .Bl -tag -width 10n -.It Li devpath +.It Ar devpath Accepted device paths are: .Ar /dev/blockdev or .Ar /path/to/image or -.Ar ram=size_in_MiB . -.It Li maxq +.Cm ram= Ns Ar size_in_MiB . +.It Cm maxq Max number of queues. -.It Li qsz +.It Cm qsz Max elements in each queue. -.It Li ioslots +.It Cm ioslots Max number of concurrent I/O requests. -.It Li sectsz +.It Cm sectsz Sector size (defaults to blockif sector size). -.It Li ser +.It Cm ser Serial number with maximum 20 characters. +.It Cm eui64 +IEEE Extended Unique Identifier (8 byte value). +.It Cm dsm +DataSet Management support. +Supported values are: +.Cm auto , enable , +and +.Cm disable . .El .Pp AHCI devices: From owner-dev-commits-src-main@freebsd.org Mon Apr 19 00:17:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA1E95DB3A9; Mon, 19 Apr 2021 00:17: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 4FNnSS4mc6z4htt; Mon, 19 Apr 2021 00:17:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E23D15A26; Mon, 19 Apr 2021 00:17: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 13J0HCFo079003; Mon, 19 Apr 2021 00:17:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J0HCqH079002; Mon, 19 Apr 2021 00:17:12 GMT (envelope-from git) Date: Mon, 19 Apr 2021 00:17:12 GMT Message-Id: <202104190017.13J0HCqH079002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 8d9fefe64334 - main - bhyve.8: Fix mandoc -Tlint issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d9fefe64334818a27812658bf9efd0371fbc77c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 00:17:14 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8d9fefe64334818a27812658bf9efd0371fbc77c commit 8d9fefe64334818a27812658bf9efd0371fbc77c Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-18 23:53:06 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 00:16:14 +0000 bhyve.8: Fix mandoc -Tlint issues While here, keep network backends section consistent with other sections. MFC after: 2 weeks --- usr.sbin/bhyve/bhyve.8 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index bf3c792dd235..79b6d9bfb240 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -56,7 +56,7 @@ .Sm off .Ar memsize .Oo -.Cm K No | Cm k No | Cm M No | Cm m No | Cm G No | Cm g No | Cm T No | Cm t +.Cm K | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | Cm t .Oc .Sm on .Oc @@ -339,8 +339,7 @@ If is not specified, the device emulation has no backend and can be considered unconnected. .Pp -Network backends formats for -.Ar conf : +Network device backends: .Sm off .Bl -bullet .It @@ -524,7 +523,7 @@ Every port is named and corresponds to a Unix domain socket created by accepts at most one connection per port at a time. .Pp Limitations: -.Bl -bullet -offset +.Bl -bullet .It Due to lack of destructors in .Nm , @@ -560,12 +559,12 @@ An IP address and a port VNC should listen on. There are two formats: .Pp .Bl -bullet -compact -.It IPv4 +.It .Sm off .Op Ar IPv4 Cm \&: .Ar port .Sm on -.It IPv6 +.It .Sm off .Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port .Sm on From owner-dev-commits-src-main@freebsd.org Mon Apr 19 05:13:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54AF45E1CF1; Mon, 19 Apr 2021 05:13: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 4FNw2h1xTQz3Bq7; Mon, 19 Apr 2021 05:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 352B919893; Mon, 19 Apr 2021 05:13: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 13J5DmLU078892; Mon, 19 Apr 2021 05:13:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J5DlD8078891; Mon, 19 Apr 2021 05:13:47 GMT (envelope-from git) Date: Mon, 19 Apr 2021 05:13:47 GMT Message-Id: <202104190513.13J5DlD8078891@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: 2235c7feac95 - main - less: upgrade to v581. 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: 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 05:13:48 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=2235c7feac959bcc9ddfd6a2bc6be32102b1f84c commit 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c Merge: 8d9fefe64334 1737d9dd586f Author: Xin LI AuthorDate: 2021-04-19 02:46:19 +0000 Commit: Xin LI CommitDate: 2021-04-19 02:46:19 +0000 less: upgrade to v581. MFC after: 2 weeks contrib/less/INSTALL | 10 +- contrib/less/NEWS | 50 ++- contrib/less/README | 38 +- contrib/less/brac.c | 2 +- contrib/less/ch.c | 54 ++- contrib/less/charset.c | 154 ++++---- contrib/less/charset.h | 2 +- contrib/less/cmd.h | 20 +- contrib/less/cmdbuf.c | 87 ++--- contrib/less/command.c | 189 +++++++--- contrib/less/cvt.c | 12 +- contrib/less/decode.c | 367 ++++++++++--------- contrib/less/edit.c | 33 +- contrib/less/filename.c | 29 +- contrib/less/forwback.c | 11 +- contrib/less/funcs.h | 35 +- contrib/less/help.c | 24 +- contrib/less/ifile.c | 39 +- contrib/less/input.c | 45 ++- contrib/less/jump.c | 2 +- contrib/less/less.h | 419 +++++++++++---------- contrib/less/less.hlp | 22 +- contrib/less/less.nro | 204 +++++++++-- contrib/less/lessecho.c | 14 +- contrib/less/lessecho.nro | 8 +- contrib/less/lesskey.c | 163 ++++----- contrib/less/lesskey.h | 38 +- contrib/less/lesskey.nro | 25 +- contrib/less/lglob.h | 110 +++--- contrib/less/line.c | 905 ++++++++++++++++++++++++++-------------------- contrib/less/linenum.c | 31 +- contrib/less/lsystem.c | 44 +-- contrib/less/main.c | 85 +++-- contrib/less/mark.c | 26 +- contrib/less/optfunc.c | 309 ++++++++++++---- contrib/less/option.c | 25 +- contrib/less/option.h | 62 ++-- contrib/less/opttbl.c | 154 +++++--- contrib/less/os.c | 94 ++++- contrib/less/output.c | 612 ++++++++++++++++--------------- contrib/less/pattern.c | 11 +- contrib/less/pattern.h | 18 +- contrib/less/pckeys.h | 38 +- contrib/less/position.c | 12 +- contrib/less/position.h | 12 +- contrib/less/prompt.c | 88 ++--- contrib/less/regexp.h | 14 +- contrib/less/screen.c | 780 ++++++++++++++++++++++++++++----------- contrib/less/scrsize.c | 2 +- contrib/less/search.c | 359 +++++++++++++----- contrib/less/signal.c | 14 +- contrib/less/tags.c | 77 ++-- contrib/less/ttyin.c | 51 ++- contrib/less/version.c | 29 +- usr.bin/less/defines.h | 13 +- 55 files changed, 3773 insertions(+), 2298 deletions(-) diff --cc contrib/less/README index 81cb7e091296,000000000000..0c1acfd5d3f6 mode 100644,000000..100644 --- a/contrib/less/README +++ b/contrib/less/README @@@ -1,257 -1,0 +1,251 @@@ +************************************************************************** +************************************************************************** +** ** +** The FreeBSD Project has chosen to redistribute and modify Less under ** +** the 'Less License' (as described in the 'LICENSE' file). ** +** ** +************************************************************************** +************************************************************************** + - Less, version 563 ++ Less, version 581 + - This is the distribution of less, version 563, released 13 Jun 2020. ++ This is the distribution of less, version 581, released 06 Apr 2021. + This program is part of the GNU project (http://www.gnu.org). + + This program is free software. You may redistribute it and/or + modify it under the terms of either: + + 1. The GNU General Public License, as published by the Free + Software Foundation; either version 3, or (at your option) any + later version. A copy of this license is in the file COPYING. + or + 2. The Less License, in the file LICENSE. + - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. ++ Please report any problems at https://github.com/gwsw/less/issues. ++ See https://greenwoodsoftware.com/less for the latest info. + Source repository is at https://github.com/gwsw/less.git. + +========================================================================= + - This is the distribution of "less", a paginator similar to "more" or "pg". - +The formatted manual page is in less.man. +The manual page nroff source is in less.nro. +Major changes made since the last posted version are in NEWS. + +======================================================================= - PRE-INSTALLATION (when using git) - - If you are building from a clone of a git repository, - type "make -f Makefile.aut". - If you are building from a numbered release package (a tar or zip file - with a name like less-999.tar.gz or less-999.zip), you should skip this step. - - ======================================================================= - INSTALLATION (Unix systems only): ++INSTALLATION (Unix & Linux systems only): + +1. Move the distributed source to its own directory and unpack it, + if you have not already done so. + - 2. Type "sh configure". ++2. If you are building from a clone of a git repository, ++ type "make -f Makefile.aut". ++ If you are building from a numbered release package (a tar or ++ zip file with a name like less-999.tar.gz or less-999.zip downloaded ++ from greenwoodsoftware.com, not from github), you should skip this step. ++ ++3. Type "sh configure". + This will generate a Makefile and a defines.h. + Warning: if you have a GNU sed, make sure it is version 2.05 or later. + + The file INSTALL describes the usage of the configure program in + general. In addition, these options to configure are supported: + + --with-editor=program + Specifies the default editor program used by the "v" command. + The default is "vi". + + --with-regex=lib + Specifies the regular expression library used by less for pattern + matching. The default is "auto", which means the configure program + finds a regular expression library automatically. Other values are: + gnu Use the GNU regex library. + pcre Use the PCRE library. + pcre2 Use the PCRE2 library. + posix Use the POSIX-compatible regcomp. + regcmp Use the regcmp library. + re_comp Use the re_comp library. + regcomp Use the V8-compatible regcomp. + regcomp-local Use Henry Spencer's V8-compatible regcomp + (source is supplied with less). + none No regular expressions, only simple string matching. + + --with-secure + Builds a "secure" version of less, with some features disabled + to prevent users from viewing other files, accessing shell + commands, etc. + + - 3. It is a good idea to look over the generated Makefile and defines.h ++4. It is a good idea to look over the generated Makefile and defines.h + and make sure they look ok. If you know of any peculiarities of + your system that configure might not have detected, you may fix the + Makefile now. Take particular notice of the list of "terminal" + libraries in the LIBS definition in the Makefile; these may need + to be edited. The terminal libraries will be some subset of + -lncurses -lcurses -ltermcap -ltermlib + + If you wish, you may edit defines.h to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page "less.nro" and the help page "less.hlp" + to remove the descriptions of the features which you are removing. + If you edit less.hlp, you should run "make -f Makefile.aut help.c". + - 4. Type "make" and watch the fun. ++5. Type "make" and watch the fun. + - 5. If the make succeeds, it will generate the programs "less", ++6. If the make succeeds, it will generate the programs "less", + "lesskey" and "lessecho" in your current directory. Test the + generated programs. + - 6. When satisfied that it works, if you wish to install it ++7. When satisfied that it works, if you wish to install it + in a public place, type "make install". + + The default install destinations are: + Executables (less, lesskey, lessecho) in /usr/local/bin + Documentation (less.nro, lesskey.nro) in /usr/local/man/man1 + If you want to install any of these files elsewhere, define + bindir and/or mandir to the appropriate directories. + - If you have any problems building or running "less", suggestions, - complaints, etc., you may mail to bug-less@gnu.org. + +Note to hackers: comments noting possible improvements are enclosed +in double curly brackets {{ like this }}. + +(Note that the above note was originally written at a time when +"hackers" most commonly meant "enthusiastic and dedicated computer +programmers", not "persons who attempt to circumvent computer security".) + + + +======================================================================= +INSTALLATION (MS-DOS systems only, + with Microsoft C, Borland C, or DJGPP) + +1. Move the distributed source to its own directory. + Depending on your compiler, you may need to convert the source + to have CR-LF rather than LF as line terminators. + +2. If you are using Microsoft C, rename MAKEFILE.DSU to MAKEFILE. + If you are using Borland C, rename MAKEFILE.DSB to MAKEFILE. + If you are using DJGPP, rename MAKEFILE.DSG to MAKEFILE. + +3. Look at MAKEFILE to make sure that the definitions for CC and LIBDIR + are correct. CC should be the name of your C compiler and + LIBDIR should be the directory where the C libraries reside (for + Microsoft C only). If these definitions need to be changed, you can + either modify the definitions directly in MAKEFILE, or set your + environment variables CC and/or LIBDIR to override the definitions + in MAKEFILE. + +4. If you wish, you may edit DEFINES.DS to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page LESS.MAN and the help page HELP.C + to remove the descriptions of the features which you are removing. + +5. Run your "make" program and watch the fun. + If your "make" requires a flag to import environment variables, + you should use that flag. + If your compiler runs out of memory, try running "make -n >cmds.bat" + and then run cmds.bat. + +6. If the make succeeds, it will generate the programs "LESS.EXE" and + "LESSKEY.EXE" in your current directory. Test the generated programs. + +7. When satisfied that it works, you may wish to install LESS.EXE and + LESSKEY.EXE in a directory which is included in your PATH. + + + +======================================================================= +INSTALLATION (Windows-95, Windows-98 and Windows-NT systems only, + with Borland C or Microsoft Visual C++) + +1. Move the distributed source to its own directory. + +2. If you are using Borland C, rename Makefile.wnb to Makefile. + If you are using Microsoft Visual C++, rename Makefile.wnm to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.wn to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "make" and watch the fun. + +6. If the make succeeds, it will generate the programs "less.exe" and + "lesskey.exe" in your current directory. Test the generated programs. + +7. When satisfied that it works, if you wish to install it + in a public place, type "make install". + See step 6 of the Unix installation instructions for details + on how to change the default installation directories. + + + +======================================================================= +INSTALLATION (OS/2 systems only, + with EMX C) + +1. Move the distributed source to its own directory. + +2. Rename Makefile.o2e to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.o2 to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "make" and watch the fun. + +6. If the make succeeds, it will generate the programs "less.exe" and + "lesskey.exe" in your current directory. Test the generated programs. + +7. Make sure you have the emx runtime installed. You need the emx DLLs + emx.dll and emxlibcs.dll and also the termcap database, termcap.dat. + Make sure you have termcap.dat either in the default location or + somewhere in a directory listed in the PATH or INIT environment + variables. + +8. When satisfied that it works, you may wish to install less.exe, + lesskey.exe and scrsize.exe in a directory which is included in + your PATH. scrsize.exe is required only if you use a terminal + emulator such as xterm or rxvt. + + + +======================================================================= +INSTALLATION (OS-9 systems only, + with Microware C or Ultra C) + +1. Move the distributed source to its own directory. + +2. If you are using Microware C, rename Makefile.o9c to Makefile. + If you are using Ultra C, rename Makefile.o9u to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.o9 to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "dmake" and watch the fun. + The standard OS-9 "make" will probably not work. If you don't + have dmake, you can get a copy from os9archive.rtsi.com. + +6. If the make succeeds, it will generate the programs "less" and + "lesskey" in your current directory. Test the generated programs. + +7. When satisfied that it works, if you wish to install it + in a public place, type "dmake install". + See step 6 of the Unix installation instructions for details + on how to change the default installation directories. + +======================================================================= +ACKNOWLEDGMENTS: + Some versions of the less distribution are packaged using + Info-ZIP's compression utility. + Info-ZIP's software is free and can be obtained as source + code or executables from various anonymous-ftp sites, + including ftp.uu.net:/pub/archiving/zip. diff --cc contrib/less/command.c index 8e0ae4b34d67,000000000000..ae59181c2827 mode 100644,000000..100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@@ -1,1987 -1,0 +1,2060 @@@ +/* $FreeBSD$ */ +/* - * Copyright (C) 1984-2020 Mark Nudelman ++ * Copyright (C) 1984-2021 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information, see the README file. + */ + + +/* + * User-level command processor. + */ + +#include "less.h" +#if MSDOS_COMPILER==WIN32C +#include +#endif +#include "position.h" +#include "option.h" +#include "cmd.h" + +extern int erase_char, erase2_char, kill_char; +extern int sigs; +extern int quit_if_one_screen; +extern int squished; +extern int sc_width; +extern int sc_height; +extern char *kent; +extern int swindow; +extern int jump_sline; +extern int quitting; +extern int wscroll; +extern int top_scroll; +extern int ignore_eoi; +extern int secure; +extern int hshift; +extern int bs_mode; +extern int show_attn; +extern int less_is_more; +extern int status_col; +extern POSITION highest_hilite; +extern POSITION start_attnpos; +extern POSITION end_attnpos; +extern char *every_first_cmd; +extern char version[]; +extern struct scrpos initial_scrpos; +extern IFILE curr_ifile; +extern void *ml_search; +extern void *ml_examine; +extern int wheel_lines; +#if SHELL_ESCAPE || PIPEC +extern void *ml_shell; +#endif +#if EDITOR +extern char *editor; +extern char *editproto; +#endif - extern int screen_trashed; /* The screen has been overwritten */ ++extern int screen_trashed; /* The screen has been overwritten */ +extern int shift_count; +extern int oldbot; +extern int forw_prompt; ++extern int incr_search; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif + +#if SHELL_ESCAPE - static char *shellcmd = NULL; /* For holding last shell command for "!!" */ ++static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +#endif - static int mca; /* The multicharacter command (action) */ - static int search_type; /* The previous type of search */ - static LINENUM number; /* The number typed by the user */ - static long fraction; /* The fractional part of the number */ ++static int mca; /* The multicharacter command (action) */ ++static int search_type; /* The previous type of search */ ++static LINENUM number; /* The number typed by the user */ ++static long fraction; /* The fractional part of the number */ +static struct loption *curropt; +static int opt_lower; +static int optflag; +static int optgetname; +static POSITION bottompos; +static int save_hshift; +static int save_bs_mode; +#if PIPEC +static char pipec; +#endif + +/* Stack of ungotten chars (via ungetcc) */ +struct ungot { + struct ungot *ug_next; + LWCHAR ug_char; +}; +static struct ungot* ungot = NULL; + +static void multi_search LESSPARAMS((char *pattern, int n, int silent)); + +/* + * Move the cursor to start of prompt line before executing a command. + * This looks nicer if the command takes a long time before + * updating the screen. + */ + static void +cmd_exec(VOID_PARAM) +{ + clear_attn(); + clear_bot(); + flush(); +} + +/* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; - deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; - init_mouse(); +} + +/* + * Set up the display to start a new multi-character command. + */ + static void +start_mca(action, prompt, mlist, cmdflags) + int action; + constant char *prompt; + void *mlist; + int cmdflags; +{ + set_mca(action); + cmd_putstr(prompt); + set_mlist(mlist, cmdflags); +} + + public int +in_mca(VOID_PARAM) +{ + return (mca != 0 && mca != A_PREFIX); +} + +/* + * Set up the display to start a new search command. + */ + static void +mca_search(VOID_PARAM) +{ +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + set_mca(A_FILTER); + else +#endif + if (search_type & SRCH_FORW) + set_mca(A_F_SEARCH); + else + set_mca(A_B_SEARCH); + + if (search_type & SRCH_NO_MATCH) + cmd_putstr("Non-match "); + if (search_type & SRCH_FIRST_FILE) + cmd_putstr("First-file "); + if (search_type & SRCH_PAST_EOF) + cmd_putstr("EOF-ignore "); + if (search_type & SRCH_NO_MOVE) + cmd_putstr("Keep-pos "); + if (search_type & SRCH_NO_REGEX) + cmd_putstr("Regex-off "); ++ if (search_type & SRCH_WRAP) ++ cmd_putstr("Wrap "); + +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + cmd_putstr("&/"); + else +#endif + if (search_type & SRCH_FORW) + cmd_putstr("/"); + else + cmd_putstr("?"); + forw_prompt = 0; + set_mlist(ml_search, 0); +} + +/* + * Set up the display to start a new toggle-option command. + */ + static void +mca_opt_toggle(VOID_PARAM) +{ + int no_prompt; + int flag; + char *dash; + + no_prompt = (optflag & OPT_NO_PROMPT); + flag = (optflag & ~OPT_NO_PROMPT); + dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; + + set_mca(A_OPT_TOGGLE); + cmd_putstr(dash); + if (optgetname) + cmd_putstr(dash); + if (no_prompt) + cmd_putstr("(P)"); + switch (flag) + { + case OPT_UNSET: + cmd_putstr("+"); + break; + case OPT_SET: + cmd_putstr("!"); + break; + } + forw_prompt = 0; + set_mlist(NULL, 0); +} + +/* + * Execute a multicharacter command. + */ + static void +exec_mca(VOID_PARAM) +{ + char *cbuf; + + cmd_exec(); + cbuf = get_cmdbuf(); + + switch (mca) + { + case A_F_SEARCH: + case A_B_SEARCH: + multi_search(cbuf, (int) number, 0); + break; +#if HILITE_SEARCH + case A_FILTER: + search_type ^= SRCH_NO_MATCH; + set_filter_pattern(cbuf, search_type); + break; +#endif + case A_FIRSTCMD: + /* + * Skip leading spaces or + signs in the string. + */ + while (*cbuf == '+' || *cbuf == ' ') + cbuf++; + if (every_first_cmd != NULL) + free(every_first_cmd); + if (*cbuf == '\0') + every_first_cmd = NULL; + else + every_first_cmd = save(cbuf); + break; + case A_OPT_TOGGLE: + toggle_option(curropt, opt_lower, cbuf, optflag); + curropt = NULL; + break; + case A_F_BRACKET: + match_brac(cbuf[0], cbuf[1], 1, (int) number); + break; + case A_B_BRACKET: + match_brac(cbuf[1], cbuf[0], 0, (int) number); + break; +#if EXAMINE + case A_EXAMINE: + if (secure) + break; + edit_list(cbuf); +#if TAGS + /* If tag structure is loaded then clean it up. */ + cleantags(); +#endif + break; +#endif +#if SHELL_ESCAPE + case A_SHELL: + /* + * !! just uses whatever is in shellcmd. + * Otherwise, copy cmdbuf to shellcmd, + * expanding any special characters ("%" or "#"). + */ + if (*cbuf != '!') + { + if (shellcmd != NULL) + free(shellcmd); + shellcmd = fexpand(cbuf); + } + + if (secure) + break; + if (shellcmd == NULL) + lsystem("", "!done"); + else + lsystem(shellcmd, "!done"); + break; +#endif +#if PIPEC + case A_PIPE: + if (secure) + break; + (void) pipe_mark(pipec, cbuf); + error("|done", NULL_PARG); + break; +#endif + } +} + +/* + * Is a character an erase or kill char? + */ + static int +is_erase_char(c) + int c; +{ + return (c == erase_char || c == erase2_char || c == kill_char); +} + +/* + * Is a character a carriage return or newline? + */ + static int +is_newline_char(c) + int c; +{ + return (c == '\n' || c == '\r'); +} + +/* + * Handle the first char of an option (after the initial dash). + */ + static int +mca_opt_first_char(c) + int c; +{ + int flag = (optflag & ~OPT_NO_PROMPT); + if (flag == OPT_NO_TOGGLE) + { + switch (c) + { + case '_': + /* "__" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } else + { + switch (c) + { + case '+': + /* "-+" = UNSET. */ + optflag = (flag == OPT_UNSET) ? + OPT_TOGGLE : OPT_UNSET; + mca_opt_toggle(); + return (MCA_MORE); + case '!': + /* "-!" = SET */ + optflag = (flag == OPT_SET) ? + OPT_TOGGLE : OPT_SET; + mca_opt_toggle(); + return (MCA_MORE); + case CONTROL('P'): + optflag ^= OPT_NO_PROMPT; + mca_opt_toggle(); + return (MCA_MORE); + case '-': + /* "--" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } + /* Char was not handled here. */ + return (NO_MCA); +} + +/* + * Add a char to a long option name. + * See if we've got a match for an option name yet. + * If so, display the complete name and stop + * accepting chars until user hits RETURN. + */ + static int +mca_opt_nonfirst_char(c) + int c; +{ + char *p; + char *oname; + int err; + + if (curropt != NULL) + { + /* + * Already have a match for the name. + * Don't accept anything but erase/kill. + */ + if (is_erase_char(c)) + return (MCA_DONE); + return (MCA_MORE); + } + /* + * Add char to cmd buffer and try to match + * the option name. + */ + if (cmd_char(c) == CC_QUIT) + return (MCA_DONE); + p = get_cmdbuf(); + opt_lower = ASCII_IS_LOWER(p[0]); + err = 0; + curropt = findopt_name(&p, &oname, &err); + if (curropt != NULL) + { + /* + * Got a match. + * Remember the option and + * display the full option name. + */ + cmd_reset(); + mca_opt_toggle(); + for (p = oname; *p != '\0'; p++) + { + c = *p; + if (!opt_lower && ASCII_IS_LOWER(c)) + c = ASCII_TO_UPPER(c); + if (cmd_char(c) != CC_OK) + return (MCA_DONE); + } + } else if (err != OPT_AMBIG) + { + bell(); + } + return (MCA_MORE); +} + +/* + * Handle a char of an option toggle command. + */ + static int +mca_opt_char(c) + int c; +{ + PARG parg; + + /* + * This may be a short option (single char), + * or one char of a long option name, + * or one char of the option parameter. + */ + if (curropt == NULL && len_cmdbuf() == 0) + { + int ret = mca_opt_first_char(c); + if (ret != NO_MCA) + return (ret); + } + if (optgetname) + { + /* We're getting a long option name. */ + if (!is_newline_char(c)) + return (mca_opt_nonfirst_char(c)); + if (curropt == NULL) + { + parg.p_string = get_cmdbuf(); + error("There is no --%s option", &parg); + return (MCA_DONE); + } + optgetname = FALSE; + cmd_reset(); + } else + { + if (is_erase_char(c)) + return (NO_MCA); + if (curropt != NULL) + /* We're getting the option parameter. */ + return (NO_MCA); + curropt = findopt(c); + if (curropt == NULL) + { + parg.p_string = propt(c); + error("There is no %s option", &parg); + return (MCA_DONE); + } + opt_lower = ASCII_IS_LOWER(c); + } + /* + * If the option which was entered does not take a + * parameter, toggle the option immediately, + * so user doesn't have to hit RETURN. + */ + if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || + !opt_has_param(curropt)) + { + toggle_option(curropt, opt_lower, "", optflag); + return (MCA_DONE); + } + /* + * Display a prompt appropriate for the option parameter. + */ + start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0); + return (MCA_MORE); +} + +/* + * Handle a char of a search command. + */ + static int +mca_search_char(c) + int c; +{ + int flag = 0; + + /* + * Certain characters as the first char of + * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag ++ * ! Toggle the NO_MATCH flag ++ * * Toggle the PAST_EOF flag ++ * @ Toggle the FIRST_FILE flag + */ + if (len_cmdbuf() > 0) + return (NO_MCA); + + switch (c) + { + case '*': + if (less_is_more) + break; + case CONTROL('E'): /* ignore END of file */ + if (mca != A_FILTER) + flag = SRCH_PAST_EOF; + break; + case '@': + if (less_is_more) + break; + case CONTROL('F'): /* FIRST file */ + if (mca != A_FILTER) + flag = SRCH_FIRST_FILE; + break; + case CONTROL('K'): /* KEEP position */ + if (mca != A_FILTER) + flag = SRCH_NO_MOVE; + break; ++ case CONTROL('W'): /* WRAP around */ ++ if (mca != A_FILTER) ++ flag = SRCH_WRAP; ++ break; + case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ + flag = SRCH_NO_REGEX; + break; + case CONTROL('N'): /* NOT match */ + case '!': + flag = SRCH_NO_MATCH; + break; + } + + if (flag != 0) + { - search_type ^= flag; ++ /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ ++ search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); + mca_search(); + return (MCA_MORE); + } + return (NO_MCA); +} + +/* + * Handle a character of a multi-character command. + */ + static int +mca_char(c) + int c; +{ + int ret; + + switch (mca) + { + case 0: + /* + * We're not in a multicharacter command. + */ + return (NO_MCA); + + case A_PREFIX: + /* + * In the prefix of a command. + * This not considered a multichar command + * (even tho it uses cmdbuf, etc.). + * It is handled in the commands() switch. + */ + return (NO_MCA); + + case A_DIGIT: + /* + * Entering digits of a number. + * Terminated by a non-digit. + */ - if (!((c >= '0' && c <= '9') || c == '.') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) ++ if ((c >= '0' && c <= '9') || c == '.') ++ break; ++ switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) + { ++ case A_NOACTION: ++ /* ++ * Ignore this char and get another one. ++ */ ++ return (MCA_MORE); ++ case A_INVALID: + /* *** 2736 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Apr 19 05:50:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D52C15E2EB1; Mon, 19 Apr 2021 05:50: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 4FNwrp5j0tz3DJy; Mon, 19 Apr 2021 05:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B29AE19E9E; Mon, 19 Apr 2021 05:50: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 13J5oIZY025554; Mon, 19 Apr 2021 05:50:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J5oIoq025547; Mon, 19 Apr 2021 05:50:18 GMT (envelope-from git) Date: Mon, 19 Apr 2021 05:50:18 GMT Message-Id: <202104190550.13J5oIoq025547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: dead34f82219 - main - [ath_hal] ar9300: save TSF across full chip reset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dead34f82219b4017effc3a2e50ae3476870f6ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 05:50:18 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=dead34f82219b4017effc3a2e50ae3476870f6ab commit dead34f82219b4017effc3a2e50ae3476870f6ab Author: Adrian Chadd AuthorDate: 2021-03-31 03:30:24 +0000 Commit: Adrian Chadd CommitDate: 2021-04-19 05:49:54 +0000 [ath_hal] ar9300: save TSF across full chip reset This saves the TSF across a a full reset. The TSF is otherwise cleared and subsequent beaconing stops until the TSF catches up to nexttbtt. --- sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c index 96a0e8741592..97276398c4d4 100644 --- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c +++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c @@ -4538,7 +4538,7 @@ ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *ch u_int8_t clk_25mhz = AH9300(ah)->clk_25mhz; HAL_BOOL stopped, cal_ret; HAL_BOOL apply_last_iqcorr = AH_FALSE; - + uint64_t tsf; if (OS_REG_READ(ah, AR_IER) == AR_IER_ENABLE) { HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE, "** Reset called with WLAN " @@ -4869,10 +4869,15 @@ ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *ch /* Mark PHY inactive prior to reset, to be undone in ar9300_init_bb () */ ar9300_mark_phy_inactive(ah); + /* Save/restore TSF across a potentially full reset */ + /* XXX TODO: only do this if we do a cold reset */ + tsf = ar9300_get_tsf64(ah); if (!ar9300_chip_reset(ah, chan, reset_type)) { HALDEBUG(ah, HAL_DEBUG_RESET, "%s: chip reset failed\n", __func__); FAIL(HAL_EIO); } + if (tsf != 0) + ar9300_set_tsf64(ah, tsf); OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); From owner-dev-commits-src-main@freebsd.org Mon Apr 19 05:52:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C0FC5E346B; Mon, 19 Apr 2021 05:52: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 4FNwvj3ZZgz3Dl5; Mon, 19 Apr 2021 05:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DC6819EC1; Mon, 19 Apr 2021 05:52: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 13J5qnPu031127; Mon, 19 Apr 2021 05:52:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J5qn91031126; Mon, 19 Apr 2021 05:52:49 GMT (envelope-from git) Date: Mon, 19 Apr 2021 05:52:49 GMT Message-Id: <202104190552.13J5qn91031126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: bed90bf8ed5c - main - [ath_hal] Add get/set NAV functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bed90bf8ed5c8fd69822529a839bacad762817a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 05:52:49 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=bed90bf8ed5c8fd69822529a839bacad762817a2 commit bed90bf8ed5c8fd69822529a839bacad762817a2 Author: Adrian Chadd AuthorDate: 2021-03-31 16:38:15 +0000 Commit: Adrian Chadd CommitDate: 2021-04-19 05:52:31 +0000 [ath_hal] Add get/set NAV functions The NAV (network allocation vector) register reflects the current MAC tracking of NAV - when it will stay quiet before transmitting. Other devices transmit their frame durations in their 802.11 PHY headers and all devices that hear a frame - even if it's one in an encoding they don't understand - will understand the low bitrate PHY header that includes the frame duration. So, they'll set NAV to this value so they'll stay quiet until the transmit completes. Anyway, sometimes the PHY NAV header is garbled and sometimes, notably older broadcom devices, will fake a long NAV so they can get "cleaner" air for local calibration. When this happens, the hardware will stay quiet for quite some time and this can lead to missed/stuck beacons, or (for Very Large Values) a MAC hang. This code just adds the ability to get/set the NAV; the driver will need to take care of using it during transmit hangs and beacon misses to see if it's due to a trash looking NAV. --- .../dev/ath/ath_hal/ar9300/ar9300_freebsd.c | 19 +++++++++++++++ sys/dev/ath/ath_hal/ah.h | 2 ++ sys/dev/ath/ath_hal/ar5210/ar5210.h | 2 ++ sys/dev/ath/ath_hal/ar5210/ar5210_attach.c | 2 ++ sys/dev/ath/ath_hal/ar5210/ar5210_misc.c | 23 ++++++++++++++++++ sys/dev/ath/ath_hal/ar5211/ar5211.h | 2 ++ sys/dev/ath/ath_hal/ar5211/ar5211_attach.c | 2 ++ sys/dev/ath/ath_hal/ar5211/ar5211_misc.c | 23 ++++++++++++++++++ sys/dev/ath/ath_hal/ar5212/ar5212.h | 2 ++ sys/dev/ath/ath_hal/ar5212/ar5212_attach.c | 2 ++ sys/dev/ath/ath_hal/ar5212/ar5212_misc.c | 27 ++++++++++++++++++++++ 11 files changed, 106 insertions(+) diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c index 37e64bc86cdd..68e5f018cc6c 100644 --- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c +++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c @@ -69,6 +69,23 @@ ar9300_get_next_tbtt(struct ath_hal *ah) return (OS_REG_READ(ah, AR_NEXT_TBTT_TIMER)); } +static u_int +ar9300_get_nav(struct ath_hal *ah) +{ + uint32_t reg; + + reg = OS_REG_READ(ah, AR_NAV); + if (reg == 0xdeadbeef) + return 0; + return reg; +} + +static void +ar9300_set_nav(struct ath_hal *ah, u_int nav) +{ + + OS_REG_WRITE(ah, AR_NAV, nav); +} /* * TODO: implement the antenna diversity control for AR9485 and @@ -484,6 +501,8 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah) /* ah_get11nExtBusy */ ah->ah_set11nMac2040 = ar9300_set_11n_mac2040; ah->ah_setChainMasks = ar9300SetChainMasks; + ah->ah_getNav = ar9300_get_nav; + ah->ah_setNav = ar9300_set_nav; /* ah_get11nRxClear */ /* ah_set11nRxClear */ diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h index e39ff2b7d03d..4e811a5237ac 100644 --- a/sys/dev/ath/ath_hal/ah.h +++ b/sys/dev/ath/ath_hal/ah.h @@ -1404,6 +1404,8 @@ struct ath_hal { HAL_QUIET_FLAG flag); void __ahdecl(*ah_setChainMasks)(struct ath_hal *, uint32_t, uint32_t); + u_int __ahdecl(*ah_getNav)(struct ath_hal*); + void __ahdecl(*ah_setNav)(struct ath_hal*, u_int); /* DFS functions */ void __ahdecl(*ah_enableDfs)(struct ath_hal *ah, diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210.h b/sys/dev/ath/ath_hal/ar5210/ar5210.h index 373c676e25b3..f09e99b1ce9e 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210.h +++ b/sys/dev/ath/ath_hal/ar5210/ar5210.h @@ -269,6 +269,8 @@ extern void ar5210SetChainMasks(struct ath_hal *, uint32_t, uint32_t); extern void ar5210EnableDfs(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5210GetDfsThresh(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5210UpdateDiagReg(struct ath_hal *ah, uint32_t val); +extern void ar5210SetNav(struct ath_hal *ah, u_int val); +extern u_int ar5210GetNav(struct ath_hal *ah); extern u_int ar5210GetKeyCacheSize(struct ath_hal *); extern HAL_BOOL ar5210IsKeyCacheEntryValid(struct ath_hal *, uint16_t); diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c index 22afc12a6dcc..8bbd7e9d600e 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c +++ b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c @@ -145,6 +145,8 @@ static const struct ath_hal_private ar5210hal = {{ .ah_getDfsThresh = ar5210GetDfsThresh, /* XXX procRadarEvent */ /* XXX isFastClockEnabled */ + .ah_getNav = ar5210GetNav, + .ah_setNav = ar5210SetNav, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5210GetKeyCacheSize, diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c index 347ad8891e36..7c4df40a712f 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c +++ b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c @@ -710,3 +710,26 @@ ar5210UpdateDiagReg(struct ath_hal *ah, uint32_t val) val |= AR_DIAG_SW_DIS_CRYPTO; OS_REG_WRITE(ah, AR_DIAG_SW, val); } + +/* + * Get the current NAV value from the hardware. + */ +u_int +ar5210GetNav(struct ath_hal *ah) +{ + uint32_t reg; + + reg = OS_REG_READ(ah, AR_NAV); + return (reg); +} + +/* + * Set the current NAV value to the hardware. + */ +void +ar5210SetNav(struct ath_hal *ah, u_int val) +{ + + OS_REG_WRITE(ah, AR_NAV, val); +} + diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211.h b/sys/dev/ath/ath_hal/ar5211/ar5211.h index 186e69e9cd84..94a60162cbd8 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211.h +++ b/sys/dev/ath/ath_hal/ar5211/ar5211.h @@ -291,6 +291,8 @@ extern uint32_t ar5211Get11nExtBusy(struct ath_hal *); extern HAL_BOOL ar5211GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *); extern void ar5211SetChainMasks(struct ath_hal *ah, uint32_t, uint32_t); +extern void ar5211SetNav(struct ath_hal *ah, u_int); +extern u_int ar5211GetNav(struct ath_hal *ah); extern void ar5211EnableDfs(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5211GetDfsThresh(struct ath_hal *, HAL_PHYERR_PARAM *); diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c index 1914cc3ea4cf..6253e7b8c9c5 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c +++ b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c @@ -145,6 +145,8 @@ static const struct ath_hal_private ar5211hal = {{ .ah_getDfsThresh = ar5211GetDfsThresh, /* XXX procRadarEvent */ /* XXX isFastClockEnabled */ + .ah_setNav = ar5211SetNav, + .ah_getNav = ar5211GetNav, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5211GetKeyCacheSize, diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c b/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c index ea1327b11a6a..5bdae89a3055 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c +++ b/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c @@ -733,3 +733,26 @@ void ar5211GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) { } + +/* + * Get the current NAV value from the hardware. + */ +u_int +ar5211GetNav(struct ath_hal *ah) +{ + uint32_t reg; + + reg = OS_REG_READ(ah, AR_NAV); + return (reg); +} + +/* + * Set the current NAV value to the hardware. + */ +void +ar5211SetNav(struct ath_hal *ah, u_int val) +{ + + OS_REG_WRITE(ah, AR_NAV, val); +} + diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h index f80f88c5df85..3a08c1911a1c 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212.h +++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h @@ -529,6 +529,8 @@ extern HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period, extern HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *); extern void ar5212SetChainMasks(struct ath_hal *, uint32_t, uint32_t); +extern u_int ar5212GetNav(struct ath_hal *); +extern void ar5212SetNav(struct ath_hal *, u_int); extern HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c index 82bc762f75d2..0dd26558506a 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c @@ -137,6 +137,8 @@ static const struct ath_hal_private ar5212hal = {{ .ah_setQuiet = ar5212SetQuiet, .ah_getMibCycleCounts = ar5212GetMibCycleCounts, .ah_setChainMasks = ar5212SetChainMasks, + .ah_getNav = ar5212GetNav, + .ah_setNav = ar5212SetNav, /* DFS Functions */ .ah_enableDfs = ar5212EnableDfs, diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c index 577e1e7491b3..e6239902d713 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c @@ -1458,3 +1458,30 @@ ar5212SetChainMasks(struct ath_hal *ah, uint32_t tx_chainmask, uint32_t rx_chainmask) { } + +/* + * Get the current NAV value from the hardware. + * + * 0xdeadbeef indicates the hardware is currently powered off. + */ +u_int +ar5212GetNav(struct ath_hal *ah) +{ + uint32_t reg; + + reg = OS_REG_READ(ah, AR_NAV); + + if (reg == 0xdeadbeef) + return (0); + return (reg); +} + +/* + * Set the current NAV value to the hardware. + */ +void +ar5212SetNav(struct ath_hal *ah, u_int val) +{ + + OS_REG_WRITE(ah, AR_NAV, val); +} From owner-dev-commits-src-main@freebsd.org Mon Apr 19 05:59:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F13435E35A4; Mon, 19 Apr 2021 05:59: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 4FNx3V6YNJz3F5Y; Mon, 19 Apr 2021 05:59:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D377B19E7C; Mon, 19 Apr 2021 05:59: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 13J5xYgL031694; Mon, 19 Apr 2021 05:59:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J5xYeD031693; Mon, 19 Apr 2021 05:59:34 GMT (envelope-from git) Date: Mon, 19 Apr 2021 05:59:34 GMT Message-Id: <202104190559.13J5xYeD031693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 61c83c4e8b6f - main - [ath] Add ath_hal_getnav and ath_hal_setnav so the driver layer can check the NAV as appropriate. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61c83c4e8b6fba915b2261fb019ad77d107c7b2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 05:59:35 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=61c83c4e8b6fba915b2261fb019ad77d107c7b2b commit 61c83c4e8b6fba915b2261fb019ad77d107c7b2b Author: Adrian Chadd AuthorDate: 2021-04-01 04:48:59 +0000 Commit: Adrian Chadd CommitDate: 2021-04-19 05:59:28 +0000 [ath] Add ath_hal_getnav and ath_hal_setnav so the driver layer can check the NAV as appropriate. --- sys/dev/ath/if_athvar.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 1d2f842197cd..f36f66f6c3f4 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -1492,6 +1492,10 @@ void ath_intr(void *); ((*(_ah)->ah_setChainMasks)((_ah), (_txchainmask), (_rxchainmask))) #define ath_hal_set_quiet(_ah, _p, _d, _o, _f) \ ((*(_ah)->ah_setQuiet)((_ah), (_p), (_d), (_o), (_f))) +#define ath_hal_getnav(_ah) \ + ((*(_ah)->ah_getNav)((_ah))) +#define ath_hal_setnav(_ah, _val) \ + ((*(_ah)->ah_setNav)((_ah), (_val))) #define ath_hal_spectral_supported(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_SPECTRAL_SCAN, 0, NULL) == HAL_OK) From owner-dev-commits-src-main@freebsd.org Mon Apr 19 08:11:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C59535E7189; Mon, 19 Apr 2021 08:11: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 4FNzzB5GHXz3LmP; Mon, 19 Apr 2021 08:11:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7AF81BC8C; Mon, 19 Apr 2021 08:11: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 13J8B2mQ014124; Mon, 19 Apr 2021 08:11:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J8B2uF014123; Mon, 19 Apr 2021 08:11:02 GMT (envelope-from git) Date: Mon, 19 Apr 2021 08:11:02 GMT Message-Id: <202104190811.13J8B2uF014123@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 6fe60f1d5c39 - main - AMD-vi: Fortify IVHD device_identify process MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fe60f1d5c39c94fc87534e9dd4e9630594e0bec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 08:11:02 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=6fe60f1d5c39c94fc87534e9dd4e9630594e0bec commit 6fe60f1d5c39c94fc87534e9dd4e9630594e0bec Author: Ka Ho Ng AuthorDate: 2021-04-19 08:07:03 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-19 08:08:13 +0000 AMD-vi: Fortify IVHD device_identify process - Use malloc(9) to allocate ivhd_hdrs list. The previous assumption that there are at most 10 IVHDs in a system is not true. A counter example would be a system with 4 IOMMUs, and each IOMMU is related to IVHDs type 10h, 11h and 40h in the ACPI IVRS table. - Always scan through the whole ivhd_hdrs list to find IVHDs that has the same DeviceId but less prioritized IVHD type. Sponsored by: The FreeBSD Foundation MFC with: 74ada297e897 Reviewed by: grehan Approved by: lwhsu (mentor) Differential Revision: https://reviews.freebsd.org/D29525 --- sys/amd64/vmm/amd/ivrs_drv.c | 47 ++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index 1cd76069d0a2..67b205076cb2 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -57,7 +57,7 @@ int ivhd_count; /* Number of IVHD header. */ * Cached IVHD header list. * Single entry for each IVHD, filtered the legacy one. */ -ACPI_IVRS_HARDWARE1 *ivhd_hdrs[10]; +ACPI_IVRS_HARDWARE1 **ivhd_hdrs; extern int amdvi_ptp_level; /* Page table levels. */ @@ -134,9 +134,11 @@ ivrs_is_ivhd(UINT8 type) static int ivhd_count_iter(ACPI_IVRS_HEADER * ivrs_he, void *arg) { + int *count; + count = (int *)arg; if (ivrs_is_ivhd(ivrs_he->Type)) - ivhd_count++; + (*count)++; return (1); } @@ -339,7 +341,7 @@ ivhd_identify(driver_t *driver, device_t parent) ACPI_TABLE_IVRS *ivrs; ACPI_IVRS_HARDWARE1 *ivhd; ACPI_STATUS status; - int i, count = 0; + int i, j, count = 0; uint32_t ivrs_ivinfo; if (acpi_disabled("ivhd")) @@ -360,32 +362,35 @@ ivhd_identify(driver_t *driver, device_t parent) REG_BITS(ivrs_ivinfo, 7, 5), REG_BITS(ivrs_ivinfo, 22, 22), "\020\001EFRSup"); - ivrs_hdr_iterate_tbl(ivhd_count_iter, NULL); - if (!ivhd_count) + ivrs_hdr_iterate_tbl(ivhd_count_iter, &count); + if (!count) return; - for (i = 0; i < ivhd_count; i++) { + ivhd_hdrs = malloc(sizeof(void *) * count, M_DEVBUF, + M_WAITOK | M_ZERO); + for (i = 0; i < count; i++) { ivhd = ivhd_find_by_index(i); KASSERT(ivhd, ("ivhd%d is NULL\n", i)); - ivhd_hdrs[i] = ivhd; - } - /* - * Scan for presence of legacy and non-legacy device type - * for same AMD-Vi device and override the old one. - */ - for (i = ivhd_count - 1 ; i > 0 ; i--){ - if (ivhd_is_newer(&ivhd_hdrs[i-1]->Header, - &ivhd_hdrs[i]->Header)) { - memmove(&ivhd_hdrs[i-1], &ivhd_hdrs[i], - sizeof(void *) * (ivhd_count - i)); - ivhd_count--; + /* + * Scan for presence of legacy and non-legacy device type + * for same IOMMU device and override the old one. + * + * If there is no existing IVHD to the same IOMMU device, + * the IVHD header pointer is appended. + */ + for (j = 0; j < ivhd_count; j++) { + if (ivhd_is_newer(&ivhd_hdrs[j]->Header, &ivhd->Header)) + break; } + ivhd_hdrs[j] = ivhd; + if (j == ivhd_count) + ivhd_count++; } ivhd_devs = malloc(sizeof(device_t) * ivhd_count, M_DEVBUF, M_WAITOK | M_ZERO); - for (i = 0; i < ivhd_count; i++) { + for (i = 0, j = 0; i < ivhd_count; i++) { ivhd = ivhd_hdrs[i]; KASSERT(ivhd, ("ivhd%d is NULL\n", i)); @@ -407,13 +412,13 @@ ivhd_identify(driver_t *driver, device_t parent) break; } } - count++; + j++; } /* * Update device count in case failed to attach. */ - ivhd_count = count; + ivhd_count = j; } static int From owner-dev-commits-src-main@freebsd.org Mon Apr 19 08:40:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A0955E8CE6; Mon, 19 Apr 2021 08:40: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 4FP0cs0DTRz3NmB; Mon, 19 Apr 2021 08:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E043F1BEB8; Mon, 19 Apr 2021 08:40: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 13J8eCXe049488; Mon, 19 Apr 2021 08:40:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13J8eC6e049481; Mon, 19 Apr 2021 08:40:12 GMT (envelope-from git) Date: Mon, 19 Apr 2021 08:40:12 GMT Message-Id: <202104190840.13J8eC6e049481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 738314e445ce - main - Revert "lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 738314e445ceac4d3dd6c77c636044141623b8dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 08:40:13 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=738314e445ceac4d3dd6c77c636044141623b8dc commit 738314e445ceac4d3dd6c77c636044141623b8dc Author: Alex Richardson AuthorDate: 2021-04-19 08:36:47 +0000 Commit: Alex Richardson CommitDate: 2021-04-19 08:36:47 +0000 Revert "lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations" This commit should not have introduced any functional changes, but apparently it did. This appears to have broken LDAP setups. Reverting for now. Will reland once I have fixed the breakage. This reverts commit 5245bf7b92b74e556527b4916a8deba386fe5772. Reported By: Александр Недоцуков, brd MFC after: immediately --- lib/libc/net/nsdispatch.c | 201 +++++++++++++++++----------------------------- 1 file changed, 72 insertions(+), 129 deletions(-) diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index d504a86d524b..b0f80d079b0b 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -77,7 +76,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -99,52 +97,7 @@ enum _nss_constants { * Global NSS data structures are mostly read-only, but we update * them when we read or re-read the nsswitch.conf. */ -static pthread_rwlock_t nss_lock = PTHREAD_RWLOCK_INITIALIZER; -#ifndef NDEBUG -static void *nss_wlock_owner __guarded_by(nss_lock); -#endif - -static inline /* __lock_annotate(locks_excluded(nss_lock)) */ -__locks_exclusive(nss_lock) int -nss_wlock(void) -{ - int err; - - err = _pthread_rwlock_wrlock(&nss_lock); -#ifndef NDEBUG - assert(nss_wlock_owner == NULL); - nss_wlock_owner = _pthread_self(); -#endif - assert(err == 0 && "Locking should not have failed!"); - return (err); -} - -/* - * XXX: The manpage says already held lock may result in EDEADLK, but - * actually libthr returns always EBUSY, so we need the extra owner - * variable for assertions. - */ -#define ASSERT_NSS_WLOCK_HELD() \ - do { \ - if (__isthreaded) { \ - assert(_pthread_rwlock_trywrlock(&nss_lock) == EBUSY); \ - assert(nss_wlock_owner == _pthread_self()); \ - } \ - } while (0) - -static inline __requires_exclusive(nss_lock) __unlocks(nss_lock) int -nss_wunlock(void) -{ - int err; - - ASSERT_NSS_WLOCK_HELD(); -#ifndef NDEBUG - nss_wlock_owner = NULL; -#endif - err = _pthread_rwlock_unlock(&nss_lock); - assert(err == 0 && "Unlocking should not have failed!"); - return (err); -} +static pthread_rwlock_t nss_lock = PTHREAD_RWLOCK_INITIALIZER; /* * Runtime determination of whether we are dynamically linked or not. @@ -161,12 +114,12 @@ const ns_src __nsdefaultsrc[] = { }; /* Database, source mappings. */ -static unsigned int _nsmapsize __guarded_by(nss_lock); -static ns_dbt *_nsmap __guarded_by(nss_lock); +static unsigned int _nsmapsize; +static ns_dbt *_nsmap = NULL; /* NSS modules. */ -static unsigned int _nsmodsize __guarded_by(nss_lock); -static ns_mod *_nsmod __guarded_by(nss_lock); +static unsigned int _nsmodsize; +static ns_mod *_nsmod; /* Placeholder for builtin modules' dlopen `handle'. */ static int __nss_builtin_handle; @@ -213,7 +166,8 @@ typedef int (*vector_comparison)(const void *, const void *); typedef void (*vector_free_elem)(void *); static void vector_sort(void *, unsigned int, size_t, vector_comparison); -static void _vector_free(void *, unsigned int, size_t, vector_free_elem); +static void vector_free(void *, unsigned int *, size_t, + vector_free_elem); static void *vector_ref(unsigned int, void *, unsigned int, size_t); static void *vector_search(const void *, void *, unsigned int, size_t, vector_comparison); @@ -284,24 +238,22 @@ vector_ref(unsigned int i, void *vec, unsigned int count, size_t esize) } -#define VECTOR_FREE(vec, count, es, fe) do { \ - _vector_free(vec, count, es, fe); \ - vec = NULL; \ - count = 0; \ -} while (0) +#define VECTOR_FREE(v, c, s, f) \ + do { vector_free(v, c, s, f); v = NULL; } while (0) static void -_vector_free(void *vec, unsigned int count, size_t esize, +vector_free(void *vec, unsigned int *count, size_t esize, vector_free_elem free_elem) { unsigned int i; void *elem; - for (i = 0; i < count; i++) { - elem = vector_ref(i, vec, count, esize); + for (i = 0; i < *count; i++) { + elem = vector_ref(i, vec, *count, esize); if (elem != NULL) free_elem(elem); } free(vec); + *count = 0; } /* @@ -330,14 +282,13 @@ mtab_compare(const void *a, const void *b) /* * NSS nsmap management. */ -__requires_exclusive(nss_lock) void +void _nsdbtaddsrc(ns_dbt *dbt, const ns_src *src) { const ns_mod *modp; - ASSERT_NSS_WLOCK_HELD(); - dbt->srclist = vector_append(src, dbt->srclist, - (unsigned int *)&dbt->srclistsize, sizeof(*src)); + dbt->srclist = vector_append(src, dbt->srclist, &dbt->srclistsize, + sizeof(*src)); modp = vector_search(&src->name, _nsmod, _nsmodsize, sizeof(*_nsmod), string_compare); if (modp == NULL) @@ -374,28 +325,26 @@ _nsdbtdump(const ns_dbt *dbt) } #endif -#ifndef NS_REREAD_CONF -static int __guarded_by(nss_lock) already_initialized = 0; -#endif /* * The first time nsdispatch is called (during a process's lifetime, * or after nsswitch.conf has been updated), nss_configure will * prepare global data needed by NSS. */ -static __requires_shared(nss_lock) int -__lock_annotate(no_thread_safety_analysis) /* RWLock upgrade not supported. */ -do_nss_configure(void) +static int +nss_configure(void) { - static time_t __guarded_by(nss_lock) confmod = 0; + static time_t confmod; + static int already_initialized = 0; struct stat statbuf; - int result; + int result, isthreaded; const char *path; #ifdef NS_CACHING void *handle; #endif result = 0; + isthreaded = __isthreaded; #if defined(_NSS_DEBUG) && defined(_NSS_SHOOT_FOOT) /* NOTE WELL: THIS IS A SECURITY HOLE. This must only be built * for debugging purposes and MUST NEVER be used in production. @@ -404,33 +353,36 @@ do_nss_configure(void) if (path == NULL) #endif path = _PATH_NS_CONF; - - result = _pthread_rwlock_unlock(&nss_lock); - if (result != 0) - return (result); - result = nss_wlock(); - if (result != 0) - return (result); #ifndef NS_REREAD_CONF /* - * Another thread could have already run the initialization - * logic while we were waiting for the write lock. Check - * already_initialized to avoid re-initializing. + * Define NS_REREAD_CONF to have nsswitch notice changes + * to nsswitch.conf(5) during runtime. This involves calling + * stat(2) every time, which can result in performance hit. */ if (already_initialized) - goto fin; + return (0); + already_initialized = 1; #endif /* NS_REREAD_CONF */ - ASSERT_NSS_WLOCK_HELD(); if (stat(path, &statbuf) != 0) - goto fin; + return (0); if (statbuf.st_mtime <= confmod) - goto fin; + return (0); + if (isthreaded) { + (void)_pthread_rwlock_unlock(&nss_lock); + result = _pthread_rwlock_wrlock(&nss_lock); + if (result != 0) + return (result); + if (stat(path, &statbuf) != 0) + goto fin; + if (statbuf.st_mtime <= confmod) + goto fin; + } _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) goto fin; - VECTOR_FREE(_nsmap, _nsmapsize, sizeof(*_nsmap), + VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), (vector_free_elem)ns_dbt_free); - VECTOR_FREE(_nsmod, _nsmodsize, sizeof(*_nsmod), + VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), (vector_free_elem)ns_mod_free); if (confmod == 0) (void)atexit(nss_atexit); @@ -448,42 +400,22 @@ do_nss_configure(void) dlclose(handle); } #endif -#ifndef NS_REREAD_CONF - already_initialized = 1; -#endif fin: - result = nss_wunlock(); - if (result == 0) - result = _pthread_rwlock_rdlock(&nss_lock); - return (result); -} - -static __requires_shared(nss_lock) int -nss_configure(void) -{ - int result; -#ifndef NS_REREAD_CONF - /* - * Define NS_REREAD_CONF to have nsswitch notice changes - * to nsswitch.conf(5) during runtime. This involves calling - * stat(2) every time, which can result in performance hit. - */ - if (already_initialized) - return (0); -#endif /* NS_REREAD_CONF */ - result = do_nss_configure(); + if (isthreaded) { + (void)_pthread_rwlock_unlock(&nss_lock); + if (result == 0) + result = _pthread_rwlock_rdlock(&nss_lock); + } return (result); } -__requires_exclusive(nss_lock) void +void _nsdbtput(const ns_dbt *dbt) { unsigned int i; ns_dbt *p; - ASSERT_NSS_WLOCK_HELD(); - for (i = 0; i < _nsmapsize; i++) { p = vector_ref(i, _nsmap, _nsmapsize, sizeof(*_nsmap)); if (string_compare(&dbt->name, &p->name) == 0) { @@ -546,15 +478,13 @@ nss_load_builtin_modules(void) * argument is non-NULL, assume a built-in module and use reg_fn to * register it. Otherwise, search for a dynamic NSS module. */ -static __requires_exclusive(nss_lock) void +static void nss_load_module(const char *source, nss_module_register_fn reg_fn) { char buf[PATH_MAX]; ns_mod mod; nss_module_register_fn fn; - ASSERT_NSS_WLOCK_HELD(); - memset(&mod, 0, sizeof(mod)); mod.name = strdup(source); if (mod.name == NULL) { @@ -618,9 +548,9 @@ fin: vector_sort(_nsmod, _nsmodsize, sizeof(*_nsmod), string_compare); } -static int exiting __guarded_by(nss_lock) = 0; +static int exiting = 0; -static __requires_exclusive(nss_lock) void +static void ns_mod_free(ns_mod *mod) { @@ -639,19 +569,24 @@ ns_mod_free(ns_mod *mod) static void nss_atexit(void) { - (void)nss_wlock(); + int isthreaded; + exiting = 1; - VECTOR_FREE(_nsmap, _nsmapsize, sizeof(*_nsmap), + isthreaded = __isthreaded; + if (isthreaded) + (void)_pthread_rwlock_wrlock(&nss_lock); + VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), (vector_free_elem)ns_dbt_free); - VECTOR_FREE(_nsmod, _nsmapsize, sizeof(*_nsmod), + VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), (vector_free_elem)ns_mod_free); - (void)nss_wunlock(); + if (isthreaded) + (void)_pthread_rwlock_unlock(&nss_lock); } /* * Finally, the actual implementation. */ -static __requires_shared(nss_lock) nss_method +static nss_method nss_method_lookup(const char *source, const char *database, const char *method, const ns_dtab disp_tab[], void **mdata) { @@ -690,7 +625,7 @@ fb_endstate(void *p) __weak_reference(_nsdispatch, nsdispatch); -__requires_unlocked(nss_lock) int +int _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, const char *method_name, const ns_src defaults[], ...) { @@ -699,7 +634,7 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, const ns_src *srclist; nss_method method, fb_method; void *mdata; - int serrno, i, result, srclistsize; + int isthreaded, serrno, i, result, srclistsize; struct fb_state *st; int saved_depth; @@ -712,8 +647,15 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, dbt = NULL; fb_method = NULL; + isthreaded = __isthreaded; serrno = errno; - (void)_pthread_rwlock_rdlock(&nss_lock); + if (isthreaded) { + result = _pthread_rwlock_rdlock(&nss_lock); + if (result != 0) { + result = NS_UNAVAIL; + goto fin; + } + } result = fb_getstate(&st); if (result != 0) { @@ -832,9 +774,10 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, } #endif /* NS_CACHING */ + if (isthreaded) + (void)_pthread_rwlock_unlock(&nss_lock); --st->dispatch_depth; fin: - (void)_pthread_rwlock_unlock(&nss_lock); errno = serrno; return (result); } From owner-dev-commits-src-main@freebsd.org Mon Apr 19 11:09:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 037595ED1F1; Mon, 19 Apr 2021 11:09: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 4FP3xX6jW3z3mnY; Mon, 19 Apr 2021 11:09:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D943E1E217; Mon, 19 Apr 2021 11:09: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 13JB9qWd046009; Mon, 19 Apr 2021 11:09:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JB9qGL046008; Mon, 19 Apr 2021 11:09:52 GMT (envelope-from git) Date: Mon, 19 Apr 2021 11:09:52 GMT Message-Id: <202104191109.13JB9qGL046008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 156da725d3ef - main - linux(4): bump osrelease to 4.4.0. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 156da725d3ef6bbafdb0389aada57cf268f44b1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 11:09:53 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=156da725d3ef6bbafdb0389aada57cf268f44b1e commit 156da725d3ef6bbafdb0389aada57cf268f44b1e Author: Edward Tomasz Napierala AuthorDate: 2021-04-19 10:37:47 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-19 10:37:58 +0000 linux(4): bump osrelease to 4.4.0. This is required for the current Arch Linux binaries to work. PR: 254112 Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29218 --- sys/compat/linux/linux_mib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index 0a1baec39826..b3d5949c9630 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -46,8 +46,8 @@ int linux_get_oss_version(struct thread *td); int linux_kernver(struct thread *td); -#define LINUX_KVERSION 3 -#define LINUX_KPATCHLEVEL 17 +#define LINUX_KVERSION 4 +#define LINUX_KPATCHLEVEL 4 #define LINUX_KSUBLEVEL 0 #define LINUX_KERNVER(a,b,c) (((a) << 16) + ((b) << 8) + (c)) From owner-dev-commits-src-main@freebsd.org Mon Apr 19 12:10:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A5635EFBA4; Mon, 19 Apr 2021 12:10: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 4FP5HW0Jbcz3r2G; Mon, 19 Apr 2021 12:10:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F170D1EF91; Mon, 19 Apr 2021 12:10: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 13JCAU6R034139; Mon, 19 Apr 2021 12:10:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JCAUI5034138; Mon, 19 Apr 2021 12:10:30 GMT (envelope-from git) Date: Mon, 19 Apr 2021 12:10:30 GMT Message-Id: <202104191210.13JCAUI5034138@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: 0e4025bffa2b - main - bridgestp: validate timer values in config BPDU 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: 0e4025bffa2bab3461b72b40d0b1468722ff76e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 12:10:31 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0e4025bffa2bab3461b72b40d0b1468722ff76e6 commit 0e4025bffa2bab3461b72b40d0b1468722ff76e6 Author: Jonah Caplan AuthorDate: 2021-04-15 09:28:42 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 10:09:18 +0000 bridgestp: validate timer values in config BPDU IEEE Std 802.1D-2004 Section 17.14 defines permitted ranges for timers. Incoming BPDU messages should be checked against the permitted ranges. The rest of 17.14 appears to be enforced already. PR: 254924 Reviewed by: kp, donner Differential Revision: https://reviews.freebsd.org/D29782 --- sys/net/bridgestp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 9e3a3e14ecda..cf182d2efe7b 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -597,6 +597,23 @@ bstp_received_bpdu(struct bstp_state *bs, struct bstp_port *bp, return; } + /* range checks */ + if (cu->cu_message_age >= cu->cu_max_age) { + return; + } + if (cu->cu_max_age < BSTP_MIN_MAX_AGE || + cu->cu_max_age > BSTP_MAX_MAX_AGE) { + return; + } + if (cu->cu_forward_delay < BSTP_MIN_FORWARD_DELAY || + cu->cu_forward_delay > BSTP_MAX_FORWARD_DELAY) { + return; + } + if (cu->cu_hello_time < BSTP_MIN_HELLO_TIME || + cu->cu_hello_time > BSTP_MAX_HELLO_TIME) { + return; + } + type = bstp_pdu_rcvtype(bp, cu); switch (type) { From owner-dev-commits-src-main@freebsd.org Mon Apr 19 12:10:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4191A5EF98D; Mon, 19 Apr 2021 12:10: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 4FP5HX1GGGz3qg0; Mon, 19 Apr 2021 12:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C8B81EC37; Mon, 19 Apr 2021 12:10: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 13JCAWZZ034160; Mon, 19 Apr 2021 12:10:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JCAWVE034159; Mon, 19 Apr 2021 12:10:32 GMT (envelope-from git) Date: Mon, 19 Apr 2021 12:10:32 GMT Message-Id: <202104191210.13JCAWVE034159@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: 4ae3a97e127c - main - bridge tests: Test STP config BPDU validation 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: 4ae3a97e127cea14277b904af31483af7e6e2891 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 12:10:32 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ae3a97e127cea14277b904af31483af7e6e2891 commit 4ae3a97e127cea14277b904af31483af7e6e2891 Author: Kristof Provost AuthorDate: 2021-04-15 12:55:00 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 10:09:35 +0000 bridge tests: Test STP config BPDU validation PR: 254924 Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D29783 --- tests/sys/net/Makefile | 7 ++- tests/sys/net/if_bridge_test.sh | 45 ++++++++++++++++ tests/sys/net/stp.py | 112 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 3941a502a3a6..40b3a5e5fff6 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/net BINDIR= ${TESTSDIR} @@ -20,6 +20,11 @@ TESTS_SUBDIRS+= routing # locked. TEST_METADATA+= is_exclusive=true +${PACKAGE}FILES+= \ + stp.py + +${PACKAGE}FILESMODE_stp.py= 0555 + MAN= PROGS+= randsleep diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 1f10fe325a2c..4703efed46b8 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -408,6 +408,50 @@ inherit_mac_cleanup() vnet_cleanup } +atf_test_case "stp_validation" "cleanup" +stp_validation_head() +{ + atf_set descr 'Check STP validation' + atf_set require.user root + atf_set require.progs scapy +} + +stp_validation_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${bridge} addm ${epair_one}a addm ${epair_two}a + ifconfig ${bridge} stp ${epair_one}a stp ${epair_two}a + + ifconfig ${epair_one}a up + ifconfig ${epair_one}b up + ifconfig ${epair_two}a up + ifconfig ${epair_two}b up + + # Wait until the interfaces are no longer discarding + while ifconfig ${bridge} | grep 'state discarding' >/dev/null + do + sleep 1 + done + + # Now inject invalid STP BPDUs on epair_one and see if they're repeated + # on epair_two + atf_check -s exit:0 \ + $(atf_get_srcdir)/stp.py \ + --sendif ${epair_one}b \ + --recvif ${epair_two}b +} + +stp_validation_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -418,4 +462,5 @@ atf_init_test_cases() atf_add_test_case "inherit_mac" atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" + atf_add_test_case "stp_validation" } diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py new file mode 100644 index 000000000000..4c4c0af4c728 --- /dev/null +++ b/tests/sys/net/stp.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Kristof Provost +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +import argparse +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_stp(args, packet): + stp = packet.getlayer(sp.STP) + if stp is None: + return False + + if stp.rootmac != "00:0c:29:01:01:01": + return False + + # Ensure we don't get confused by valid STP packets generated by if_bridge + if (stp.maxage >= 6 and stp.maxage <= 40) and \ + (stp.hellotime >= 1 and stp.hellotime <= 2) and \ + (stp.fwddelay >= 4 and stp.fwddelay <= 30): + return False + + print("This packet should have been dropped") + print(packet.show()) + return True + +def invalid_stp(send_if): + llc = sp.Ether(src="00:0c:29:0b:91:0a", dst="01:80:C2:00:00:00") \ + / sp.LLC() + + # Bad maxage + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=41, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=5, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad hellotime + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=3, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=1, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad fwddelay + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=31) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=3) + sp.sendp(stp, iface=send_if, verbose=False) + +def main(): + parser = argparse.ArgumentParser("stp.py", + description="STP test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP echo request') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_stp) + + invalid_stp(args.sendif[0]) + + sniffer.join() + + # The 'correct' packet is a corrupt STP packet, so it shouldn't turn up. + if sniffer.foundCorrectPacket: + sys.exit(1) + +if __name__ == '__main__': + main() From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:44:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428D15F2B90; Mon, 19 Apr 2021 13:44: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 4FP7Md1T9Cz4Qxg; Mon, 19 Apr 2021 13:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2544A20503; Mon, 19 Apr 2021 13:44: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 13JDiDCt056983; Mon, 19 Apr 2021 13:44:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDiDv9056982; Mon, 19 Apr 2021 13:44:13 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:44:13 GMT Message-Id: <202104191344.13JDiDv9056982@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: 4f1f67e88853 - main - pf: PFRULE_REFS should not be user-visible 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: 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:44:13 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e commit 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e Author: Kristof Provost AuthorDate: 2021-04-15 11:38:56 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 12:31:47 +0000 pf: PFRULE_REFS should not be user-visible Split the PFRULE_REFS flag from the rule_flag field. PFRULE_REFS is a kernel-internal flag and should not be exposed to or read from userspace. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29778 --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.c | 12 ++++++------ sys/netpfil/pf/pf_ioctl.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0372dfa65e57..efb9a382511e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -378,6 +378,7 @@ struct pf_krule { struct pf_rule_gid gid; u_int32_t rule_flag; + uint32_t rule_ref; u_int8_t action; u_int8_t direction; u_int8_t log; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index e4bc6447b0d1..a5c4ef6bfbb4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1641,7 +1641,7 @@ pf_purge_expired_src_nodes() pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) - cur->rule.ptr->rule_flag |= PFRULE_REFS; + cur->rule.ptr->rule_ref |= PFRULE_REFS; PF_HASHROW_UNLOCK(sh); } @@ -1783,11 +1783,11 @@ relock: pf_unlink_state(s, PF_ENTER_LOCKED); goto relock; } - s->rule.ptr->rule_flag |= PFRULE_REFS; + s->rule.ptr->rule_ref |= PFRULE_REFS; if (s->nat_rule.ptr != NULL) - s->nat_rule.ptr->rule_flag |= PFRULE_REFS; + s->nat_rule.ptr->rule_ref |= PFRULE_REFS; if (s->anchor.ptr != NULL) - s->anchor.ptr->rule_flag |= PFRULE_REFS; + s->anchor.ptr->rule_ref |= PFRULE_REFS; s->kif->pfik_flags |= PFI_IFLAG_REFS; if (s->rt_kif) s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; @@ -1839,11 +1839,11 @@ pf_purge_unlinked_rules() TAILQ_INIT(&tmpq); PF_UNLNKDRULES_LOCK(); TAILQ_FOREACH_SAFE(r, &V_pf_unlinked_rules, entries, r1) { - if (!(r->rule_flag & PFRULE_REFS)) { + if (!(r->rule_ref & PFRULE_REFS)) { TAILQ_REMOVE(&V_pf_unlinked_rules, r, entries); TAILQ_INSERT_TAIL(&tmpq, r, entries); } else - r->rule_flag &= ~PFRULE_REFS; + r->rule_ref &= ~PFRULE_REFS; } PF_UNLNKDRULES_UNLOCK(); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 152fa9dafca1..e7965b7dcecd 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -426,7 +426,7 @@ pf_unlink_rule(struct pf_krulequeue *rulequeue, struct pf_krule *rule) TAILQ_REMOVE(rulequeue, rule, entries); PF_UNLNKDRULES_LOCK(); - rule->rule_flag |= PFRULE_REFS; + rule->rule_ref |= PFRULE_REFS; TAILQ_INSERT_TAIL(&V_pf_unlinked_rules, rule, entries); PF_UNLNKDRULES_UNLOCK(); } From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:44:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73DBE5F2A1A; Mon, 19 Apr 2021 13:44: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 4FP7Mf2ZXdz3wVM; Mon, 19 Apr 2021 13:44:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48C2D20504; Mon, 19 Apr 2021 13:44: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 13JDiEt9057004; Mon, 19 Apr 2021 13:44:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDiE7Z057003; Mon, 19 Apr 2021 13:44:14 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:44:14 GMT Message-Id: <202104191344.13JDiE7Z057003@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: 8bb0f1b87b80 - main - pf: Remove PFRULE_REFS from userspace 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: 8bb0f1b87b80fd0a9c9dc388851cb609298d36ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:44:14 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8bb0f1b87b80fd0a9c9dc388851cb609298d36ef commit 8bb0f1b87b80fd0a9c9dc388851cb609298d36ef Author: Kristof Provost AuthorDate: 2021-04-15 11:41:07 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 12:31:47 +0000 pf: Remove PFRULE_REFS from userspace PFRULE_REFS should never be used by userspace, so hide it behind #ifdef _KERNEL. MFC after: never Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29779 --- sys/netpfil/pf/pf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index d7063e70b0af..4192b1a5bc95 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -561,7 +561,10 @@ struct pf_rule { #define PFRULE_NOSYNC 0x0010 #define PFRULE_SRCTRACK 0x0020 /* track source states */ #define PFRULE_RULESRCTRACK 0x0040 /* per rule */ + +#ifdef _KERNEL #define PFRULE_REFS 0x0080 /* rule has references */ +#endif /* scrub flags */ #define PFRULE_NODF 0x0100 From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:44:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0ED845F2999; Mon, 19 Apr 2021 13:44: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 4FP7Mg4slBz4QqP; Mon, 19 Apr 2021 13:44:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 782B820505; Mon, 19 Apr 2021 13:44: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 13JDiFPN057025; Mon, 19 Apr 2021 13:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDiFG4057024; Mon, 19 Apr 2021 13:44:15 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:44:15 GMT Message-Id: <202104191344.13JDiFG4057024@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: 42ec75f83aa3 - main - pf: Optionally attempt to preserve rule counter values across ruleset updates 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: 42ec75f83aa321fcea8d2eddc4e9099724f0669e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:44:16 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=42ec75f83aa321fcea8d2eddc4e9099724f0669e commit 42ec75f83aa321fcea8d2eddc4e9099724f0669e Author: Kristof Provost AuthorDate: 2021-04-15 14:12:11 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 12:31:47 +0000 pf: Optionally attempt to preserve rule counter values across ruleset updates Usually rule counters are reset to zero on every update of the ruleset. With keepcounters set pf will attempt to find matching rules between old and new rulesets and preserve the rule counters. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29780 --- lib/libpfctl/libpfctl.c | 22 +++++++++++++ lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/parse.y | 6 +++- sbin/pfctl/pfctl.c | 4 +++ sbin/pfctl/pfctl_parser.h | 1 + share/man/man5/pf.conf.5 | 12 +++++-- sys/net/pfvar.h | 3 ++ sys/netpfil/pf/pf_ioctl.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 126 insertions(+), 4 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 8d81248e0229..86117268a9d0 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -569,3 +569,25 @@ int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, return (0); } + +int +pfctl_set_keepcounters(int dev, bool keep) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + nvlist_add_bool(nvl, "keep_counters", keep); + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + nvlist_destroy(nvl); + + ret = ioctl(dev, DIOCKEEPCOUNTERS, &nv); + + free(nv.data); + return (ret); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 32d0184f42ed..2c498189a6e4 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -188,5 +188,6 @@ int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); +int pfctl_set_keepcounters(int dev, bool keep); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9eac41fbf66f..e0314241eec3 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -461,7 +461,7 @@ int parseport(char *, struct range *r, int); %token REASSEMBLE FRAGDROP FRAGCROP ANCHOR NATANCHOR RDRANCHOR BINATANCHOR %token SET OPTIMIZATION TIMEOUT LIMIT LOGINTERFACE BLOCKPOLICY FAILPOLICY %token RANDOMID REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID -%token ANTISPOOF FOR INCLUDE +%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL @@ -719,6 +719,9 @@ option : SET OPTIMIZATION STRING { } keep_state_defaults = $3; } + | SET KEEPCOUNTERS { + pf->keep_counters = true; + } ; stringall : STRING { $$ = $1; } @@ -5593,6 +5596,7 @@ lookup(char *s) { "inet6", INET6}, { "interval", INTERVAL}, { "keep", KEEP}, + { "keepcounters", KEEPCOUNTERS}, { "label", LABEL}, { "limit", LIMIT}, { "linkshare", LINKSHARE}, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 9f6b3d2e36ea..82af047e7571 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1745,6 +1745,10 @@ pfctl_load_options(struct pfctl *pf) if (pfctl_load_hostid(pf, pf->hostid)) error = 1; + /* load keepcounters */ + if (pfctl_set_keepcounters(pf->dev, pf->keep_counters)) + error = 1; + return (error); } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 43d8488dcab8..0c66d5dda97a 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -98,6 +98,7 @@ struct pfctl { u_int32_t debug; u_int32_t hostid; char *ifname; + bool keep_counters; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 52a7331c7cb2..00fbd4421e7f 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -28,7 +28,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 7, 2019 +.Dd April 19, 2021 .Dt PF.CONF 5 .Os .Sh NAME @@ -618,6 +618,13 @@ Generate debug messages for various errors. .It Ar loud Generate debug messages for common conditions. .El +.It Ar set keepcounters +Preserve rule counters across rule updates. +Usually rule counters are reset to zero on every update of the ruleset. +With +.Ar keepcounters +set pf will attempt to find matching rules between old and new rulesets +and preserve the rule counters. .El .Sh TRAFFIC NORMALIZATION Traffic normalization is used to sanitize packet content in such @@ -2888,7 +2895,8 @@ option = "set" ( [ "timeout" ( timeout | "{" timeout-list "}" ) ] | [ "require-order" ( "yes" | "no" ) ] [ "fingerprints" filename ] | [ "skip on" ifspec ] | - [ "debug" ( "none" | "urgent" | "misc" | "loud" ) ] ) + [ "debug" ( "none" | "urgent" | "misc" | "loud" ) ] + [ "keepcounters" ] ) pf-rule = action [ ( "in" | "out" ) ] [ "log" [ "(" logopts ")"] ] [ "quick" ] diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index efb9a382511e..3a79a281f916 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -996,6 +996,7 @@ struct pf_kstatus { uint32_t hostid; char ifname[IFNAMSIZ]; uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; + bool keep_counters; }; struct pf_divert { @@ -1304,6 +1305,8 @@ struct pfioc_iface { #define DIOCSETIFFLAG _IOWR('D', 89, struct pfioc_iface) #define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface) #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) +#define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) + struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; u_int32_t baudrate; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e7965b7dcecd..917501163264 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -197,6 +197,7 @@ static void pf_clear_states(void); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); +static int pf_keepcounters(struct pfioc_nv *); static void pf_tbladdr_copyout(struct pf_addr_wrap *); /* @@ -1022,11 +1023,27 @@ pf_hash_rule(MD5_CTX *ctx, struct pf_krule *rule) PF_MD5_UPD(rule, tos); } +static bool +pf_krule_compare(struct pf_krule *a, struct pf_krule *b) +{ + MD5_CTX ctx[2]; + u_int8_t digest[2][PF_MD5_DIGEST_LENGTH]; + + MD5Init(&ctx[0]); + MD5Init(&ctx[1]); + pf_hash_rule(&ctx[0], a); + pf_hash_rule(&ctx[1], b); + MD5Final(digest[0], &ctx[0]); + MD5Final(digest[1], &ctx[1]); + + return (memcmp(digest[0], digest[1], PF_MD5_DIGEST_LENGTH) == 0); +} + static int pf_commit_rules(u_int32_t ticket, int rs_num, char *anchor) { struct pf_kruleset *rs; - struct pf_krule *rule, **old_array; + struct pf_krule *rule, **old_array, *tail; struct pf_krulequeue *old_rules; int error; u_int32_t old_rcount; @@ -1058,6 +1075,29 @@ pf_commit_rules(u_int32_t ticket, int rs_num, char *anchor) rs->rules[rs_num].inactive.ptr_array; rs->rules[rs_num].active.rcount = rs->rules[rs_num].inactive.rcount; + + /* Attempt to preserve counter information. */ + if (V_pf_status.keep_counters) { + TAILQ_FOREACH(rule, rs->rules[rs_num].active.ptr, + entries) { + tail = TAILQ_FIRST(old_rules); + while ((tail != NULL) && ! pf_krule_compare(tail, rule)) + tail = TAILQ_NEXT(tail, entries); + if (tail != NULL) { + counter_u64_add(rule->evaluations, + counter_u64_fetch(tail->evaluations)); + counter_u64_add(rule->packets[0], + counter_u64_fetch(tail->packets[0])); + counter_u64_add(rule->packets[1], + counter_u64_fetch(tail->packets[1])); + counter_u64_add(rule->bytes[0], + counter_u64_fetch(tail->bytes[0])); + counter_u64_add(rule->bytes[1], + counter_u64_fetch(tail->bytes[1])); + } + } + } + rs->rules[rs_num].inactive.ptr = old_rules; rs->rules[rs_num].inactive.ptr_array = old_array; rs->rules[rs_num].inactive.rcount = old_rcount; @@ -4948,6 +4988,10 @@ DIOCCHANGEADDR_error: pf_kill_srcnodes((struct pfioc_src_node_kill *)addr); break; + case DIOCKEEPCOUNTERS: + error = pf_keepcounters((struct pfioc_nv *)addr); + break; + case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; @@ -5227,6 +5271,41 @@ pf_kill_srcnodes(struct pfioc_src_node_kill *psnk) psnk->psnk_killed = pf_free_src_nodes(&kill); } +static int +pf_keepcounters(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error = 0; + +#define ERROUT(x) do { error = (x); goto on_error; } while (0) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_bool(nvl, "keep_counters")) + ERROUT(EBADMSG); + + V_pf_status.keep_counters = nvlist_get_bool(nvl, "keep_counters"); + +on_error: + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (error); +} + /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:44:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5B455F2A1F; Mon, 19 Apr 2021 13:44: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 4FP7Mh52CNz3wXk; Mon, 19 Apr 2021 13:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9828320506; Mon, 19 Apr 2021 13:44: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 13JDiGaM057046; Mon, 19 Apr 2021 13:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDiGXn057045; Mon, 19 Apr 2021 13:44:16 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:44:16 GMT Message-Id: <202104191344.13JDiGXn057045@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: e14d56f37018 - main - pf tests: Test set keepcounters 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: e14d56f370184fdf7ef33ec57883a45f4a220cff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:44:17 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e14d56f370184fdf7ef33ec57883a45f4a220cff commit e14d56f370184fdf7ef33ec57883a45f4a220cff Author: Kristof Provost AuthorDate: 2021-04-15 14:53:16 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 12:31:47 +0000 pf tests: Test set keepcounters MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29781 --- tests/sys/netpfil/pf/rules_counter.sh | 82 +++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/tests/sys/netpfil/pf/rules_counter.sh b/tests/sys/netpfil/pf/rules_counter.sh index 56dc159f49c8..567bf439b0ef 100644 --- a/tests/sys/netpfil/pf/rules_counter.sh +++ b/tests/sys/netpfil/pf/rules_counter.sh @@ -73,7 +73,89 @@ get_clear_cleanup() pft_cleanup } +atf_test_case "keepcounters" "cleanup" +keepcounters_head() +{ + atf_set descr 'Test keepcounter functionality' + atf_set require.user root +} + +keepcounters_body() +{ + pft_init + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair_send}b + jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass all" + + # Expect zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # Ensure the rule matched packets, so we can verify non-zero counters + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + # Expect non-zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # As we set the (same) rules again we'd expect the counters to return + # to zero + pft_set_rules noflush alcatraz \ + "pass all" + + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # Increment rule counters + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + # Now set new rules with 'keepcounters' set, so we'd expect nonzero + # counters + pft_set_rules noflush alcatraz \ + "set keepcounters" \ + "pass all" + + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # However, if we set a different rule it should return to zero + pft_set_rules noflush alcatraz \ + "set keepcounters" \ + "pass inet all" + + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # If we generate traffic and don't set keepcounters we also see zero + # counts when setting new rules + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + pft_set_rules noflush alcatraz \ + "pass inet all" + + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v +} + +keepcounters_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "get_clear" + atf_add_test_case "keepcounters" } From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:47:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAC7C5F2DB2; Mon, 19 Apr 2021 13:47: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 4FP7Rx4JgYz4R9V; Mon, 19 Apr 2021 13:47:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 874F0204CC; Mon, 19 Apr 2021 13:47:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13JDlv8q057407; Mon, 19 Apr 2021 13:47:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDlvc2057406; Mon, 19 Apr 2021 13:47:57 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:47:57 GMT Message-Id: <202104191347.13JDlvc2057406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 22b2ba4e22e2 - main - Fix a typo in Gordon's login MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22b2ba4e22e208c098857aa8308cfc0a7b92d593 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:47:57 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=22b2ba4e22e208c098857aa8308cfc0a7b92d593 commit 22b2ba4e22e208c098857aa8308cfc0a7b92d593 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-19 13:42:31 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-19 13:48:05 +0000 Fix a typo in Gordon's login It's gbe, not bge. Fixes: bffc3fb3c09b Add metor -> mentee information (docs) --- share/misc/committers-doc.dot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 9c79abb0214a..a4e76cddd9ed 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -126,8 +126,6 @@ bcr -> "0mp" bcr -> gbe bcr -> debdrup -bge -> fernape - blackend -> ale brueffer -> joel @@ -152,6 +150,8 @@ gabor -> issyl0 gabor -> ebrandi gabor -> carlavilla +gbe -> fernape + gjb -> wblock gjb -> rene gjb -> dru From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:29:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1582F5FAC40; Mon, 19 Apr 2021 18:29: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 4FPFjL09dPz4j4f; Mon, 19 Apr 2021 18:29:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED1DF23EC7; Mon, 19 Apr 2021 18:29:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13JITvxR033528; Mon, 19 Apr 2021 18:29:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JITv1A033527; Mon, 19 Apr 2021 18:29:57 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:29:57 GMT Message-Id: <202104191829.13JITv1A033527@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: 686cf5468c4a - main - flex: Regen bootstrap files 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: 686cf5468c4a85c2a6385cdbab2383900876a41d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:29:58 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d commit 686cf5468c4a85c2a6385cdbab2383900876a41d Author: Jung-uk Kim AuthorDate: 2021-04-19 18:20:51 +0000 Commit: Jung-uk Kim CommitDate: 2021-04-19 18:20:51 +0000 flex: Regen bootstrap files This also partially reverts r326025 (8a16b7a18f5d). I do not see any point of adding SPDX tag in generated file. MFC after: 3 days Submitted by: Dan McGregor (initial version) Differential Revision: https://reviews.freebsd.org/D28596 --- usr.bin/lex/initparse.c | 17 ++++++++++------- usr.bin/lex/initparse.h | 1 - usr.bin/lex/initscan.c | 5 ++++- usr.bin/lex/initskel.c | 9 ++++----- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/usr.bin/lex/initparse.c b/usr.bin/lex/initparse.c index c723c5b45c40..c95305aa1a91 100644 --- a/usr.bin/lex/initparse.c +++ b/usr.bin/lex/initparse.c @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ @@ -6,7 +5,7 @@ #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define YYPATCH 20170430 +#define YYPATCH 20200330 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) @@ -19,8 +18,6 @@ #define YYPURE 0 #line 35 "parse.y" -/* SPDX-License-Identifier: BSD-2-Clause */ - /* Copyright (c) 1990 The Regents of the University of California. */ /* All rights reserved. */ @@ -130,6 +127,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +#if !(defined(yylex) || defined(YYSTATE)) +int YYLEX_DECL(); +#endif + /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL #define YYERROR_DECL() yyerror(const char *s) @@ -488,13 +489,15 @@ static const char *const yyrule[] = { }; #endif +#if YYDEBUG int yydebug; -int yynerrs; +#endif int yyerrflag; int yychar; YYSTYPE yyval; YYSTYPE yylval; +int yynerrs; /* define the initial stack-sizes */ #ifdef YYSTACKSIZE @@ -655,7 +658,7 @@ void yyerror( const char *msg ) { (void)msg; } -#line 656 "parse.c" +#line 662 "parse.c" #if YYDEBUG #include /* needed for printf */ @@ -1781,7 +1784,7 @@ case 96: #line 946 "parse.y" { yyval = mkstate( SYM_EPSILON ); } break; -#line 1782 "parse.c" +#line 1788 "parse.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/usr.bin/lex/initparse.h b/usr.bin/lex/initparse.h index fb0742445d55..b630d282c635 100644 --- a/usr.bin/lex/initparse.h +++ b/usr.bin/lex/initparse.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ #define CHAR 257 #define NUMBER 258 #define SECTEND 259 diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index 46070a4c6dc5..9b6fb4ae5183 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ #line 2 "" @@ -4578,7 +4577,11 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) +#ifdef YY_FLEX_LEX_COMPAT return 0; +#else + return EOF; +#endif if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; diff --git a/usr.bin/lex/initskel.c b/usr.bin/lex/initskel.c index a7a69875521d..53a0ae452aa8 100644 --- a/usr.bin/lex/initskel.c +++ b/usr.bin/lex/initskel.c @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* File created from flex.skl via mkskel.sh */ #include "flexdef.h" @@ -448,11 +447,7 @@ const char *skel[] = { "/* First, we deal with platform-specific or compiler-specific issues. */", "", "#if defined(__FreeBSD__)", - "#ifndef __STDC_LIMIT_MACROS", - "#define __STDC_LIMIT_MACROS", - "#endif", "#include ", - "#include ", "#else", "#define __dead2", "#endif", @@ -2301,7 +2296,11 @@ const char *skel[] = { " case EOB_ACT_END_OF_FILE:", " {", " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )", + "#ifdef YY_FLEX_LEX_COMPAT", " return 0;", + "#else", + " return EOF;", + "#endif", "", " if ( ! YY_G(yy_did_buffer_switch_on_eof) )", " YY_NEW_FILE;", From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:32:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 515655FADA9; Mon, 19 Apr 2021 18:32: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 4FPFm61TkBz4jMh; Mon, 19 Apr 2021 18:32:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25CF323F73; Mon, 19 Apr 2021 18:32: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 13JIWMdC046051; Mon, 19 Apr 2021 18:32:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIWMCl046050; Mon, 19 Apr 2021 18:32:22 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:32:22 GMT Message-Id: <202104191832.13JIWMCl046050@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: 578c26f31c0c - main - linkat(2): check NIRES_EMPTYPATH on the first fd arg 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: 578c26f31c0c90c9e6b2f7125a8539c307a51dff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:32:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=578c26f31c0c90c9e6b2f7125a8539c307a51dff commit 578c26f31c0c90c9e6b2f7125a8539c307a51dff Author: Konstantin Belousov AuthorDate: 2021-04-19 13:35:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:32:01 +0000 linkat(2): check NIRES_EMPTYPATH on the first fd arg Reported by: arichardson Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29834 --- sys/kern/vfs_syscalls.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 43104a472b5b..26a8d31e4456 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1575,6 +1575,13 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); + if ((nd.ni_resflags & NIRES_EMPTYPATH) != 0) { + error = priv_check(td, PRIV_VFS_FHOPEN); + if (error != 0) { + vrele(nd.ni_vp); + return (error); + } + } error = kern_linkat_vp(td, nd.ni_vp, fd2, path2, segflag); } while (error == EAGAIN || error == ERELOOKUP); return (error); @@ -1596,23 +1603,6 @@ kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, const char *path, LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflag, path, fd, &cap_linkat_target_rights, td); if ((error = namei(&nd)) == 0) { - if ((nd.ni_resflags & NIRES_EMPTYPATH) != 0) { - error = priv_check(td, PRIV_VFS_FHOPEN); - if (error != 0) { - NDFREE(&nd, NDF_ONLY_PNBUF); - if (nd.ni_vp != NULL) { - if (nd.ni_dvp == nd.ni_vp) - vrele(nd.ni_dvp); - else - vput(nd.ni_dvp); - vrele(nd.ni_vp); - } else { - vput(nd.ni_dvp); - } - vrele(vp); - return (error); - } - } if (nd.ni_vp != NULL) { NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_dvp == nd.ni_vp) From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:32:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72D425FAF82; Mon, 19 Apr 2021 18:32: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 4FPFm72glYz4jQD; Mon, 19 Apr 2021 18:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ACF323D60; Mon, 19 Apr 2021 18:32: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 13JIWNW4046072; Mon, 19 Apr 2021 18:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIWNPh046071; Mon, 19 Apr 2021 18:32:23 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:32:23 GMT Message-Id: <202104191832.13JIWNPh046071@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: 4342ba184c15 - main - sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault 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: 4342ba184c15f3b8912e95f93fe313731963f065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:32:23 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4342ba184c15f3b8912e95f93fe313731963f065 commit 4342ba184c15f3b8912e95f93fe313731963f065 Author: Konstantin Belousov AuthorDate: 2021-04-18 16:09:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:32:01 +0000 sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault In particular, this avoids malloc(9) calls when from early tunable handling, with no working malloc yet. Reported and tested by: mav Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sysctl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 011e3f44a124..e46584758c9b 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1785,6 +1785,15 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS) sx_xlock(&sysctlstringlock); ((char *)arg1)[0] = '\0'; sx_xunlock(&sysctlstringlock); + } else if (req->newfunc == sysctl_new_kernel) { + arg2 = req->newlen - req->newidx; + sx_xlock(&sysctlstringlock); + error = SYSCTL_IN(req, arg1, arg2); + if (error == 0) { + ((char *)arg1)[arg2] = '\0'; + req->newidx += arg2; + } + sx_xunlock(&sysctlstringlock); } else { arg2 = req->newlen - req->newidx; tmparg = malloc(arg2, M_SYSCTLTMP, M_WAITOK); From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:32:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0CCD5FAF23; Mon, 19 Apr 2021 18:32: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 4FPFm848xwz4j5f; Mon, 19 Apr 2021 18:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67CAE2421C; Mon, 19 Apr 2021 18:32: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 13JIWOSJ046100; Mon, 19 Apr 2021 18:32:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIWOh2046099; Mon, 19 Apr 2021 18:32:24 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:32:24 GMT Message-Id: <202104191832.13JIWOh2046099@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: ecfbddf0cde3 - main - sysctl vm.objects: report backing object and swap use 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: ecfbddf0cde3d4151217e3eb2d7c5388a423d397 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:32:24 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ecfbddf0cde3d4151217e3eb2d7c5388a423d397 commit ecfbddf0cde3d4151217e3eb2d7c5388a423d397 Author: Konstantin Belousov AuthorDate: 2021-04-15 09:27:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:32:01 +0000 sysctl vm.objects: report backing object and swap use For anonymous objects, provide a handle kvo_me naming the object, and report the handle of the backing object. This allows userspace to deconstruct the shadow chain. Right now the handle is the address of the object in KVA, but this is not guaranteed. For the same anonymous objects, report the swap space used for actually swapped out pages, in kvo_swapped field. I do not believe that it is useful to report full 64bit counter there, so only uint32_t value is returned, clamped to the max. For kinfo_vmentry, report anonymous object handle backing the entry, so that the shadow chain for the specific mapping can be deconstructed. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29771 --- sys/kern/kern_proc.c | 3 +++ sys/sys/user.h | 20 ++++++++++++++++---- sys/vm/swap_pager.c | 23 +++++++++++++++++++++++ sys/vm/swap_pager.h | 1 + sys/vm/vm_object.c | 13 ++++++++++++- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 817cb9766bbf..33f168836370 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2538,6 +2538,9 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) bzero(kve, sizeof(*kve)); obj = entry->object.vm_object; if (obj != NULL) { + if ((obj->flags & OBJ_ANON) != 0) + kve->kve_obj = (uintptr_t)obj; + for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { VM_OBJECT_RLOCK(tobj); diff --git a/sys/sys/user.h b/sys/sys/user.h index f882e7dcd699..14471c91572f 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -529,12 +529,17 @@ struct kinfo_vmentry { uint32_t kve_vn_rdev_freebsd11; /* Device id if device. */ uint16_t kve_vn_mode; /* File mode. */ uint16_t kve_status; /* Status flags. */ - uint64_t kve_vn_fsid; /* dev_t of vnode location */ + union { + uint64_t _kve_vn_fsid; /* dev_t of vnode location */ + uint64_t _kve_obj; /* handle of anon obj */ + } kve_type_spec; uint64_t kve_vn_rdev; /* Device id if device. */ int _kve_ispare[8]; /* Space for more stuff. */ /* Truncated before copyout in sysctl */ char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ }; +#define kve_vn_fsid kve_type_spec._kve_vn_fsid +#define kve_obj kve_type_spec._kve_obj /* * The "vm.objects" sysctl provides a list of all VM objects in the system @@ -552,11 +557,18 @@ struct kinfo_vmobject { uint64_t kvo_resident; /* Number of resident pages. */ uint64_t kvo_active; /* Number of active pages. */ uint64_t kvo_inactive; /* Number of inactive pages. */ - uint64_t kvo_vn_fsid; - uint64_t _kvo_qspare[7]; - uint32_t _kvo_ispare[8]; + union { + uint64_t _kvo_vn_fsid; + uint64_t _kvo_backing_obj; /* Handle for the backing obj */ + } kvo_type_spec; /* Type-specific union */ + uint64_t kvo_me; /* Uniq handle for anon obj */ + uint64_t _kvo_qspare[6]; + uint32_t kvo_swapped; /* Number of swapped pages */ + uint32_t _kvo_ispare[7]; char kvo_path[PATH_MAX]; /* Pathname, if any. */ }; +#define kvo_vn_fsid kvo_type_spec._kvo_vn_fsid +#define kvo_backing_obj kvo_type_spec._kvo_backing_obj /* * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 3789a0217252..888df04741b4 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1763,6 +1763,29 @@ swp_pager_force_dirty(vm_page_t m) vm_page_launder(m); } +u_long +swap_pager_swapped_pages(vm_object_t object) +{ + struct swblk *sb; + vm_pindex_t pi; + u_long res; + int i; + + VM_OBJECT_ASSERT_LOCKED(object); + if (object->type != OBJT_SWAP) + return (0); + + for (res = 0, pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi)) != NULL; + pi = sb->p + SWAP_META_PAGES) { + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + res++; + } + } + return (res); +} + /* * swap_pager_swapoff_object: * diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 80dca93fbf85..59ca2cc2cfdb 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -81,6 +81,7 @@ void swap_pager_swap_init(void); int swap_pager_nswapdev(void); int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_status(int *total, int *used); +u_long swap_pager_swapped_pages(vm_object_t object); void swapoff_all(void); #endif /* _KERNEL */ diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 35ea9cc45fae..1f5194464b69 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2524,6 +2525,7 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) struct vattr va; vm_object_t obj; vm_page_t m; + u_long sp; int count, error; if (req->oldptr == NULL) { @@ -2590,8 +2592,17 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) freepath = NULL; fullpath = ""; kvo->kvo_type = vm_object_kvme_type(obj, &vp); - if (vp != NULL) + if (vp != NULL) { vref(vp); + } else if ((obj->flags & OBJ_ANON) != 0) { + MPASS(kvo->kvo_type == KVME_TYPE_DEFAULT || + kvo->kvo_type == KVME_TYPE_SWAP); + kvo->kvo_me = (uintptr_t)obj; + /* tmpfs objs are reported as vnodes */ + kvo->kvo_backing_obj = (uintptr_t)obj->backing_object; + sp = swap_pager_swapped_pages(obj); + kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp; + } VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(vp, &fullpath, &freepath); From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:38:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 500BB5FB048; Mon, 19 Apr 2021 18:38: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 4FPFtx1q4sz4jTS; Mon, 19 Apr 2021 18:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D2E824220; Mon, 19 Apr 2021 18:38: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 13JIcH74046890; Mon, 19 Apr 2021 18:38:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIcHkl046889; Mon, 19 Apr 2021 18:38:17 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:38:17 GMT Message-Id: <202104191838.13JIcHkl046889@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: 4ce1f6162e9e - main - linuxkpi: some style, wrap too long lines 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: 4ce1f6162e9eb576ac40f24b8538f55e83ef5eb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:38:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4ce1f6162e9eb576ac40f24b8538f55e83ef5eb4 commit 4ce1f6162e9eb576ac40f24b8538f55e83ef5eb4 Author: Konstantin Belousov AuthorDate: 2021-03-11 06:08:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:34:07 +0000 linuxkpi: some style, wrap too long lines Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_current.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 611d10df3383..081eab8edab1 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -236,7 +236,8 @@ linux_current_init(void *arg __unused) linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); } -SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); +SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, + linux_current_init, NULL); static void linux_current_uninit(void *arg __unused) @@ -260,4 +261,5 @@ linux_current_uninit(void *arg __unused) EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); lkpi_alloc_current = linux_alloc_current_noop; } -SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_uninit, NULL); +SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, + linux_current_uninit, NULL); From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:38:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BF605FB204; Mon, 19 Apr 2021 18:38: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 4FPFty2Bs3z4jW9; Mon, 19 Apr 2021 18:38:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D7602432D; Mon, 19 Apr 2021 18:38: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 13JIcIEe046911; Mon, 19 Apr 2021 18:38:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIcIC7046910; Mon, 19 Apr 2021 18:38:18 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:38:18 GMT Message-Id: <202104191838.13JIcIC7046910@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: 165ba13fb806 - main - linuxkpi: guarantee allocations of task and mm for interrupt threads 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: 165ba13fb806c8596f868981883631a5ee78d6c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:38:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=165ba13fb806c8596f868981883631a5ee78d6c8 commit 165ba13fb806c8596f868981883631a5ee78d6c8 Author: Konstantin Belousov AuthorDate: 2021-03-11 06:34:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:34:08 +0000 linuxkpi: guarantee allocations of task and mm for interrupt threads Create and use zones for task and mm. Reserve items in zones based on the estimation of the max number of interrupts in the system. Use M_USE_RESERVE to allow to take reserved items when allocation occurs from the interrupt thread context. Of course, this would only work first time we allocate the task for interrupt thread. If interrupt is deallocated and allocated anew, creating a new thread, it might be that zone is depleted. It still should be good enough for practical uses. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_current.c | 66 ++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 081eab8edab1..ef51acc1952e 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -31,14 +31,22 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include +#include + +#if defined(__i386__) || defined(__amd64__) +extern u_int first_msi_irq, num_msi_irqs; +#endif static eventhandler_tag linuxkpi_thread_dtor_tag; -static MALLOC_DEFINE(M_LINUX_CURRENT, "linuxcurrent", "LinuxKPI task structure"); +static uma_zone_t linux_current_zone; +static uma_zone_t linux_mm_zone; int linux_alloc_current(struct thread *td, int flags) @@ -52,13 +60,23 @@ linux_alloc_current(struct thread *td, int flags) MPASS(td->td_lkpi_task == NULL); - ts = malloc(sizeof(*ts), M_LINUX_CURRENT, flags | M_ZERO); - if (ts == NULL) + if ((td->td_pflags & TDP_ITHREAD) != 0 || !THREAD_CAN_SLEEP()) { + flags &= ~M_WAITOK; + flags |= M_NOWAIT | M_USE_RESERVE; + } + + ts = uma_zalloc(linux_current_zone, flags | M_ZERO); + if (ts == NULL) { + if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) + panic("linux_alloc_current: failed to allocate task"); return (ENOMEM); + } - mm = malloc(sizeof(*mm), M_LINUX_CURRENT, flags | M_ZERO); + mm = uma_zalloc(linux_mm_zone, flags | M_ZERO); if (mm == NULL) { - free(ts, M_LINUX_CURRENT); + if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) + panic("linux_alloc_current: failed to allocate mm"); + uma_zfree(linux_current_zone, mm); return (ENOMEM); } @@ -111,7 +129,7 @@ linux_alloc_current(struct thread *td, int flags) PROC_UNLOCK(proc); /* free mm_struct pointer, if any */ - free(mm, M_LINUX_CURRENT); + uma_zfree(linux_mm_zone, mm); return (0); } @@ -132,14 +150,14 @@ linux_get_task_mm(struct task_struct *task) void linux_mm_dtor(struct mm_struct *mm) { - free(mm, M_LINUX_CURRENT); + uma_zfree(linux_mm_zone, mm); } void linux_free_current(struct task_struct *ts) { mmput(ts->mm); - free(ts, M_LINUX_CURRENT); + uma_zfree(linux_current_zone, ts); } static void @@ -229,12 +247,42 @@ linux_task_exiting(struct task_struct *task) return (ret); } +static int lkpi_task_resrv; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, task_struct_reserve, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &lkpi_task_resrv, 0, + "Number of struct task and struct mm to reserve for non-sleepable " + "allocations"); + static void linux_current_init(void *arg __unused) { lkpi_alloc_current = linux_alloc_current; linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); + + TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve", + &lkpi_task_resrv); + if (lkpi_task_resrv == 0) { +#if defined(__i386__) || defined(__amd64__) + /* + * Number of interrupt threads plus per-cpu callout + * SWI threads. + */ + lkpi_task_resrv = first_msi_irq + num_msi_irqs + MAXCPU; +#else + lkpi_task_resrv = 1024; /* XXXKIB arbitrary */ +#endif + } + linux_current_zone = uma_zcreate("lkpicurr", + sizeof(struct task_struct), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + uma_zone_reserve(linux_current_zone, lkpi_task_resrv); + uma_prealloc(linux_current_zone, lkpi_task_resrv); + linux_mm_zone = uma_zcreate("lkpimm", + sizeof(struct task_struct), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + uma_zone_reserve(linux_mm_zone, lkpi_task_resrv); + uma_prealloc(linux_mm_zone, lkpi_task_resrv); } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -260,6 +308,8 @@ linux_current_uninit(void *arg __unused) sx_sunlock(&allproc_lock); EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); lkpi_alloc_current = linux_alloc_current_noop; + uma_zdestroy(linux_current_zone); + uma_zdestroy(linux_mm_zone); } SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_uninit, NULL); From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:38:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF0425FAFD7; Mon, 19 Apr 2021 18:38: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 4FPFtz4LZFz4jJq; Mon, 19 Apr 2021 18:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72AD124221; Mon, 19 Apr 2021 18:38: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 13JIcJAs046939; Mon, 19 Apr 2021 18:38:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIcJF0046938; Mon, 19 Apr 2021 18:38:19 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:38:19 GMT Message-Id: <202104191838.13JIcJF0046938@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: fad437ba612a - main - linuxkpi: reduce number of stray mm_struct allocations 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: fad437ba612a7c19f5cf1633e2d0d1c44d4dd478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:38:19 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fad437ba612a7c19f5cf1633e2d0d1c44d4dd478 commit fad437ba612a7c19f5cf1633e2d0d1c44d4dd478 Author: Konstantin Belousov AuthorDate: 2021-03-11 06:48:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-19 18:34:08 +0000 linuxkpi: reduce number of stray mm_struct allocations Only allocate struct_mm after we checked that other threads do not carry useful mm_struct. If they don't, drop process lock, allocate, and recheck. Note that for M_NOWAIT allocations we could avoid dropping process lock, but I do not think that this increased complexity is useful. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_current.c | 85 +++++++++++++++----------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index ef51acc1952e..9bae7ee92e49 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -48,15 +48,35 @@ static eventhandler_tag linuxkpi_thread_dtor_tag; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; +/* check if another thread already has a mm_struct */ +static struct mm_struct * +find_other_mm(struct proc *p) +{ + struct thread *td; + struct task_struct *ts; + struct mm_struct *mm; + + PROC_LOCK_ASSERT(p, MA_OWNED); + FOREACH_THREAD_IN_PROC(p, td) { + ts = td->td_lkpi_task; + if (ts == NULL) + continue; + mm = ts->mm; + if (mm == NULL) + continue; + /* try to share other mm_struct */ + if (atomic_inc_not_zero(&mm->mm_users)) + return (mm); + } + return (NULL); +} + int linux_alloc_current(struct thread *td, int flags) { struct proc *proc; - struct thread *td_other; struct task_struct *ts; - struct task_struct *ts_other; - struct mm_struct *mm; - struct mm_struct *mm_other; + struct mm_struct *mm, *mm_other; MPASS(td->td_lkpi_task == NULL); @@ -71,14 +91,7 @@ linux_alloc_current(struct thread *td, int flags) panic("linux_alloc_current: failed to allocate task"); return (ENOMEM); } - - mm = uma_zalloc(linux_mm_zone, flags | M_ZERO); - if (mm == NULL) { - if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) - panic("linux_alloc_current: failed to allocate mm"); - uma_zfree(linux_current_zone, mm); - return (ENOMEM); - } + mm = NULL; /* setup new task structure */ atomic_set(&ts->kthread_flags, 0); @@ -93,35 +106,37 @@ linux_alloc_current(struct thread *td, int flags) proc = td->td_proc; - /* check if another thread already has a mm_struct */ PROC_LOCK(proc); - FOREACH_THREAD_IN_PROC(proc, td_other) { - ts_other = td_other->td_lkpi_task; - if (ts_other == NULL) - continue; + mm_other = find_other_mm(proc); - mm_other = ts_other->mm; - if (mm_other == NULL) - continue; + /* use allocated mm_struct as a fallback */ + if (mm_other == NULL) { + PROC_UNLOCK(proc); + mm = uma_zalloc(linux_mm_zone, flags | M_ZERO); + if (mm == NULL) { + if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) + panic( + "linux_alloc_current: failed to allocate mm"); + uma_zfree(linux_current_zone, mm); + return (ENOMEM); + } - /* try to share other mm_struct */ - if (atomic_inc_not_zero(&mm_other->mm_users)) { + PROC_LOCK(proc); + mm_other = find_other_mm(proc); + if (mm_other == NULL) { + /* setup new mm_struct */ + init_rwsem(&mm->mmap_sem); + atomic_set(&mm->mm_count, 1); + atomic_set(&mm->mm_users, 1); /* set mm_struct pointer */ + ts->mm = mm; + /* clear pointer to not free memory */ + mm = NULL; + } else { ts->mm = mm_other; - break; } - } - - /* use allocated mm_struct as a fallback */ - if (ts->mm == NULL) { - /* setup new mm_struct */ - init_rwsem(&mm->mmap_sem); - atomic_set(&mm->mm_count, 1); - atomic_set(&mm->mm_users, 1); - /* set mm_struct pointer */ - ts->mm = mm; - /* clear pointer to not free memory */ - mm = NULL; + } else { + ts->mm = mm_other; } /* store pointer to task struct */ From owner-dev-commits-src-main@freebsd.org Mon Apr 19 18:42:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EADE5FB613; Mon, 19 Apr 2021 18:42: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 4FPFzH3ZYdz4jmX; Mon, 19 Apr 2021 18:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E183243B3; Mon, 19 Apr 2021 18:42: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 13JIg3NZ059539; Mon, 19 Apr 2021 18:42:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JIg3bg059538; Mon, 19 Apr 2021 18:42:03 GMT (envelope-from git) Date: Mon, 19 Apr 2021 18:42:03 GMT Message-Id: <202104191842.13JIg3bg059538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: d3f0c032fb8b - main - bsdinstall: restore time selection screen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3f0c032fb8b2d2ee8d491fa95108a3790541662 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 18:42:03 -0000 The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=d3f0c032fb8b2d2ee8d491fa95108a3790541662 commit d3f0c032fb8b2d2ee8d491fa95108a3790541662 Author: Yuri Pankov AuthorDate: 2021-04-19 18:39:59 +0000 Commit: Yuri Pankov CommitDate: 2021-04-19 18:39:59 +0000 bsdinstall: restore time selection screen Apparently new dialog does not like the height of 2 for the timebox widget, use 0 (minimum size) instead. Do the same for calendar widget as it does not change the appearance and to prevent possible future surprises. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29720 --- usr.sbin/bsdinstall/scripts/time | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/time b/usr.sbin/bsdinstall/scripts/time index 67e539b53658..cccd5999a035 100755 --- a/usr.sbin/bsdinstall/scripts/time +++ b/usr.sbin/bsdinstall/scripts/time @@ -42,7 +42,7 @@ DATE=$(dialog --backtitle 'FreeBSD Installer' \ --cancel-label 'Skip' \ --defaultno \ --date-format '%Y%m%d%H%M.%S' \ - --calendar '' 2 40 \ + --calendar '' 0 40 \ 2>&1 1>&3) && date $DATE exec 3>&- @@ -54,7 +54,7 @@ TIME=$(dialog --backtitle 'FreeBSD Installer' \ --cancel-label 'Skip' \ --defaultno \ --time-format '%H%M.%S' \ - --timebox '' 2 40 \ + --timebox '' 0 40 \ 2>&1 1>&3) && date $TIME exec 3>&- From owner-dev-commits-src-main@freebsd.org Mon Apr 19 19:25:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D20D5FCEC8; Mon, 19 Apr 2021 19:25: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 4FPGxX3zpKz4m4Z; Mon, 19 Apr 2021 19:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 778EC24DC7; Mon, 19 Apr 2021 19:25: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 13JJPa64014480; Mon, 19 Apr 2021 19:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JJPawQ014479; Mon, 19 Apr 2021 19:25:36 GMT (envelope-from git) Date: Mon, 19 Apr 2021 19:25:36 GMT Message-Id: <202104191925.13JJPawQ014479@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: 407abff2b918 - main - Cirrus-CI: use FreeBSD 13.0 image for base system CI build 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: 407abff2b91847e23711625ad7c69c17e99b3d1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 19:25:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=407abff2b91847e23711625ad7c69c17e99b3d1d commit 407abff2b91847e23711625ad7c69c17e99b3d1d Author: Ed Maste AuthorDate: 2021-04-19 18:36:21 +0000 Commit: Ed Maste CommitDate: 2021-04-19 19:23:14 +0000 Cirrus-CI: use FreeBSD 13.0 image for base system CI build We generally want to build and test on the highest release version, and FreeBSD 13.0 also brings some performance benefits. Reviewed by: lwhsu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29842 --- .cirrus.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 0b1814790071..b29dddc34849 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,9 +1,9 @@ # $FreeBSD$ freebsd_instance: - # image: freebsd-12-1-stable-amd64 - # We need a newer image to install llvm11 - image_family: freebsd-12-1-snap + # Image list available via + # gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images + image: freebsd-13-0-release-amd64 cpu: 8 memory: 24G From owner-dev-commits-src-main@freebsd.org Mon Apr 19 19:37:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB75D5FD155; Mon, 19 Apr 2021 19:37:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPHCf5QB0z4mgy; Mon, 19 Apr 2021 19:37:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A814624C6E; Mon, 19 Apr 2021 19:37: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 13JJbo3m027735; Mon, 19 Apr 2021 19:37:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JJbo5J027734; Mon, 19 Apr 2021 19:37:50 GMT (envelope-from git) Date: Mon, 19 Apr 2021 19:37:50 GMT Message-Id: <202104191937.13JJbo5J027734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: deecaa144526 - main - ixgbe: Clean up unneeded set in ixgbe_if_multi_set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: deecaa144526a5d001aeb99149e2139601388427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 19:37:50 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=deecaa144526a5d001aeb99149e2139601388427 commit deecaa144526a5d001aeb99149e2139601388427 Author: Kevin Bowling AuthorDate: 2021-04-19 19:22:22 +0000 Commit: Kevin Bowling CommitDate: 2021-04-19 19:37:30 +0000 ixgbe: Clean up unneeded set in ixgbe_if_multi_set We don't need to set the bits here since the if/else if/else statements fully cover setting these bit pairs. Reported by: markj Reviewed by: markj, erj Approved by: #intel_networking MFC aftter: 1 week Differential Revision: https://reviews.freebsd.org/D29827 --- sys/dev/ixgbe/if_ix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 77ef118493a2..a483fe503c7f 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -3294,7 +3294,7 @@ ixgbe_if_multi_set(if_ctx_t ctx) adapter); fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); - fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); + if (ifp->if_flags & IFF_PROMISC) fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); else if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES || From owner-dev-commits-src-main@freebsd.org Mon Apr 19 19:51:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F31765FD8E1; Mon, 19 Apr 2021 19:51: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 4FPHWQ6ctZz4nQn; Mon, 19 Apr 2021 19:51:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D61CD254BC; Mon, 19 Apr 2021 19:51: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 13JJpUa9052302; Mon, 19 Apr 2021 19:51:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JJpUud052301; Mon, 19 Apr 2021 19:51:30 GMT (envelope-from git) Date: Mon, 19 Apr 2021 19:51:30 GMT Message-Id: <202104191951.13JJpUud052301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 4b38eed76da9 - main - e1000: Correct promisc multicast filter handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b38eed76da9c36f09bff33b5cf15687cd99016f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 19:51:31 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4b38eed76da9c36f09bff33b5cf15687cd99016f commit 4b38eed76da9c36f09bff33b5cf15687cd99016f Author: Kevin Bowling AuthorDate: 2021-04-16 23:15:50 +0000 Commit: Kevin Bowling CommitDate: 2021-04-19 19:49:55 +0000 e1000: Correct promisc multicast filter handling There are a number of issues in the e1000 multicast filter handling that have been present for a long time. Take the updated approach from ixgbe(4) which does not have the issues. The issues are outlined in the PR, in particular this solves crossing over and under the hardware's filter limit, not programming the hardware filter when we are above its limit, disabling SBP (show bad packets) when the tunable is enabled and exiting promiscuous mode, and an off-by-one error in the em_copy_maddr function. PR: 140647 Reported by: jtl Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29789 --- sys/dev/e1000/if_em.c | 62 +++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 79a617b3342f..2c0c8541d7f2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -303,7 +303,6 @@ static int em_enable_phy_wakeup(struct adapter *); static void em_disable_aspm(struct adapter *); int em_intr(void *arg); -static void em_disable_promisc(if_ctx_t ctx); /* MSI-X handlers */ static int em_if_msix_intr_assign(if_ctx_t, int); @@ -1641,11 +1640,20 @@ static int em_if_set_promisc(if_ctx_t ctx, int flags) { struct adapter *adapter = iflib_get_softc(ctx); + struct ifnet *ifp = iflib_get_ifp(ctx); u32 reg_rctl; - - em_disable_promisc(ctx); + int mcnt = 0; reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + reg_rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_UPE); + if (flags & IFF_ALLMULTI) + mcnt = MAX_NUM_MULTICAST_ADDRESSES; + else + mcnt = min(if_llmaddr_count(ifp), MAX_NUM_MULTICAST_ADDRESSES); + + if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) + reg_rctl &= (~E1000_RCTL_MPE); + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); if (flags & IFF_PROMISC) { reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); @@ -1661,37 +1669,15 @@ em_if_set_promisc(if_ctx_t ctx, int flags) return (0); } -static void -em_disable_promisc(if_ctx_t ctx) -{ - struct adapter *adapter = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); - u32 reg_rctl; - int mcnt = 0; - - reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - reg_rctl &= (~E1000_RCTL_UPE); - if (if_getflags(ifp) & IFF_ALLMULTI) - mcnt = MAX_NUM_MULTICAST_ADDRESSES; - else - mcnt = if_llmaddr_count(ifp); - /* Don't disable if in MAX groups */ - if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) - reg_rctl &= (~E1000_RCTL_MPE); - reg_rctl &= (~E1000_RCTL_SBP); - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); -} - - static u_int -em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int idx) { u8 *mta = arg; - if (cnt == MAX_NUM_MULTICAST_ADDRESSES) - return (1); + if (idx == MAX_NUM_MULTICAST_ADDRESSES) + return (0); - bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); + bcopy(LLADDR(sdl), &mta[idx * ETHER_ADDR_LEN], ETHER_ADDR_LEN); return (1); } @@ -1702,14 +1688,13 @@ em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) * This routine is called whenever multicast address list is updated. * **********************************************************************/ - static void em_if_multi_set(if_ctx_t ctx) { struct adapter *adapter = iflib_get_softc(ctx); struct ifnet *ifp = iflib_get_ifp(ctx); - u32 reg_rctl = 0; u8 *mta; /* Multicast array memory */ + u32 reg_rctl = 0; int mcnt = 0; IOCTL_DEBUGOUT("em_set_multi: begin"); @@ -1729,11 +1714,20 @@ em_if_multi_set(if_ctx_t ctx) mcnt = if_foreach_llmaddr(ifp, em_copy_maddr, mta); - if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { - reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + + if (if_getflags(ifp) & IFF_PROMISC) + reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + else if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES || + if_getflags(ifp) & IFF_ALLMULTI) { reg_rctl |= E1000_RCTL_MPE; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + reg_rctl &= ~E1000_RCTL_UPE; } else + reg_rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); + + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + + if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) e1000_update_mc_addr_list(&adapter->hw, mta, mcnt); if (adapter->hw.mac.type == e1000_82542 && From owner-dev-commits-src-main@freebsd.org Mon Apr 19 20:39:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 390155FE9E2; Mon, 19 Apr 2021 20:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPJZK18stz4qZm; Mon, 19 Apr 2021 20:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 168A525BE6; Mon, 19 Apr 2021 20:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13JKd4CA007337; Mon, 19 Apr 2021 20:39:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JKd4k5007336; Mon, 19 Apr 2021 20:39:04 GMT (envelope-from git) Date: Mon, 19 Apr 2021 20:39:04 GMT Message-Id: <202104192039.13JKd4k5007336@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: 37c0f4a20777 - main - Fix typo in rtsock_common.h 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: 37c0f4a2077739e735732374d67525cf6de36d21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 20:39:05 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=37c0f4a2077739e735732374d67525cf6de36d21 commit 37c0f4a2077739e735732374d67525cf6de36d21 Author: Alexander V. Chernikov AuthorDate: 2021-04-19 20:24:42 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-19 20:24:46 +0000 Fix typo in rtsock_common.h MFC after: 3 days --- tests/sys/net/routing/rtsock_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/net/routing/rtsock_common.h b/tests/sys/net/routing/rtsock_common.h index 71476d2b5f3c..ae450ac88ba1 100644 --- a/tests/sys/net/routing/rtsock_common.h +++ b/tests/sys/net/routing/rtsock_common.h @@ -454,7 +454,7 @@ sa_equal_msg_flags(const struct sockaddr *a, const struct sockaddr *b, char *msg b6 = (const struct sockaddr_in6 *)b; if (!IN6_ARE_ADDR_EQUAL(&a6->sin6_addr, &b6->sin6_addr)) { inet_ntop(AF_INET6, &a6->sin6_addr, a_s, sizeof(a_s)); - inet_ntop(AF_INET6, &b6->sin6_addr, a_s, sizeof(a_s)); + inet_ntop(AF_INET6, &b6->sin6_addr, b_s, sizeof(b_s)); snprintf(msg, sz, "addr diff: %s vs %s", a_s, b_s); return 0; } From owner-dev-commits-src-main@freebsd.org Mon Apr 19 20:39:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 710F25FED97; Mon, 19 Apr 2021 20:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPJZL2Jvqz4qdX; Mon, 19 Apr 2021 20:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B2B425D41; Mon, 19 Apr 2021 20:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13JKd6Tm007358; Mon, 19 Apr 2021 20:39:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JKd6og007357; Mon, 19 Apr 2021 20:39:06 GMT (envelope-from git) Date: Mon, 19 Apr 2021 20:39:06 GMT Message-Id: <202104192039.13JKd6og007357@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: 758c9d54d44f - main - Improve error reporting in rtsock.c 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: 758c9d54d44f8ce957570b8c2ef6d1b3f28a792d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 20:39:06 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=758c9d54d44f8ce957570b8c2ef6d1b3f28a792d commit 758c9d54d44f8ce957570b8c2ef6d1b3f28a792d Author: Alexander V. Chernikov AuthorDate: 2021-04-19 20:36:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-19 20:36:41 +0000 Improve error reporting in rtsock.c MFC after: 3 days --- sys/net/rtsock.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index c0996d318fb2..5194a2a15c1e 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -126,6 +126,9 @@ struct ifa_msghdrl32 { #endif /* COMPAT_FREEBSD32 */ +#define RTS_PID_PRINTF(_fmt, ...) \ + printf("rtsock:%s(): PID %d: " _fmt "\n", __func__, curproc->p_pid, ## __VA_ARGS__) + MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); /* NB: these are not modified */ @@ -571,7 +574,7 @@ fill_blackholeinfo(struct rt_addrinfo *info, union sockaddr_union *saun) sa_family_t saf; if (V_loif == NULL) { - printf("Unable to add blackhole/reject nhop without loopback"); + RTS_PID_PRINTF("Unable to add blackhole/reject nhop without loopback"); return (ENOTSUP); } info->rti_ifp = V_loif; @@ -1360,7 +1363,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) { struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { - printf("gw sin_len too small\n"); + RTS_PID_PRINTF("gateway sin_len too small: %d", gw->sa_len); return (EINVAL); } fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); @@ -1372,7 +1375,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) { struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { - printf("gw sin6_len too small\n"); + RTS_PID_PRINTF("gateway sin6_len too small: %d", gw->sa_len); return (EINVAL); } fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); @@ -1386,7 +1389,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) size_t sdl_min_len = offsetof(struct sockaddr_dl, sdl_data); gw_sdl = (struct sockaddr_dl *)gw; if (gw_sdl->sdl_len < sdl_min_len) { - printf("gw sdl_len too small\n"); + RTS_PID_PRINTF("gateway sdl_len too small: %d", gw_sdl->sdl_len); return (EINVAL); } @@ -1433,7 +1436,7 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) return (EINVAL); } if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { - printf("mask sin_len too small\n"); + RTS_PID_PRINTF("prefix mask sin_len too small: %d", mask_sa->sin_len); return (EINVAL); } fill_sockaddr_inet(dst_sa, dst); @@ -1466,11 +1469,11 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { - printf("dst sin6_len too small\n"); + RTS_PID_PRINTF("prefix dst sin6_len too small: %d", dst_sa->sin6_len); return (EINVAL); } if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { - printf("mask sin6_len too small\n"); + RTS_PID_PRINTF("rtsock: prefix mask sin6_len too small: %d", mask_sa->sin6_len); return (EINVAL); } fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); @@ -2092,9 +2095,9 @@ rt_dispatch(struct mbuf *m, sa_family_t saf) } /* - * Checks if rte can be exported v.r.t jails/vnets. + * Checks if rte can be exported w.r.t jails/vnets. * - * Returns 1 if it can, 0 otherwise. + * Returns true if it can, false otherwise. */ static bool can_export_rte(struct ucred *td_ucred, bool rt_is_host, From owner-dev-commits-src-main@freebsd.org Mon Apr 19 21:36:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBFA65FFE22; Mon, 19 Apr 2021 21:36: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 4FPKrh6Q7Dz4tBk; Mon, 19 Apr 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEFA726B08; Mon, 19 Apr 2021 21:36: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 13JLaaVi086813; Mon, 19 Apr 2021 21:36:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JLaamq086811; Mon, 19 Apr 2021 21:36:36 GMT (envelope-from git) Date: Mon, 19 Apr 2021 21:36:36 GMT Message-Id: <202104192136.13JLaamq086811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 59690eab572d - main - e1000: Add support for [Tiger, Alder, Meteor] Lake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59690eab572dde1176886bff7ed0c506df974e5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 21:36:37 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=59690eab572dde1176886bff7ed0c506df974e5e commit 59690eab572dde1176886bff7ed0c506df974e5e Author: Kevin Bowling AuthorDate: 2021-04-19 02:11:27 +0000 Commit: Kevin Bowling CommitDate: 2021-04-19 21:32:59 +0000 e1000: Add support for [Tiger, Alder, Meteor] Lake Add support for current and future client platform PCI IDs. These are all I219 variants and have no known driver changes versus previous generation client platform I219 variants. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29801 --- sys/dev/e1000/e1000_api.c | 23 +++++++++++++++++++++++ sys/dev/e1000/e1000_hw.h | 17 +++++++++++++++++ sys/dev/e1000/e1000_ich8lan.c | 21 +++++++++++++++++++++ sys/dev/e1000/if_em.c | 23 +++++++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 4f860166aba4..b1d5ef74c24f 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -327,6 +327,26 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_CMP_I219_V11: mac->type = e1000_pch_cnp; break; + case E1000_DEV_ID_PCH_TGP_I219_LM13: + case E1000_DEV_ID_PCH_TGP_I219_V13: + case E1000_DEV_ID_PCH_TGP_I219_LM14: + case E1000_DEV_ID_PCH_TGP_I219_V14: + case E1000_DEV_ID_PCH_TGP_I219_LM15: + case E1000_DEV_ID_PCH_TGP_I219_V15: + mac->type = e1000_pch_tgp; + break; + case E1000_DEV_ID_PCH_ADL_I219_LM16: + case E1000_DEV_ID_PCH_ADL_I219_V16: + case E1000_DEV_ID_PCH_ADL_I219_LM17: + case E1000_DEV_ID_PCH_ADL_I219_V17: + mac->type = e1000_pch_adp; + break; + case E1000_DEV_ID_PCH_MTP_I219_LM18: + case E1000_DEV_ID_PCH_MTP_I219_V18: + case E1000_DEV_ID_PCH_MTP_I219_LM19: + case E1000_DEV_ID_PCH_MTP_I219_V19: + mac->type = e1000_pch_mtp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -479,6 +499,9 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index f521c2c8c5e6..b3eb1641cca9 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -161,6 +161,20 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_CMP_I219_V11 0x0D4D #define E1000_DEV_ID_PCH_CMP_I219_LM12 0x0D53 #define E1000_DEV_ID_PCH_CMP_I219_V12 0x0D55 +#define E1000_DEV_ID_PCH_TGP_I219_LM13 0x15FB +#define E1000_DEV_ID_PCH_TGP_I219_V13 0x15FC +#define E1000_DEV_ID_PCH_TGP_I219_LM14 0x15F9 +#define E1000_DEV_ID_PCH_TGP_I219_V14 0x15FA +#define E1000_DEV_ID_PCH_TGP_I219_LM15 0x15F4 +#define E1000_DEV_ID_PCH_TGP_I219_V15 0x15F5 +#define E1000_DEV_ID_PCH_ADL_I219_LM16 0x1A1E +#define E1000_DEV_ID_PCH_ADL_I219_V16 0x1A1F +#define E1000_DEV_ID_PCH_ADL_I219_LM17 0x1A1C +#define E1000_DEV_ID_PCH_ADL_I219_V17 0x1A1D +#define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A +#define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B +#define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C +#define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -248,6 +262,9 @@ enum e1000_mac_type { e1000_pch_lpt, e1000_pch_spt, e1000_pch_cnp, + e1000_pch_tgp, + e1000_pch_adp, + e1000_pch_mtp, e1000_82575, e1000_82576, e1000_82580, diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index b4f8b6a2b694..b798bacb37a0 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -346,6 +346,9 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -495,6 +498,9 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -794,6 +800,9 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1832,6 +1841,9 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2288,6 +2300,9 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -3408,6 +3423,9 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) switch (hw->mac.type) { case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4377,6 +4395,9 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 2c0c8541d7f2..6f711196c228 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -180,6 +180,20 @@ static pci_vendor_info_t em_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V11, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_LM12, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V12, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM19, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V19, "Intel(R) PRO/1000 Network Connection"), /* required last entry */ PVID_END }; @@ -1218,6 +1232,9 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: @@ -2516,6 +2533,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: pba = E1000_PBA_26K; break; case e1000_82575: @@ -2626,6 +2646,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; From owner-dev-commits-src-main@freebsd.org Mon Apr 19 22:10:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A0185D8D15; Mon, 19 Apr 2021 22:10: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 4FPLbZ0Btmz4vJK; Mon, 19 Apr 2021 22:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDC0027095; Mon, 19 Apr 2021 22:10: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 13JMAHo4033755; Mon, 19 Apr 2021 22:10:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JMAHe0033748; Mon, 19 Apr 2021 22:10:17 GMT (envelope-from git) Date: Mon, 19 Apr 2021 22:10:17 GMT Message-Id: <202104192210.13JMAHe0033748@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: 2763a0928aee - main - config: style for '\0' and NULL 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: 2763a0928aeedc3c76b0953af9fa7b948026d81b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 22:10:18 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2763a0928aeedc3c76b0953af9fa7b948026d81b commit 2763a0928aeedc3c76b0953af9fa7b948026d81b Author: Warner Losh AuthorDate: 2021-04-19 22:09:42 +0000 Commit: Warner Losh CommitDate: 2021-04-19 22:10:12 +0000 config: style for '\0' and NULL Use NULL for pointers instead of '0' (though hey are the same thing in these cases). Ditto for using the zero character '\0' instead of a naked 0 (ditto). Reviewed by: markj@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29847 --- usr.sbin/config/mkmakefile.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 00eb3422d1d0..4f3bd13ffca3 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -193,7 +193,7 @@ sanitize_envline(char *result, const char *src) /* If there is no '=' it's not a well-formed name=value line. */ if ((eq = strchr(src, '=')) == NULL) { - *result = 0; + *result = '\0'; return; } dst = result; @@ -210,7 +210,7 @@ sanitize_envline(char *result, const char *src) /* If it was all leading space, we don't have a well-formed line. */ if (leading) { - *result = 0; + *result = '\0'; return; } @@ -221,7 +221,7 @@ sanitize_envline(char *result, const char *src) /* Copy chars after the '=', skipping any leading whitespace. */ leading = true; - while ((c = *src++) != 0) { + while ((c = *src++) != '\0') { if (leading && (isspace(c) || c == '"')) continue; *dst++ = c; @@ -230,7 +230,7 @@ sanitize_envline(char *result, const char *src) /* If it was all leading space, it's a valid 'var=' (nil value). */ if (leading) { - *dst = 0; + *dst = '\0'; return; } @@ -238,7 +238,7 @@ sanitize_envline(char *result, const char *src) while (isspace(dst[-1]) || dst[-1] == '"') --dst; - *dst = 0; + *dst = '\0'; } /* @@ -444,10 +444,10 @@ next: compile = 0; match = 1; nreqs = 0; - compilewith = 0; - depends = 0; - clean = 0; - warning = 0; + compilewith = NULL; + depends = NULL; + clean = NULL; + warning = NULL; std = 0; imp_rule = 0; no_ctfconvert = 0; From owner-dev-commits-src-main@freebsd.org Mon Apr 19 22:16:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7590F5D9321; Mon, 19 Apr 2021 22:16:18 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPLkV1ZPgz3BvF; Mon, 19 Apr 2021 22:16:17 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 13JMGG1u018269 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 19 Apr 2021 15:16:16 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 13JMGG1A018268; Mon, 19 Apr 2021 15:16:16 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 19 Apr 2021 15:16:16 -0700 From: Gleb Smirnoff To: Richard Scheffenegger Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b87cf2bc841b - main - tcp: keep SACK scoreboard sorted when doing rescue retransmission Message-ID: References: <202104182112.13ILCMoW039801@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202104182112.13ILCMoW039801@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FPLkV1ZPgz3BvF X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 22:16:18 -0000 On Sun, Apr 18, 2021 at 09:12:22PM +0000, Richard Scheffenegger wrote: R> The branch main has been updated by rscheff: R> R> URL: https://cgit.FreeBSD.org/src/commit/?id=b87cf2bc841b2a336b7f0c6cd89573610412a84f R> R> commit b87cf2bc841b2a336b7f0c6cd89573610412a84f R> Author: Richard Scheffenegger R> AuthorDate: 2021-04-18 20:14:14 +0000 R> Commit: Richard Scheffenegger R> CommitDate: 2021-04-18 21:11:10 +0000 R> R> tcp: keep SACK scoreboard sorted when doing rescue retransmission R> R> Reviewed By: tuexen, kbowling, #transport R> MFC after: 3 days R> Sponsored by: NetApp, Inc. R> Differential Revision: https://reviews.freebsd.org/D29825 R> --- R> sys/netinet/tcp_sack.c | 12 ++++++++++-- R> 1 file changed, 10 insertions(+), 2 deletions(-) R> R> diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c R> index a28bb40a8332..fffba2e75045 100644 R> --- a/sys/netinet/tcp_sack.c R> +++ b/sys/netinet/tcp_sack.c R> @@ -497,7 +497,7 @@ static struct sackhole * R> tcp_sackhole_insert(struct tcpcb *tp, tcp_seq start, tcp_seq end, R> struct sackhole *after) R> { R> - struct sackhole *hole; R> + struct sackhole *hole, *tail; R> R> /* Allocate a new SACK hole. */ R> hole = tcp_sackhole_alloc(tp, start, end); R> @@ -508,7 +508,15 @@ tcp_sackhole_insert(struct tcpcb *tp, tcp_seq start, tcp_seq end, R> if (after != NULL) R> TAILQ_INSERT_AFTER(&tp->snd_holes, after, hole, scblink); R> else R> - TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink); R> + /* R> + * With Rescue Retransmission, new holes may need to R> + * be inserted just before the tail. R> + */ R> + if (((tail = TAILQ_LAST_FAST(&tp->snd_holes, sackhole, R> + scblink)) != NULL) && SEQ_LEQ(end, tail->start)) R> + TAILQ_INSERT_BEFORE(tail, hole, scblink); R> + else R> + TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink); IMHO, formatting here violates style and also may be misleading. Should be: if (after != NULL) TAILQ_INSERT_AFTER(&tp->snd_holes, after, hole, scblink); else if (((tail = TAILQ_LAST_FAST(&tp->snd_holes, sackhole, scblink)) != NULL) && SEQ_LEQ(end, tail->start)) /* * With Rescue Retransmission, new holes may need to * be inserted just before the tail. */ TAILQ_INSERT_BEFORE(tail, hole, scblink); else TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink); -- Gleb Smirnoff From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:20:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D60D5DBF5E; Tue, 20 Apr 2021 00:20: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 4FPPV76wzmz3H9m; Tue, 20 Apr 2021 00:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0DC5B58; Tue, 20 Apr 2021 00:20: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 13K0KlJg006814; Tue, 20 Apr 2021 00:20:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0KlIM006813; Tue, 20 Apr 2021 00:20:47 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:20:47 GMT Message-Id: <202104200020.13K0KlIM006813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: faa9ad8a9005 - main - Fix off-by-one error in KASSERT from 02f26e98c7f4. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: faa9ad8a90058cf07e806cea51c0030bf69f88db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:20:48 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=faa9ad8a90058cf07e806cea51c0030bf69f88db commit faa9ad8a90058cf07e806cea51c0030bf69f88db Author: Gleb Smirnoff AuthorDate: 2021-04-20 00:20:19 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-20 00:20:19 +0000 Fix off-by-one error in KASSERT from 02f26e98c7f4. --- sys/netinet/tcp_hostcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 25190697bdee..baefa55fd076 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -470,7 +470,7 @@ tcp_hc_insert(struct in_conninfo *inc) */ TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length++; - KASSERT(V_tcp_hostcache.hashbase[hash].hch_length < + KASSERT(V_tcp_hostcache.hashbase[hash].hch_length <= V_tcp_hostcache.bucket_limit, ("tcp_hostcache: bucket length too high at %u: %u", hash, V_tcp_hostcache.hashbase[hash].hch_length)); From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:46:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9978D5DCB2F; Tue, 20 Apr 2021 00:46:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPQ4M3zHrz3J8D; Tue, 20 Apr 2021 00:46:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7725A1138; Tue, 20 Apr 2021 00:46: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 13K0kx6d036842; Tue, 20 Apr 2021 00:46:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0kxqY036841; Tue, 20 Apr 2021 00:46:59 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:46:59 GMT Message-Id: <202104200046.13K0kxqY036841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: ba1182e26376 - main - bsd.compiler.mk: detect Apple Clang for cross-builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba1182e26376987fe424707b2abc4d6532b28623 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:46:59 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ba1182e26376987fe424707b2abc4d6532b28623 commit ba1182e26376987fe424707b2abc4d6532b28623 Author: Alex Richardson AuthorDate: 2021-04-20 00:46:36 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:36 +0000 bsd.compiler.mk: detect Apple Clang for cross-builds Apple clang uses a different versioning scheme, so if we enable or disable certain warnings for Clang 11+, those might not be supported in Apple Clang 11+. This adds 'apple-clang' to COMPILER_FEATURES, so that bootstrap tools Makefiles can avoid warnings on macOS. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D29680 --- share/mk/bsd.compiler.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 0d8f02489f00..97198f70d5b6 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -26,6 +26,12 @@ # mitigation. # - init-all: supports stack variable initialization. # +# When bootstrapping on macOS, 'apple-clang' will be set in COMPILER_FEATURES +# to differentiate Apple's version of Clang. Apple Clang uses a different +# versioning scheme and may not support the same -W/-Wno warning flags. For a +# mapping of Apple Clang versions to upstream clang versions see +# https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_12.x_(since_Free_On-Device_Development) +# # These variables with an X_ prefix will also be provided if XCC is set. # # This file may be included multiple times, but only has effect the first time. @@ -202,6 +208,10 @@ ${X_}COMPILER_TYPE:= gcc .if !defined(${X_}COMPILER_VERSION) ${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif +# Detect apple clang when bootstrapping to select appropriate warning flags. +.if !defined(${X_}COMPILER_FEATURES) && ${_v:[*]:M*Apple clang version*} +${X_}COMPILER_FEATURES= apple-clang +.endif .undef _v .endif .if !defined(${X_}COMPILER_FREEBSD_VERSION) @@ -218,7 +228,7 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown ${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 2>/dev/null || echo unknown .endif -${X_}COMPILER_FEATURES= c++11 c++14 +${X_}COMPILER_FEATURES+= c++11 c++14 .if ${${X_}COMPILER_TYPE} == "clang" || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 70000) ${X_}COMPILER_FEATURES+= c++17 From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:47:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB0845DC768; Tue, 20 Apr 2021 00:47: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 4FPQ4N4dN8z3J8G; Tue, 20 Apr 2021 00:47:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B9A01139; Tue, 20 Apr 2021 00:47: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 13K0l0lU036863; Tue, 20 Apr 2021 00:47:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0l0Fa036862; Tue, 20 Apr 2021 00:47:00 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:47:00 GMT Message-Id: <202104200047.13K0l0Fa036862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: bbd421cdf6d8 - main - contrib/flex: Drop local __dead2 patch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbd421cdf6d8c6102e6fd3979c5bec21ace3c2e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:47:00 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=bbd421cdf6d8c6102e6fd3979c5bec21ace3c2e3 commit bbd421cdf6d8c6102e6fd3979c5bec21ace3c2e3 Author: Alex Richardson AuthorDate: 2021-04-19 23:05:30 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:42 +0000 contrib/flex: Drop local __dead2 patch Upstream flex has added a yynoreturn, so this diff is no longer needed. Partially reverts r181269. Also regenerate the pre-generated files that are used for bootstrapping. Reviewed By: jkim Differential Revision: https://reviews.freebsd.org/D29679 --- contrib/flex/src/flex.skl | 8 +- tools/build/bootstrap-m4/inittokenizer.c | 414 ++++++++++++++++--------------- usr.bin/lex/initscan.c | 16 +- usr.bin/lex/initskel.c | 8 +- 4 files changed, 226 insertions(+), 220 deletions(-) diff --git a/contrib/flex/src/flex.skl b/contrib/flex/src/flex.skl index c23b944ea473..304e664e4c62 100644 --- a/contrib/flex/src/flex.skl +++ b/contrib/flex/src/flex.skl @@ -216,12 +216,6 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], /* First, we deal with platform-specific or compiler-specific issues. */ -#if defined(__FreeBSD__) -#include -#else -#define __dead2 -#endif - /* begin standard C headers. */ %if-c-only #include @@ -653,7 +647,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG); static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG ); -static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ) __dead2; +static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ); ]]) %endif diff --git a/tools/build/bootstrap-m4/inittokenizer.c b/tools/build/bootstrap-m4/inittokenizer.c index 0c07f1ec2275..a014012ad756 100644 --- a/tools/build/bootstrap-m4/inittokenizer.c +++ b/tools/build/bootstrap-m4/inittokenizer.c @@ -1,4 +1,6 @@ +#line 1 "tokenizer.c" +#line 3 "tokenizer.c" #define YY_INT_ALIGNED short int @@ -6,24 +8,14 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ -#if defined(__FreeBSD__) -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS -#endif -#include -#include -#else -#define __dead2 -#endif - /* begin standard C headers. */ #include #include @@ -93,65 +85,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -168,15 +156,16 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; +extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -191,7 +180,6 @@ extern FILE *yyin, *yyout; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -206,12 +194,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -234,7 +222,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -262,7 +250,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -274,7 +262,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) #define yy_current_buffer YY_CURRENT_BUFFER - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -282,11 +269,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -295,85 +282,81 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); #define yy_new_buffer yy_create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define yywrap() 1 +#define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; - int yylineno = 1; extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ) __dead2; +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 14 #define YY_END_OF_BUFFER 15 /* This struct is not used in this scanner, @@ -383,7 +366,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[35] = +static const flex_int16_t yy_accept[35] = { 0, 0, 0, 15, 13, 1, 1, 13, 13, 13, 2, 2, 13, 13, 13, 13, 1, 9, 10, 12, 2, @@ -391,7 +374,7 @@ static yyconst flex_int16_t yy_accept[35] = 2, 0, 3, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -423,13 +406,13 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[19] = +static const YY_CHAR yy_meta[19] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 3, 4, 4, 4, 1 } ; -static yyconst flex_int16_t yy_base[39] = +static const flex_int16_t yy_base[39] = { 0, 0, 0, 48, 49, 17, 19, 35, 41, 39, 16, 0, 14, 32, 15, 25, 27, 49, 49, 49, 27, @@ -437,7 +420,7 @@ static yyconst flex_int16_t yy_base[39] = 0, 0, 0, 49, 39, 29, 34, 36 } ; -static yyconst flex_int16_t yy_def[39] = +static const flex_int16_t yy_def[39] = { 0, 34, 1, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, @@ -445,7 +428,7 @@ static yyconst flex_int16_t yy_def[39] = 37, 38, 38, 0, 34, 34, 34, 34 } ; -static yyconst flex_int16_t yy_nxt[68] = +static const flex_int16_t yy_nxt[68] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 11, 4, 12, 13, 14, 4, 4, 4, 4, 15, 16, 16, @@ -456,7 +439,7 @@ static yyconst flex_int16_t yy_nxt[68] = 34, 34, 34, 34, 34, 34, 34 } ; -static yyconst flex_int16_t yy_chk[68] = +static const flex_int16_t yy_chk[68] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, @@ -481,7 +464,9 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; +#line 1 "tokenizer.l" #define YY_NO_INPUT 1 +#line 3 "tokenizer.l" /* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ /* * Copyright (c) 2004 Marc Espie @@ -516,6 +501,8 @@ int32_t parse_radix(void); extern int yylex(void); #define YY_DECL int yylex(void) +#line 504 "tokenizer.c" +#line 505 "tokenizer.c" #define INITIAL 0 @@ -531,36 +518,36 @@ extern int yylex(void); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (void ); +int yylex_destroy ( void ); -int yyget_debug (void ); +int yyget_debug ( void ); -void yyset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE yyget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void yyset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *yyget_in (void ); +FILE *yyget_in ( void ); -void yyset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *yyget_out (void ); +FILE *yyget_out ( void ); -void yyset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t yyget_leng (void ); + int yyget_leng ( void ); -char *yyget_text (void ); +char *yyget_text ( void ); -int yyget_lineno (void ); +int yyget_lineno ( void ); -void yyset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -568,33 +555,41 @@ void yyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int yywrap ( void ); #else -extern int yywrap (void ); +extern int yywrap ( void ); +#endif #endif + +#ifndef YY_NO_UNPUT + #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -602,7 +597,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -613,7 +608,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -626,7 +621,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -681,7 +676,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -695,8 +690,6 @@ YY_DECL char *yy_cp, *yy_bp; int yy_act; - - if ( !(yy_init) ) { (yy_init) = 1; @@ -717,13 +710,18 @@ YY_DECL if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - yy_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 48 "tokenizer.l" + +#line 722 "tokenizer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -749,9 +747,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 49 ); @@ -781,14 +779,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP +#line 49 "tokenizer.l" {/* just skip it */} YY_BREAK case 2: YY_RULE_SETUP +#line 50 "tokenizer.l" { yylval = number(); return(NUMBER); } YY_BREAK case 3: YY_RULE_SETUP +#line 51 "tokenizer.l" { if (mimic_gnu) { yylval = parse_radix(); return(NUMBER); } else { @@ -798,48 +799,60 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP +#line 57 "tokenizer.l" { return(LE); } YY_BREAK case 5: YY_RULE_SETUP +#line 58 "tokenizer.l" { return(GE); } YY_BREAK case 6: YY_RULE_SETUP +#line 59 "tokenizer.l" { return(LSHIFT); } YY_BREAK case 7: YY_RULE_SETUP +#line 60 "tokenizer.l" { return(RSHIFT); } YY_BREAK case 8: YY_RULE_SETUP +#line 61 "tokenizer.l" { return(EQ); } YY_BREAK case 9: YY_RULE_SETUP +#line 62 "tokenizer.l" { return(NE); } YY_BREAK case 10: YY_RULE_SETUP +#line 63 "tokenizer.l" { return(LAND); } YY_BREAK case 11: YY_RULE_SETUP +#line 64 "tokenizer.l" { return(LOR); } YY_BREAK case 12: YY_RULE_SETUP +#line 65 "tokenizer.l" { if (mimic_gnu) { return (EXPONENT); } } YY_BREAK case 13: YY_RULE_SETUP +#line 66 "tokenizer.l" { return yytext[0]; } YY_BREAK case 14: YY_RULE_SETUP +#line 67 "tokenizer.l" ECHO; YY_BREAK +#line 855 "tokenizer.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -917,7 +930,7 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -970,6 +983,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1012,7 +1026,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1025,7 +1039,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1039,7 +1053,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1048,11 +1062,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1080,7 +1095,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); + yyrestart( yyin ); } else @@ -1094,12 +1109,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1132,9 +1150,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1160,14 +1178,18 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 34); return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1192,7 +1214,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1209,14 +1231,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart(yyin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1253,11 +1275,11 @@ static int yy_get_next_buffer (void) if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -1285,7 +1307,7 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag @@ -1313,7 +1335,7 @@ static void yy_load_buffer_state (void) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1322,13 +1344,13 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } @@ -1347,9 +1369,9 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - yyfree((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. @@ -1361,7 +1383,7 @@ static void yy_load_buffer_state (void) { int oerrno = errno; - yy_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1404,7 +1426,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1435,7 +1457,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1454,7 +1476,7 @@ void yypop_buffer_state (void) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1472,15 +1494,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1489,7 +1511,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc *** 331 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:47:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11F0F5DC769; Tue, 20 Apr 2021 00:47: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 4FPQ4P6MfXz3JSq; Tue, 20 Apr 2021 00:47:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B385E1382; Tue, 20 Apr 2021 00:47: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 13K0l1Gp036884; Tue, 20 Apr 2021 00:47:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0l10T036883; Tue, 20 Apr 2021 00:47:01 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:47:01 GMT Message-Id: <202104200047.13K0l10T036883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 0b4ad01d91a3 - main - libc/string/bcopy.c: Use intptr_t as the copy type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b4ad01d91a3b24cea00d54d25beed0f487c0183 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:47:02 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0b4ad01d91a3b24cea00d54d25beed0f487c0183 commit 0b4ad01d91a3b24cea00d54d25beed0f487c0183 Author: Alex Richardson AuthorDate: 2021-04-19 23:15:57 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:42 +0000 libc/string/bcopy.c: Use intptr_t as the copy type While most 64-bit architectures have an assembly implementation of this file RISC-V does not. As we now copy 8 bytes instead of 4 it should speed up RISC-V. Using intptr_t instead of int also allows using this file for CHERI pure-capability code since trying to copy pointers using integer loads/stores will invalidate pointers. Reviewed By: kib Obtained from: CheriBSD (partially) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29535 --- lib/libc/string/bcopy.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c index 141416d0afec..84715d0432e3 100644 --- a/lib/libc/string/bcopy.c +++ b/lib/libc/string/bcopy.c @@ -40,11 +40,7 @@ __FBSDID("$FreeBSD$"); #include -/* - * sizeof(word) MUST BE A POWER OF TWO - * SO THAT wmask BELOW IS ALL ONES - */ -typedef int word; /* "word" used for optimal copy speed */ +typedef intptr_t word; /* "word" used for optimal copy speed */ #define wsize sizeof(word) #define wmask (wsize - 1) @@ -105,7 +101,8 @@ bcopy(const void *src0, void *dst0, size_t length) * Copy whole words, then mop up any trailing bytes. */ t = length / wsize; - TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + TLOOP(*(word *)(void *)dst = *(const word *)(const void *)src; + src += wsize; dst += wsize); t = length & wmask; TLOOP(*dst++ = *src++); } else { @@ -126,7 +123,8 @@ bcopy(const void *src0, void *dst0, size_t length) TLOOP1(*--dst = *--src); } t = length / wsize; - TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + TLOOP(src -= wsize; dst -= wsize; + *(word *)(void *)dst = *(const word *)(const void *)src); t = length & wmask; TLOOP(*--dst = *--src); } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:47:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B6465DCB45; Tue, 20 Apr 2021 00:47: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 4FPQ4S0TX1z3J8S; Tue, 20 Apr 2021 00:47:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5900113A; Tue, 20 Apr 2021 00:47: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 13K0l30l036929; Tue, 20 Apr 2021 00:47:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0l3ij036928; Tue, 20 Apr 2021 00:47:03 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:47:03 GMT Message-Id: <202104200047.13K0l3ij036928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 1ad83445fc0f - main - Allow lib/msun/logarithm_test to pass on ld128 platforms MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ad83445fc0f1d2aecd32635f4ae713a057aa091 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:47:04 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad83445fc0f1d2aecd32635f4ae713a057aa091 commit 1ad83445fc0f1d2aecd32635f4ae713a057aa091 Author: Alex Richardson AuthorDate: 2021-04-19 23:22:45 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:43 +0000 Allow lib/msun/logarithm_test to pass on ld128 platforms For some reason the ld128 log1pl() implementation is less accurate than logl(), but does at least guarantee precision >= the ld80 implementation. Mark log1p_accuracy_tests as XFAIL for ld128 and increase the log1p tolerance to the ld80 equivalent in accuracy_tests to avoid losing test coverage for the other functions. PR: 253984 Reviewed By: ngie, dim Differential Revision: https://reviews.freebsd.org/D29039 --- lib/msun/tests/logarithm_test.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/msun/tests/logarithm_test.c b/lib/msun/tests/logarithm_test.c index 48a368765b71..e372e889cb82 100644 --- a/lib/msun/tests/logarithm_test.c +++ b/lib/msun/tests/logarithm_test.c @@ -212,6 +212,17 @@ ATF_TC_BODY(accuracy_tests, tc) }; unsigned i; + long double log1p_ldbl_ulp = LDBL_ULP(); +#if LDBL_MANT_DIG > 64 + /* + * On ld128 platforms the log1p() implementation provides less accuracy, + * but does still match the ld80 precision. Use the ld80 LDBL_ULP() + * value for now to avoid losing test coverage for the other functions. + * Reported as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253984 + */ + log1p_ldbl_ulp = ldexpl(1.0, 1 - 64); +#endif + for (i = 0; i < nitems(tests); i++) { test_tol(log2, tests[i].x, tests[i].log2x, DBL_ULP()); test_tol(log2f, tests[i].x, tests[i].log2x, FLT_ULP()); @@ -228,7 +239,7 @@ ATF_TC_BODY(accuracy_tests, tc) test_tol(log1pf, tests[i].x - 1, tests[i].logex, FLT_ULP()); test_tol(log1pl, tests[i].x - 1, tests[i].logex, - LDBL_ULP()); + log1p_ldbl_ulp); } } } @@ -236,6 +247,11 @@ ATF_TC_BODY(accuracy_tests, tc) ATF_TC_WITHOUT_HEAD(log1p_accuracy_tests); ATF_TC_BODY(log1p_accuracy_tests, tc) { +#if LDBL_MANT_DIG > 64 + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_expect_fail("https://bugs.freebsd.org/253984"); +#endif + test_tol(log1pf, 0x0.333333p0F, 1.82321546859847114303367992804596800640e-1L, FLT_ULP()); test_tol(log1p, 0x0.3333333333333p0, From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:47:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6700B5DCAF8; Tue, 20 Apr 2021 00:47: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 4FPQ4R29BHz3JHw; Tue, 20 Apr 2021 00:47:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8D1D1383; Tue, 20 Apr 2021 00:47: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 13K0l2lc036905; Tue, 20 Apr 2021 00:47:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0l22f036904; Tue, 20 Apr 2021 00:47:02 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:47:02 GMT Message-Id: <202104200047.13K0l22f036904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: ab147542b7c0 - main - libc/string/memset.c: Use unsigned long for stores MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab147542b7c0bbc41f7f0499b16933bd8f3f31d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:47:03 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ab147542b7c0bbc41f7f0499b16933bd8f3f31d7 commit ab147542b7c0bbc41f7f0499b16933bd8f3f31d7 Author: Alex Richardson AuthorDate: 2021-04-19 23:19:20 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:43 +0000 libc/string/memset.c: Use unsigned long for stores While most 64-bit architectures have an assembly implementation of this file, RISC-V does not. As we now store 8 bytes instead of 4 it should speed up RISC-V. Reviewed By: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29536 --- lib/libc/string/memset.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c index 7d9909a76083..e2d4027eea0c 100644 --- a/lib/libc/string/memset.c +++ b/lib/libc/string/memset.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include -#define wsize sizeof(u_int) +#define wsize sizeof(u_long) #define wmask (wsize - 1) #ifdef BZERO @@ -67,7 +67,7 @@ memset(void *dst0, int c0, size_t length) { size_t t; #ifndef BZERO - u_int c; + u_long c; #endif u_char *dst; @@ -84,6 +84,9 @@ memset(void *dst0, int c0, size_t length) * * but we use a minimum of 3 here since the overhead of the code * to do word writes is substantial. + * + * TODO: This threshold might not be sensible for 64-bit u_long. + * We should benchmark and revisit this decision. */ if (length < 3 * wsize) { while (length != 0) { @@ -95,12 +98,12 @@ memset(void *dst0, int c0, size_t length) #ifndef BZERO if ((c = (u_char)c0) != 0) { /* Fill the word. */ - c = (c << 8) | c; /* u_int is 16 bits. */ -#if UINT_MAX > 0xffff - c = (c << 16) | c; /* u_int is 32 bits. */ + c = (c << 8) | c; /* u_long is 16 bits. */ +#if ULONG_MAX > 0xffff + c = (c << 16) | c; /* u_long is 32 bits. */ #endif -#if UINT_MAX > 0xffffffff - c = (c << 32) | c; /* u_int is 64 bits. */ +#if ULONG_MAX > 0xffffffff + c = (c << 32) | c; /* u_long is 64 bits. */ #endif } #endif @@ -116,7 +119,7 @@ memset(void *dst0, int c0, size_t length) /* Fill words. Length was >= 2*words so we know t >= 1 here. */ t = length / wsize; do { - *(u_int *)dst = WIDEVAL; + *(u_long *)(void *)dst = WIDEVAL; dst += wsize; } while (--t != 0); From owner-dev-commits-src-main@freebsd.org Tue Apr 20 00:57:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FBA35DD4C6; Tue, 20 Apr 2021 00:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPQJj00C3z3KG8; Tue, 20 Apr 2021 00:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC2F212B4; Tue, 20 Apr 2021 00:57: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 13K0vepq050213; Tue, 20 Apr 2021 00:57:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0vedV050212; Tue, 20 Apr 2021 00:57:40 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:57:40 GMT Message-Id: <202104200057.13K0vedV050212@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: 5a89498d1986 - main - nfsd: fix stripe size reply for the File Layout pNFS server 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: 5a89498d19863d0c4cb074f9b93862a70040bf1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:57:41 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5a89498d19863d0c4cb074f9b93862a70040bf1b commit 5a89498d19863d0c4cb074f9b93862a70040bf1b Author: Rick Macklem AuthorDate: 2021-04-20 00:51:07 +0000 Commit: Rick Macklem CommitDate: 2021-04-20 00:54:54 +0000 nfsd: fix stripe size reply for the File Layout pNFS server At a recent testing event I found out that I had misinterpreted RFC5661 where it describes the stripe size in the File Layout's nfl_util field. This patch fixes the pNFS File Layout server so that it returns the correct value to the NFSv4.1/4.2 pNFS enabled client. This affects almost no one, since pNFS server configurations are rare and the extant pNFS aware NFS clients seemed to function correctly despite the erroneous stripe size. It *might* be needed for correct behaviour if a recent Linux client mounts a FreeBSD pNFS server configuration that is using File Layout (non-mirrored configuration). MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdstate.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index fa7bb3ba9f56..60647ab288d8 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6873,14 +6873,8 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, NFSBCOPY(devid, tl, NFSX_V4DEVICEID); /* Device ID. */ tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); - /* - * Make the stripe size as many 64K blocks as will fit in the stripe - * mask. Since there is only one stripe, the stripe size doesn't really - * matter, except that the Linux client will only handle an exact - * multiple of their PAGE_SIZE (usually 4K). I chose 64K as a value - * that should cover most/all arches w.r.t. PAGE_SIZE. - */ - *tl++ = txdr_unsigned(NFSFLAYUTIL_STRIPE_MASK & ~0xffff); + /* Set the stripe size to the maximum I/O size. */ + *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ From owner-dev-commits-src-main@freebsd.org Tue Apr 20 01:56:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 753BE5DF5B2; Tue, 20 Apr 2021 01:56: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 4FPRd52xy6z3MpW; Tue, 20 Apr 2021 01:56:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57D9E21E9; Tue, 20 Apr 2021 01:56:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13K1uvNX029407; Tue, 20 Apr 2021 01:56:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K1uvbI029406; Tue, 20 Apr 2021 01:56:57 GMT (envelope-from git) Date: Tue, 20 Apr 2021 01:56:57 GMT Message-Id: <202104200156.13K1uvbI029406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 32231805fbe2 - main - linker_set: fix globl/weak symbol redefinitions to work on clang 12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32231805fbe2b9438c2de50c229b43c016207a08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 01:56:57 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=32231805fbe2b9438c2de50c229b43c016207a08 commit 32231805fbe2b9438c2de50c229b43c016207a08 Author: Greg V AuthorDate: 2021-04-20 00:47:15 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 01:56:24 +0000 linker_set: fix globl/weak symbol redefinitions to work on clang 12 In clang 12.0.0.rc2, going from weak to global is now a hard error: ``` /usr/src/stand/libsa/amd64/_setjmp.S:67:25: error: _longjmp changed binding to STB_GLOBAL .text; .p2align 4,0x90; .globl _longjmp; .type _longjmp,@function; _longjmp:; .cfi_startproc ``` And the other way is a warning, but we have -Werror: ``` error: __start_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm] error: __stop_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm] ``` ref: https://reviews.llvm.org/D90108 Reviewed By: arichardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29159 --- sys/sys/cdefs.h | 4 ++-- sys/sys/linker_set.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 1d1fe2965c69..ff461db9ec2e 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -563,8 +563,8 @@ #endif /* __STDC__ */ #endif /* __GNUC__ */ -#define __GLOBL1(sym) __asm__(".globl " #sym) -#define __GLOBL(sym) __GLOBL1(sym) +#define __GLOBL(sym) __asm__(".globl " __XSTRING(sym)) +#define __WEAK(sym) __asm__(".weak " __XSTRING(sym)) #if defined(__GNUC__) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index 6169a3499dad..f957858ada04 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -60,8 +60,8 @@ */ #ifdef __GNUCLIKE___SECTION #define __MAKE_SET_QV(set, sym, qv) \ - __GLOBL(__CONCAT(__start_set_,set)); \ - __GLOBL(__CONCAT(__stop_set_,set)); \ + __WEAK(__CONCAT(__start_set_,set)); \ + __WEAK(__CONCAT(__stop_set_,set)); \ static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ __nosanitizeaddress \ From owner-dev-commits-src-main@freebsd.org Tue Apr 20 03:12:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B95F35E1CC9; Tue, 20 Apr 2021 03:12: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 4FPTJf4tptz3h1h; Tue, 20 Apr 2021 03:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A9EC328B; Tue, 20 Apr 2021 03:12: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 13K3Coav036329; Tue, 20 Apr 2021 03:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K3CooK036328; Tue, 20 Apr 2021 03:12:50 GMT (envelope-from git) Date: Tue, 20 Apr 2021 03:12:50 GMT Message-Id: <202104200312.13K3CooK036328@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: 78ffcb86d98f - main - nfscommon: fix function name in comment 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: 78ffcb86d98fc9c27ac7a723c65621667036c42d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 03:12:50 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=78ffcb86d98fc9c27ac7a723c65621667036c42d commit 78ffcb86d98fc9c27ac7a723c65621667036c42d Author: Rick Macklem AuthorDate: 2021-04-20 03:09:46 +0000 Commit: Rick Macklem CommitDate: 2021-04-20 03:09:46 +0000 nfscommon: fix function name in comment MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 4afa4c2d9ab4..a30ee458e06c 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4614,7 +4614,7 @@ nfsmout: * Handle an NFSv4.1 Sequence request for the session. * If reply != NULL, use it to return the cached reply, as required. * The client gets a cached reply via this call for callbacks, however the - * server gets a cached reply via the nfsv4_seqsess_cachereply() call. + * server gets a cached reply via the nfsv4_seqsess_cacherep() call. */ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, From owner-dev-commits-src-main@freebsd.org Tue Apr 20 06:56:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 633025E7078; Tue, 20 Apr 2021 06:56:40 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPZGw0YBgz3rdk; Tue, 20 Apr 2021 06:56:38 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 13K6uZQw069495; Mon, 19 Apr 2021 23:56:35 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 13K6uZPZ069494; Mon, 19 Apr 2021 23:56:35 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202104200656.13K6uZPZ069494@gndrsh.dnsmgr.net> Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files In-Reply-To: <202104191829.13JITv1A033527@gitrepo.freebsd.org> To: Jung-uk Kim Date: Mon, 19 Apr 2021 23:56:35 -0700 (PDT) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FPZGw0YBgz3rdk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 06:56:40 -0000 > The branch main has been updated by jkim: > > URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > > commit 686cf5468c4a85c2a6385cdbab2383900876a41d > Author: Jung-uk Kim > AuthorDate: 2021-04-19 18:20:51 +0000 > Commit: Jung-uk Kim > CommitDate: 2021-04-19 18:20:51 +0000 > > flex: Regen bootstrap files > > This also partially reverts r326025 (8a16b7a18f5d). I do not see any > point of adding SPDX tag in generated file. The SPDX identifies the copyright that follows it, so please put this back. > > MFC after: 3 days > Submitted by: Dan McGregor (initial version) > Differential Revision: https://reviews.freebsd.org/D28596 > --- > usr.bin/lex/initparse.c | 17 ++++++++++------- > usr.bin/lex/initparse.h | 1 - > usr.bin/lex/initscan.c | 5 ++++- > usr.bin/lex/initskel.c | 9 ++++----- > 4 files changed, 18 insertions(+), 14 deletions(-) > > diff --git a/usr.bin/lex/initparse.c b/usr.bin/lex/initparse.c > index c723c5b45c40..c95305aa1a91 100644 > --- a/usr.bin/lex/initparse.c > +++ b/usr.bin/lex/initparse.c > @@ -1,4 +1,3 @@ > -/* $FreeBSD$ */ > /* original parser id follows */ > /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ > /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ > @@ -6,7 +5,7 @@ > #define YYBYACC 1 > #define YYMAJOR 1 > #define YYMINOR 9 > -#define YYPATCH 20170430 > +#define YYPATCH 20200330 > > #define YYEMPTY (-1) > #define yyclearin (yychar = YYEMPTY) > @@ -19,8 +18,6 @@ > #define YYPURE 0 > > #line 35 "parse.y" > -/* SPDX-License-Identifier: BSD-2-Clause */ > - > /* Copyright (c) 1990 The Regents of the University of California. */ > /* All rights reserved. */ > > @@ -130,6 +127,10 @@ typedef int YYSTYPE; > # define YYLEX yylex() > #endif > > +#if !(defined(yylex) || defined(YYSTATE)) > +int YYLEX_DECL(); > +#endif > + > /* Parameters sent to yyerror. */ > #ifndef YYERROR_DECL > #define YYERROR_DECL() yyerror(const char *s) > @@ -488,13 +489,15 @@ static const char *const yyrule[] = { > }; > #endif > > +#if YYDEBUG > int yydebug; > -int yynerrs; > +#endif > > int yyerrflag; > int yychar; > YYSTYPE yyval; > YYSTYPE yylval; > +int yynerrs; > > /* define the initial stack-sizes */ > #ifdef YYSTACKSIZE > @@ -655,7 +658,7 @@ void yyerror( const char *msg ) > { > (void)msg; > } > -#line 656 "parse.c" > +#line 662 "parse.c" > > #if YYDEBUG > #include /* needed for printf */ > @@ -1781,7 +1784,7 @@ case 96: > #line 946 "parse.y" > { yyval = mkstate( SYM_EPSILON ); } > break; > -#line 1782 "parse.c" > +#line 1788 "parse.c" > } > yystack.s_mark -= yym; > yystate = *yystack.s_mark; > diff --git a/usr.bin/lex/initparse.h b/usr.bin/lex/initparse.h > index fb0742445d55..b630d282c635 100644 > --- a/usr.bin/lex/initparse.h > +++ b/usr.bin/lex/initparse.h > @@ -1,4 +1,3 @@ > -/* $FreeBSD$ */ > #define CHAR 257 > #define NUMBER 258 > #define SECTEND 259 > diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c > index 46070a4c6dc5..9b6fb4ae5183 100644 > --- a/usr.bin/lex/initscan.c > +++ b/usr.bin/lex/initscan.c > @@ -1,4 +1,3 @@ > -/* $FreeBSD$ */ > > #line 2 "" > > @@ -4578,7 +4577,11 @@ static int yy_get_next_buffer (void) > case EOB_ACT_END_OF_FILE: > { > if ( yywrap( ) ) > +#ifdef YY_FLEX_LEX_COMPAT > return 0; > +#else > + return EOF; > +#endif > > if ( ! (yy_did_buffer_switch_on_eof) ) > YY_NEW_FILE; > diff --git a/usr.bin/lex/initskel.c b/usr.bin/lex/initskel.c > index a7a69875521d..53a0ae452aa8 100644 > --- a/usr.bin/lex/initskel.c > +++ b/usr.bin/lex/initskel.c > @@ -1,4 +1,3 @@ > -/* $FreeBSD$ */ > /* File created from flex.skl via mkskel.sh */ > > #include "flexdef.h" > @@ -448,11 +447,7 @@ const char *skel[] = { > "/* First, we deal with platform-specific or compiler-specific issues. */", > "", > "#if defined(__FreeBSD__)", > - "#ifndef __STDC_LIMIT_MACROS", > - "#define __STDC_LIMIT_MACROS", > - "#endif", > "#include ", > - "#include ", > "#else", > "#define __dead2", > "#endif", > @@ -2301,7 +2296,11 @@ const char *skel[] = { > " case EOB_ACT_END_OF_FILE:", > " {", > " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )", > + "#ifdef YY_FLEX_LEX_COMPAT", > " return 0;", > + "#else", > + " return EOF;", > + "#endif", > "", > " if ( ! YY_G(yy_did_buffer_switch_on_eof) )", > " YY_NEW_FILE;", > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Tue Apr 20 08:25:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3C025EB4F7; Tue, 20 Apr 2021 08:25: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 4FPcFL4m0Vz4Rcf; Tue, 20 Apr 2021 08:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 961AD7421; Tue, 20 Apr 2021 08:25: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 13K8PQ4L045500; Tue, 20 Apr 2021 08:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K8PQ72045499; Tue, 20 Apr 2021 08:25:26 GMT (envelope-from git) Date: Tue, 20 Apr 2021 08:25:26 GMT Message-Id: <202104200825.13K8PQ72045499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: ca904beafd92 - main - fork.2: Fix a typo in an example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca904beafd925719af998a86cd67a9c787f44255 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 08:25:26 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ca904beafd925719af998a86cd67a9c787f44255 commit ca904beafd925719af998a86cd67a9c787f44255 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-20 08:24:21 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-20 08:24:21 +0000 fork.2: Fix a typo in an example Reported by: rpokala MFC with: c4207d867c201a726aa3157e09262f72166c89c4 --- lib/libc/sys/fork.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index d43ade6a483e..9ea0a6afb96f 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -28,7 +28,7 @@ .\" @(#)fork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 17, 2021 +.Dd April 20, 2021 .Dt FORK 2 .Os .Sh NAME @@ -132,7 +132,7 @@ main(void) .Pp The output of such a program is along the lines of: .Bd -literal -offset indent -Hello from parent (child's PID: 27804)! +Hello from parent process (child's PID: 27804)! Hello from child process! .Ed .Sh ERRORS From owner-dev-commits-src-main@freebsd.org Tue Apr 20 08:38:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA0E75EBB37; Tue, 20 Apr 2021 08:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPcXt5L9Qz4SK1; Tue, 20 Apr 2021 08:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA6767962; Tue, 20 Apr 2021 08:38: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 13K8csPs059417; Tue, 20 Apr 2021 08:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K8csEH059416; Tue, 20 Apr 2021 08:38:54 GMT (envelope-from git) Date: Tue, 20 Apr 2021 08:38:54 GMT Message-Id: <202104200838.13K8csEH059416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: ef0ba6bccef3 - main - c.7: Fix some typos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef0ba6bccef34f414f54760747b54ee9ec2f6786 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 08:38:54 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ef0ba6bccef34f414f54760747b54ee9ec2f6786 commit ef0ba6bccef34f414f54760747b54ee9ec2f6786 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-20 08:33:34 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-20 08:33:34 +0000 c.7: Fix some typos Those misspellings were not picked up by igor because they are not present in its list of common spelling errors. Reported by: rpokala --- share/man/man7/c.7 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/c.7 b/share/man/man7/c.7 index c9f7fc3c93b3..f8943cd9ca29 100644 --- a/share/man/man7/c.7 +++ b/share/man/man7/c.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2021 +.Dd April 20, 2021 .Dt C 7 .Os .Sh NAME @@ -181,7 +181,7 @@ additional strftime conversion specifiers .El .Pp Later in 2011, the third edition of the standard, ISO/IEC 1989:2011, -commonly reffered to as C11 (formerly C1x), came out and replaced the +commonly referred to as C11 (formerly C1x), came out and replaced the second edition by ISO/IEC 9899:1999/COR1:2001, ISO/IEC 9899:1999/COR2:2004, and ISO/IEC 9899:1999/COR3:2007. The improvements include (but are not limited to) the following: @@ -213,7 +213,7 @@ It incorporates the Technical Corrigendum 1 (ISO/IEC 9899:2011/COR1:2012) which was published in 2012. It addressed defects and deficiencies in C11 without introducing new features, only corrections and clarifications. -Since there were no major changes in C17, the current standrad for +Since there were no major changes in C17, the current standard for Programming Language C, is still considered C11 \(em ISO/IEC 9899:2011, published 2011-12-08. .Pp From owner-dev-commits-src-main@freebsd.org Tue Apr 20 08:51:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E7515EC3BC; Tue, 20 Apr 2021 08:51: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 4FPcql2gygz4T0K; Tue, 20 Apr 2021 08:51:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F56F75CD; Tue, 20 Apr 2021 08:51: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 13K8plMH080945; Tue, 20 Apr 2021 08:51:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K8plLl080931; Tue, 20 Apr 2021 08:51:47 GMT (envelope-from git) Date: Tue, 20 Apr 2021 08:51:47 GMT Message-Id: <202104200851.13K8plLl080931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 6bc0bb2936a4 - main - Enable GitHub actions CI for stable/13 as well MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6bc0bb2936a41674bc992887ba17fddfa928ac90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 08:51:47 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6bc0bb2936a41674bc992887ba17fddfa928ac90 commit 6bc0bb2936a41674bc992887ba17fddfa928ac90 Author: Alex Richardson AuthorDate: 2021-04-20 08:50:36 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 08:51:33 +0000 Enable GitHub actions CI for stable/13 as well All cross-building patches have been merged to stable/13 so it should also build fine on macOS+Linux. Reviewed By: uqs MFC after: immediately Differential Revision: https://reviews.freebsd.org/D29831 --- .github/workflows/cross-bootstrap-tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index 65db86de3a97..f002cb0fbbe2 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -2,7 +2,7 @@ name: Cross-build Kernel on: push: - branches: [ main ] + branches: [ main, 'stable/13' ] pull_request: branches: [ main ] From owner-dev-commits-src-main@freebsd.org Tue Apr 20 09:22:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A081E5ED916; Tue, 20 Apr 2021 09:22: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 4FPdVt49zgz4Vmg; Tue, 20 Apr 2021 09:22:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 781611015A; Tue, 20 Apr 2021 09:22: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 13K9ME3o022602; Tue, 20 Apr 2021 09:22:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K9ME2h022601; Tue, 20 Apr 2021 09:22:14 GMT (envelope-from git) Date: Tue, 20 Apr 2021 09:22:14 GMT Message-Id: <202104200922.13K9ME2h022601@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 33f8d79d7652 - main - assert.3: Document static_assert and _Static_assert MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33f8d79d765230e3189876dec9f0dad2d768de1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 09:22:14 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=33f8d79d765230e3189876dec9f0dad2d768de1a commit 33f8d79d765230e3189876dec9f0dad2d768de1a Author: Faraz Vahedi AuthorDate: 2021-04-20 08:50:36 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-04-20 09:17:44 +0000 assert.3: Document static_assert and _Static_assert Reviewed by: imp, 0mp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29833 --- share/man/man3/Makefile | 1 + share/man/man3/assert.3 | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index d33c0d63ea0d..ea82f04c7825 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -72,6 +72,7 @@ MLINKS= arb.3 ARB8_ENTRY.3 \ arb.3 ARB_RIGHT.3 \ arb.3 ARB_RIGHTIDX.3 \ arb.3 ARB_ROOT.3 +MLINKS+= assert.3 static_assert.3 MLINKS+= ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong_explicit.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak.3 \ diff --git a/share/man/man3/assert.3 b/share/man/man3/assert.3 index 8bdf076233c8..cc23f96360f0 100644 --- a/share/man/man3/assert.3 +++ b/share/man/man3/assert.3 @@ -28,15 +28,18 @@ .\" @(#)assert.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd May 31, 2018 +.Dd April 20, 2021 .Dt ASSERT 3 .Os .Sh NAME -.Nm assert +.Nm assert , +.Nm static_assert .Nd expression verification macro .Sh SYNOPSIS .In assert.h .Fn assert expression +.Fn static_assert expression +.Fn static_assert expression message .Sh DESCRIPTION The .Fn assert @@ -81,6 +84,21 @@ The macro should only be used for ensuring the developer's expectations hold true. It is not appropriate for regular run-time error detection. +.Pp +The +.Fn static_assert +macro expands to +.Fn _Static_assert , +and, contrarily to +.Fn assert , +makes assertions at compile-time. +Once the constraint is violated, the compiler produces a diagnostic +message including the string literal message, if provided. +The initial form of the +.Fn _Static_assert +containing a string literal message was introduced in C11 standard, and +the other form with no string literal is to be implemented by C2x and +some compilers may lack its adoption at present. .Sh EXAMPLES The assertion: .Dl "assert(1 == 0);" @@ -95,14 +113,29 @@ indicate a bug. Second, the code will disappear if .Dv NDEBUG is defined, changing the semantics of the program. +.Pp +The following asserts that the size of the S structure is 16. +Otherwise, it produces a diagnostic message which points at the +constraint and includes the provided string literal: +.Dl "static_assert(sizeof(struct S) == 16, ""size mismatch"");" +If none is provided, it only points at the constraint. .Sh SEE ALSO .Xr abort2 2 , .Xr abort 3 .Sh STANDARDS +.Rs The .Fn assert macro conforms to .St -isoC-99 . +.Re +.Pp +.Rs +The +.Fn static_assert +macro conforms to +.St -isoC-2011 . +.Re .Sh HISTORY An .Nm From owner-dev-commits-src-main@freebsd.org Tue Apr 20 09:58:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B2ED5EEBBB; Tue, 20 Apr 2021 09:58:45 +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 4FPfJz2cXjz4XSv; Tue, 20 Apr 2021 09:58:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 13K9wXDZ014654 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 20 Apr 2021 12:58:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 13K9wXDZ014654 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 13K9wXHG014653; Tue, 20 Apr 2021 12:58:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Apr 2021 12:58:33 +0300 From: Konstantin Belousov To: Mateusz Piotrowski <0mp@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c4207d867c20 - main - fork.2: Add a simple use pattern Message-ID: References: <202104172113.13HLD6UI014137@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202104172113.13HLD6UI014137@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FPfJz2cXjz4XSv X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.51 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.49)[0.487]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; TO_DN_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RBL_SENDERSCORE_FAIL(0.00)[2001:470:d5e7:1::1:server fail]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 09:58:45 -0000 On Sat, Apr 17, 2021 at 09:13:06PM +0000, Mateusz Piotrowski wrote: > The branch main has been updated by 0mp (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=c4207d867c201a726aa3157e09262f72166c89c4 > > commit c4207d867c201a726aa3157e09262f72166c89c4 > Author: Mateusz Piotrowski <0mp@FreeBSD.org> > AuthorDate: 2021-04-17 21:10:48 +0000 > Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > CommitDate: 2021-04-17 21:12:06 +0000 > > fork.2: Add a simple use pattern > > It seems to be a nice idea to show how fork() is usually used in > practice. This may act as a guide to developers who want to quickly > recall how to use the fork() function. > > Reviewed by: bcr, yuripv > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D27626 > --- > lib/libc/sys/fork.2 | 38 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > > diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 > index 3e55530827c5..d43ade6a483e 100644 > --- a/lib/libc/sys/fork.2 > +++ b/lib/libc/sys/fork.2 > @@ -28,7 +28,7 @@ > .\" @(#)fork.2 8.1 (Berkeley) 6/4/93 > .\" $FreeBSD$ > .\" > -.Dd December 1, 2017 > +.Dd April 17, 2021 > .Dt FORK 2 > .Os > .Sh NAME > @@ -99,6 +99,42 @@ to the parent process, no child process is created, and the global > variable > .Va errno > is set to indicate the error. > +.Sh EXAMPLES > +The following example shows a common pattern of how > +.Fn fork > +is used in practice. > +.Bd -literal -offset indent > +#include > +#include > +#include > +#include > + > +int > +main(void) > +{ > + pid_t pid; > + > + switch (pid = fork()) { > + case -1: > + err(1, "Failed to fork"); > + case 0: > + printf("Hello from child process!\en"); > + exit(0); > + default: > + break; > + } > + > + printf("Hello from parent process (child's PID: %d)!\en", pid); > + > + return (0); > +} > +.Ed > +.Pp > +The output of such a program is along the lines of: > +.Bd -literal -offset indent > +Hello from parent (child's PID: 27804)! > +Hello from child process! > +.Ed > .Sh ERRORS > The > .Fn fork Using printf around fork is not the best idea, and definitely should not be provided as a guiding example in the man page. Using stdio safely around fork() requires at least flushing buffers and ensuring that opened FILEs are in some consistent state right at fork. It would work by chance in your example, mostly because you did not used anything in stdio before fork, but any further changes would result in very puzzling bugs (for beginners, who are the target of this example). From owner-dev-commits-src-main@freebsd.org Tue Apr 20 11:22:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 223575F125B; Tue, 20 Apr 2021 11:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPhBB0Wpdz4cPP; Tue, 20 Apr 2021 11:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04D8811DB1; Tue, 20 Apr 2021 11:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13KBMvOA086447; Tue, 20 Apr 2021 11:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KBMvEk086446; Tue, 20 Apr 2021 11:22:57 GMT (envelope-from git) Date: Tue, 20 Apr 2021 11:22:57 GMT Message-Id: <202104201122.13KBMvEk086446@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: 586aab9e0aa6 - main - pf: Refactor state killing 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: 586aab9e0aa6c811758c19fb03831fc1e7305252 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 11:22:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=586aab9e0aa6c811758c19fb03831fc1e7305252 commit 586aab9e0aa6c811758c19fb03831fc1e7305252 Author: Kristof Provost AuthorDate: 2021-04-16 14:34:21 +0000 Commit: Kristof Provost CommitDate: 2021-04-20 07:30:23 +0000 pf: Refactor state killing Extract the state killing code from pfioctl() and rephrase the filtering conditions for readability. No functional change intended. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29795 --- sys/netpfil/pf/pf_ioctl.c | 122 ++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 54 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 917501163264..6158a6c9b0c6 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2522,6 +2522,72 @@ errout_unlocked: return (error); } +static int +pf_killstates_row(struct pfioc_state_kill *psk, struct pf_idhash *ih) +{ + struct pf_state *s; + struct pf_state_key *sk; + struct pf_addr *srcaddr, *dstaddr; + int killed = 0; + u_int16_t srcport, dstport; + +relock_DIOCKILLSTATES: + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + sk = s->key[PF_SK_WIRE]; + if (s->direction == PF_OUT) { + srcaddr = &sk->addr[1]; + dstaddr = &sk->addr[0]; + srcport = sk->port[1]; + dstport = sk->port[0]; + } else { + srcaddr = &sk->addr[0]; + dstaddr = &sk->addr[1]; + srcport = sk->port[0]; + dstport = sk->port[1]; + } + + if (psk->psk_af && sk->af != psk->psk_af) + continue; + + if (psk->psk_proto && psk->psk_proto != sk->proto) + continue; + + if (! PF_MATCHA(psk->psk_src.neg, &psk->psk_src.addr.v.a.addr, + &psk->psk_src.addr.v.a.mask, srcaddr, sk->af)) + continue; + + if (! PF_MATCHA(psk->psk_dst.neg, &psk->psk_dst.addr.v.a.addr, + &psk->psk_dst.addr.v.a.mask, dstaddr, sk->af)) + continue; + + if (psk->psk_src.port_op != 0 && + ! pf_match_port(psk->psk_src.port_op, + psk->psk_src.port[0], psk->psk_src.port[1], srcport)) + continue; + + if (psk->psk_dst.port_op != 0 && + ! pf_match_port(psk->psk_dst.port_op, + psk->psk_dst.port[0], psk->psk_dst.port[1], dstport)) + continue; + + if (psk->psk_label[0] && (! s->rule.ptr->label[0] || + strcmp(psk->psk_label, s->rule.ptr->label))) + continue; + + if (psk->psk_ifname[0] && strcmp(psk->psk_ifname, + s->kif->pfik_name)) + continue; + + pf_unlink_state(s, PF_ENTER_LOCKED); + killed++; + goto relock_DIOCKILLSTATES; + } + PF_HASHROW_UNLOCK(ih); + + return (killed); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -3218,9 +3284,6 @@ relock_DIOCCLRSTATES: case DIOCKILLSTATES: { struct pf_state *s; - struct pf_state_key *sk; - struct pf_addr *srcaddr, *dstaddr; - u_int16_t srcport, dstport; struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr; u_int i, killed = 0; @@ -3235,58 +3298,9 @@ relock_DIOCCLRSTATES: break; } - for (i = 0; i <= pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; + for (i = 0; i <= pf_hashmask; i++) + killed += pf_killstates_row(psk, &V_pf_idhash[i]); -relock_DIOCKILLSTATES: - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - sk = s->key[PF_SK_WIRE]; - if (s->direction == PF_OUT) { - srcaddr = &sk->addr[1]; - dstaddr = &sk->addr[0]; - srcport = sk->port[1]; - dstport = sk->port[0]; - } else { - srcaddr = &sk->addr[0]; - dstaddr = &sk->addr[1]; - srcport = sk->port[0]; - dstport = sk->port[1]; - } - - if ((!psk->psk_af || sk->af == psk->psk_af) - && (!psk->psk_proto || psk->psk_proto == - sk->proto) && - PF_MATCHA(psk->psk_src.neg, - &psk->psk_src.addr.v.a.addr, - &psk->psk_src.addr.v.a.mask, - srcaddr, sk->af) && - PF_MATCHA(psk->psk_dst.neg, - &psk->psk_dst.addr.v.a.addr, - &psk->psk_dst.addr.v.a.mask, - dstaddr, sk->af) && - (psk->psk_src.port_op == 0 || - pf_match_port(psk->psk_src.port_op, - psk->psk_src.port[0], psk->psk_src.port[1], - srcport)) && - (psk->psk_dst.port_op == 0 || - pf_match_port(psk->psk_dst.port_op, - psk->psk_dst.port[0], psk->psk_dst.port[1], - dstport)) && - (!psk->psk_label[0] || - (s->rule.ptr->label[0] && - !strcmp(psk->psk_label, - s->rule.ptr->label))) && - (!psk->psk_ifname[0] || - !strcmp(psk->psk_ifname, - s->kif->pfik_name))) { - pf_unlink_state(s, PF_ENTER_LOCKED); - killed++; - goto relock_DIOCKILLSTATES; - } - } - PF_HASHROW_UNLOCK(ih); - } psk->psk_killed = killed; break; } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 11:22:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E8A25F171F; Tue, 20 Apr 2021 11:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPhBC0lcNz4c7Q; Tue, 20 Apr 2021 11:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D18712082; Tue, 20 Apr 2021 11:22: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 13KBMwfx086474; Tue, 20 Apr 2021 11:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KBMwMl086473; Tue, 20 Apr 2021 11:22:58 GMT (envelope-from git) Date: Tue, 20 Apr 2021 11:22:58 GMT Message-Id: <202104201122.13KBMwMl086473@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: 065b5c7fb26e - main - pf tests: Test cases for the 'kill state(s)' feature 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: 065b5c7fb26eb4239e9bd513dde5a55ef78e45c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 11:22:59 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=065b5c7fb26eb4239e9bd513dde5a55ef78e45c4 commit 065b5c7fb26eb4239e9bd513dde5a55ef78e45c4 Author: Kristof Provost AuthorDate: 2021-04-16 15:33:17 +0000 Commit: Kristof Provost CommitDate: 2021-04-20 07:30:27 +0000 pf tests: Test cases for the 'kill state(s)' feature MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29796 --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/killstate.sh | 175 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 5cf11da76faf..2478cefbc4a6 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -12,6 +12,7 @@ ATF_TESTS_SH+= altq \ forward \ fragmentation \ icmp \ + killstate \ map_e \ names \ nat \ diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh new file mode 100644 index 000000000000..994ce130a814 --- /dev/null +++ b/tests/sys/netpfil/pf/killstate.sh @@ -0,0 +1,175 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr + +common_dir=$(atf_get_srcdir)/../common + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'Test killing states by IPv4 address' + atf_set require.user root + atf_set require.progs scapy +} + +v4_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "block all" \ + "pass in proto icmp" + + # Sanity check & establish state + # Note: use pft_ping so we always use the same ID, so pf considers all + # echo requests part of the same flow. + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Change rules to now deny the ICMP traffic + pft_set_rules noflush alcatraz "block all" + + # Established state means we can still ping alcatraz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing with the wrong IP doesn't affect our state + jexec alcatraz pfctl -k 192.0.2.3 + + # So we can still ping + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing with one correct address and one incorrect doesn't kill the state + jexec alcatraz pfctl -k 192.0.2.1 -k 192.0.2.3 + + # So we can still ping + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing with correct address does remove the state + jexec alcatraz pfctl -k 192.0.2.1 + + # Now the ping fails + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a +} + +v4_cleanup() +{ + pft_cleanup +} + +atf_test_case "label" "cleanup" +label_head() +{ + atf_set descr 'Test killing states by label' + atf_set require.user root + atf_set require.progs scapy +} + +label_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "block all" \ + "pass in proto tcp label bar" \ + "pass in proto icmp label foo" + + # Sanity check & establish state + # Note: use pft_ping so we always use the same ID, so pf considers all + # echo requests part of the same flow. + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Change rules to now deny the ICMP traffic + pft_set_rules noflush alcatraz "block all" + + # Established state means we can still ping alcatraz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing a label on a different rules keeps the state + jexec alcatraz pfctl -k label -k bar + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing a non-existing label keeps the state + jexec alcatraz pfctl -k label -k baz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing the correct label kills the state + jexec alcatraz pfctl -k label -k foo + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a +} + +label_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "label" +} From owner-dev-commits-src-main@freebsd.org Tue Apr 20 11:23:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3EF85F152B; Tue, 20 Apr 2021 11:23: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 4FPhBD3ZW6z4c7b; Tue, 20 Apr 2021 11:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DC6E11CE7; Tue, 20 Apr 2021 11:23: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 13KBN0VO086496; Tue, 20 Apr 2021 11:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KBN09Z086495; Tue, 20 Apr 2021 11:23:00 GMT (envelope-from git) Date: Tue, 20 Apr 2021 11:23:00 GMT Message-Id: <202104201123.13KBN09Z086495@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: 9af2317423f3 - main - pf tests: IPv6 test case for the 'kill state(s)' feature 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: 9af2317423f399b30ff028e078d01eef553efc7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 11:23:00 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9af2317423f399b30ff028e078d01eef553efc7f commit 9af2317423f399b30ff028e078d01eef553efc7f Author: Kristof Provost AuthorDate: 2021-04-16 15:47:47 +0000 Commit: Kristof Provost CommitDate: 2021-04-20 07:30:39 +0000 pf tests: IPv6 test case for the 'kill state(s)' feature Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29797 --- tests/sys/netpfil/common/pft_ping.py | 28 +++++++++++++- tests/sys/netpfil/pf/killstate.sh | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index 916a019d2f4a..de673f026c77 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -116,7 +116,10 @@ def check_ping6_request(args, packet): return True def check_ping_reply(args, packet): - return check_ping4_reply(args, packet) + if args.ip6: + return check_ping6_reply(args, packet) + else: + return check_ping4_reply(args, packet) def check_ping4_reply(args, packet): """ @@ -144,6 +147,29 @@ def check_ping4_reply(args, packet): return True +def check_ping6_reply(args, packet): + """ + Check that this is a reply to the ping request we sent + """ + dst_ip = args.to[0] + + ip = packet.getlayer(sp.IPv6) + if not ip: + return False + if ip.src != dst_ip: + return False + + icmp = packet.getlayer(sp.ICMPv6EchoReply) + if not icmp: + print("No echo reply!") + return False + + if icmp.data != PAYLOAD_MAGIC: + print("data mismatch") + return False + + return True + def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index 994ce130a814..d54858d5452c 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -101,6 +101,78 @@ v4_cleanup() pft_cleanup } +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'Test killing states by IPv6 address' + atf_set require.user root + atf_set require.progs scapy +} + +v6_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 2001:db8::1/64 up no_dad + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b inet6 2001:db8::2/64 up no_dad + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "block all" \ + "pass in proto icmp6" + + # Sanity check & establish state + # Note: use pft_ping so we always use the same ID, so pf considers all + # echo requests part of the same flow. + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8::2 \ + --replyif ${epair}a + + # Change rules to now deny the ICMP traffic + pft_set_rules noflush alcatraz "block all" + + # Established state means we can still ping alcatraz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8::2 \ + --replyif ${epair}a + + # Killing with the wrong IP doesn't affect our state + jexec alcatraz pfctl -k 2001:db8::3 + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8::2 \ + --replyif ${epair}a + + # Killing with one correct address and one incorrect doesn't kill the state + jexec alcatraz pfctl -k 2001:db8::1 -k 2001:db8::3 + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8::2 \ + --replyif ${epair}a + + # Killing with correct address does remove the state + jexec alcatraz pfctl -k 2001:db8::1 + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8::2 \ + --replyif ${epair}a + +} + +v6_cleanup() +{ + pft_cleanup +} + atf_test_case "label" "cleanup" label_head() { @@ -171,5 +243,6 @@ label_cleanup() atf_init_test_cases() { atf_add_test_case "v4" + atf_add_test_case "v6" atf_add_test_case "label" } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 11:36:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E165F5F1964; Tue, 20 Apr 2021 11:36: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 4FPhVM64VLz4ckB; Tue, 20 Apr 2021 11:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C35A611F6C; Tue, 20 Apr 2021 11:36: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 13KBaxXJ000171; Tue, 20 Apr 2021 11:36:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KBaxeL000170; Tue, 20 Apr 2021 11:36:59 GMT (envelope-from git) Date: Tue, 20 Apr 2021 11:36:59 GMT Message-Id: <202104201136.13KBaxeL000170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 3dbd5ecfe887 - main - Add myself (khng) as src committer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3dbd5ecfe8872c19483f1ce767efeaa7a118fe26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 11:36:59 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=3dbd5ecfe8872c19483f1ce767efeaa7a118fe26 commit 3dbd5ecfe8872c19483f1ce767efeaa7a118fe26 Author: Ka Ho Ng AuthorDate: 2021-04-20 11:27:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-20 11:33:36 +0000 Add myself (khng) as src committer. Approved by: lwhsu (mentor), philip (mentor) --- share/misc/committers-src.dot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot index 46df10579784..ba9df7968c53 100644 --- a/share/misc/committers-src.dot +++ b/share/misc/committers-src.dot @@ -237,6 +237,7 @@ ken [label="Ken Merry\nken@FreeBSD.org\n1998/09/08"] kensmith [label="Ken Smith\nkensmith@FreeBSD.org\n2004/01/23"] kevans [label="Kyle Evans\nkevans@FreeBSD.org\n2017/06/20"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2006/07/23"] +khng [label="Ka Ho Ng\nkhng@FreeBSD.org\n2021/03/15"] kib [label="Konstantin Belousov\nkib@FreeBSD.org\n2006/06/03"] kibab [label="Ilya Bakulin\nkibab@FreeBSD.org\n2017/09/02"] kmacy [label="Kip Macy\nkmacy@FreeBSD.org\n2005/06/01"] @@ -711,6 +712,8 @@ kmacy -> lstewart kp -> donner kp -> nick +lwhsu -> khng + marcel -> allanjude marcel -> art marcel -> arun @@ -785,6 +788,7 @@ philip -> benl philip -> donner philip -> ed philip -> jls +philip -> khng philip -> matteo philip -> uqs philip -> kp From owner-dev-commits-src-main@freebsd.org Tue Apr 20 11:41:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C220F5F1FD6; Tue, 20 Apr 2021 11:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPhbn58lVz4d4W; Tue, 20 Apr 2021 11:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A41D5121C7; Tue, 20 Apr 2021 11:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13KBffo2010485; Tue, 20 Apr 2021 11:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KBffDT010483; Tue, 20 Apr 2021 11:41:41 GMT (envelope-from git) Date: Tue, 20 Apr 2021 11:41:41 GMT Message-Id: <202104201141.13KBffDT010483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 9ca874cf740e - main - Add TCP LRO support for VLAN and VxLAN. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ca874cf740ee68c5742df8b5f9e20910085c011 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 11:41:41 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9ca874cf740ee68c5742df8b5f9e20910085c011 commit 9ca874cf740ee68c5742df8b5f9e20910085c011 Author: Hans Petter Selasky AuthorDate: 2021-03-31 10:36:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-20 11:36:22 +0000 Add TCP LRO support for VLAN and VxLAN. This change makes the TCP LRO code more generic and flexible with regards to supporting multiple different TCP encapsulation protocols and in general lays the ground for broader TCP LRO support. The main job of the TCP LRO code is to merge TCP packets for the same flow, to reduce the number of calls to upper layers. This reduces CPU and increases performance, due to being able to send larger TSO offloaded data chunks at a time. Basically the TCP LRO makes it possible to avoid per-packet interaction by the host CPU. Because the current TCP LRO code was tightly bound and optimized for TCP/IP over ethernet only, several larger changes were needed. Also a minor bug was fixed in the flushing mechanism for inactive entries, where the expire time, "le->mtime" was not always properly set. To avoid having to re-run time consuming regression tests for every change, it was chosen to squash the following list of changes into a single commit: - Refactor parsing of all address information into the "lro_parser" structure. This easily allows to reuse parsing code for inner headers. - Speedup header data comparison. Don't compare field by field, but instead use an unsigned long array, where the fields get packed. - Refactor the IPv4/TCP/UDP checksum computations, so that they may be computed recursivly, only applying deltas as the result of updating payload data. - Make smaller inline functions doing one operation at a time instead of big functions having repeated code. - Refactor the TCP ACK compression code to only execute once per TCP LRO flush. This gives a minor performance improvement and keeps the code simple. - Use sbintime() for all time-keeping. This change also fixes flushing of inactive entries. - Try to shrink the size of the LRO entry, because it is frequently zeroed. - Removed unused TCP LRO macros. - Cleanup unused TCP LRO statistics counters while at it. - Try to use __predict_true() and predict_false() to optimise CPU branch predictions. Bump the __FreeBSD_version due to changing the "lro_ctrl" structure. Tested by: Netflix Reviewed by: rrs (transport) Differential Revision: https://reviews.freebsd.org/D29564 MFC after: 2 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/netinet/tcp_lro.c | 2282 ++++++++++++++++++++++-------------------------- sys/netinet/tcp_lro.h | 124 +-- sys/netinet/tcp_subr.c | 5 - sys/netinet/tcp_var.h | 5 - sys/sys/mbuf.h | 7 +- sys/sys/param.h | 2 +- 6 files changed, 1107 insertions(+), 1318 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 62f6ad57c0f5..61c6f218e513 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -4,7 +4,7 @@ * Copyright (c) 2007, Myricom Inc. * Copyright (c) 2008, Intel Corporation. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2016 Mellanox Technologies. + * Copyright (c) 2016-2021 Mellanox Technologies. * All rights reserved. * * Portions of this software were developed by Bjoern Zeeb @@ -68,39 +68,39 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include static MALLOC_DEFINE(M_LRO, "LRO", "LRO control structures"); -#define TCP_LRO_UPDATE_CSUM 1 -#ifndef TCP_LRO_UPDATE_CSUM -#define TCP_LRO_INVALID_CSUM 0x0000 -#endif +#define TCP_LRO_TS_OPTION \ + ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | \ + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP) static void tcp_lro_rx_done(struct lro_ctrl *lc); -static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, - uint32_t csum, int use_hash); +static int tcp_lro_rx_common(struct lro_ctrl *lc, struct mbuf *m, + uint32_t csum, bool use_hash); + +#ifdef TCPHPTS +static bool do_bpf_strip_and_compress(struct inpcb *, struct lro_ctrl *, + struct lro_entry *, struct mbuf **, struct mbuf **, struct mbuf **, bool *, bool); + +#endif SYSCTL_NODE(_net_inet_tcp, OID_AUTO, lro, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP LRO"); -static long tcplro_stacks_wanting_mbufq = 0; +static long tcplro_stacks_wanting_mbufq; counter_u64_t tcp_inp_lro_direct_queue; counter_u64_t tcp_inp_lro_wokeup_queue; counter_u64_t tcp_inp_lro_compressed; -counter_u64_t tcp_inp_lro_single_push; counter_u64_t tcp_inp_lro_locks_taken; -counter_u64_t tcp_inp_lro_sack_wake; counter_u64_t tcp_extra_mbuf; counter_u64_t tcp_would_have_but; counter_u64_t tcp_comp_total; counter_u64_t tcp_uncomp_total; -counter_u64_t tcp_csum_hardware; -counter_u64_t tcp_csum_hardware_w_ph; -counter_u64_t tcp_csum_software; - static unsigned tcp_lro_entries = TCP_LRO_ENTRIES; SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries, @@ -113,28 +113,16 @@ SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, wokeup, CTLFLAG_RD, &tcp_inp_lro_wokeup_queue, "Number of lro's where we woke up transport via hpts"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, compressed, CTLFLAG_RD, &tcp_inp_lro_compressed, "Number of lro's compressed and sent to transport"); -SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, single, CTLFLAG_RD, - &tcp_inp_lro_single_push, "Number of lro's sent with single segment"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, lockcnt, CTLFLAG_RD, &tcp_inp_lro_locks_taken, "Number of lro's inp_wlocks taken"); -SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, sackwakeups, CTLFLAG_RD, - &tcp_inp_lro_sack_wake, "Number of wakeups caused by sack/fin"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, extra_mbuf, CTLFLAG_RD, &tcp_extra_mbuf, "Number of times we had an extra compressed ack dropped into the tp"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, would_have_but, CTLFLAG_RD, - &tcp_would_have_but, "Number of times we would have had an extra compressed but out of room"); + &tcp_would_have_but, "Number of times we would have had an extra compressed, but mget failed"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, with_m_ackcmp, CTLFLAG_RD, &tcp_comp_total, "Number of mbufs queued with M_ACKCMP flags set"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, without_m_ackcmp, CTLFLAG_RD, &tcp_uncomp_total, "Number of mbufs queued without M_ACKCMP"); -SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_hw, CTLFLAG_RD, - &tcp_csum_hardware, "Number of checksums processed in hardware"); -SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_hw_ph, CTLFLAG_RD, - &tcp_csum_hardware_w_ph, "Number of checksums processed in hardware with pseudo header"); -SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_sw, CTLFLAG_RD, - &tcp_csum_software, "Number of checksums processed in software"); - - void tcp_lro_reg_mbufq(void) @@ -226,34 +214,230 @@ tcp_lro_init_args(struct lro_ctrl *lc, struct ifnet *ifp, return (0); } -static struct tcphdr * -tcp_lro_get_th(struct lro_entry *le, struct mbuf *m) +struct vxlan_header { + uint32_t vxlh_flags; + uint32_t vxlh_vni; +}; + +static inline void * +tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, bool is_vxlan) { - struct ether_header *eh; - struct tcphdr *th = NULL; -#ifdef INET6 - struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ -#endif + const struct ether_vlan_header *eh; + void *old; + uint16_t eth_type; + + if (update_data) + memset(parser, 0, sizeof(*parser)); + + old = ptr; + + if (is_vxlan) { + const struct vxlan_header *vxh; + vxh = ptr; + ptr = (uint8_t *)ptr + sizeof(*vxh); + if (update_data) { + parser->data.vxlan_vni = + vxh->vxlh_vni & htonl(0xffffff00); + } + } + + eh = ptr; + if (__predict_false(eh->evl_encap_proto == htons(ETHERTYPE_VLAN))) { + eth_type = eh->evl_proto; + if (update_data) { + /* strip priority and keep VLAN ID only */ + parser->data.vlan_id = eh->evl_tag & htons(EVL_VLID_MASK); + } + /* advance to next header */ + ptr = (uint8_t *)ptr + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + /* advance to next header */ + ptr = (uint8_t *)ptr + ETHER_HDR_LEN; + } + + switch (eth_type) { #ifdef INET - struct ip *ip4 = NULL; /* Keep compiler happy. */ + case htons(ETHERTYPE_IP): + parser->ip4 = ptr; + /* Ensure there are no IPv4 options. */ + if ((parser->ip4->ip_hl << 2) != sizeof (*parser->ip4)) + break; + /* .. and the packet is not fragmented. */ + if (parser->ip4->ip_off & htons(IP_MF|IP_OFFMASK)) + break; + ptr = (uint8_t *)ptr + (parser->ip4->ip_hl << 2); + if (update_data) { + parser->data.s_addr.v4 = parser->ip4->ip_src; + parser->data.d_addr.v4 = parser->ip4->ip_dst; + } + switch (parser->ip4->ip_p) { + case IPPROTO_UDP: + parser->udp = ptr; + if (update_data) { + parser->data.lro_type = LRO_TYPE_IPV4_UDP; + parser->data.s_port = parser->udp->uh_sport; + parser->data.d_port = parser->udp->uh_dport; + } else { + MPASS(parser->data.lro_type == LRO_TYPE_IPV4_UDP); + } + ptr = ((uint8_t *)ptr + sizeof(*parser->udp)); + parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; + return (ptr); + case IPPROTO_TCP: + parser->tcp = ptr; + if (update_data) { + parser->data.lro_type = LRO_TYPE_IPV4_TCP; + parser->data.s_port = parser->tcp->th_sport; + parser->data.d_port = parser->tcp->th_dport; + } else { + MPASS(parser->data.lro_type == LRO_TYPE_IPV4_TCP); + } + ptr = (uint8_t *)ptr + (parser->tcp->th_off << 2); + parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; + return (ptr); + default: + break; + } + break; #endif - - eh = mtod(m, struct ether_header *); - switch (le->eh_type) { #ifdef INET6 - case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(eh + 1); - th = (struct tcphdr *)(ip6 + 1); + case htons(ETHERTYPE_IPV6): + parser->ip6 = ptr; + ptr = (uint8_t *)ptr + sizeof(*parser->ip6); + if (update_data) { + parser->data.s_addr.v6 = parser->ip6->ip6_src; + parser->data.d_addr.v6 = parser->ip6->ip6_dst; + } + switch (parser->ip6->ip6_nxt) { + case IPPROTO_UDP: + parser->udp = ptr; + if (update_data) { + parser->data.lro_type = LRO_TYPE_IPV6_UDP; + parser->data.s_port = parser->udp->uh_sport; + parser->data.d_port = parser->udp->uh_dport; + } else { + MPASS(parser->data.lro_type == LRO_TYPE_IPV6_UDP); + } + ptr = (uint8_t *)ptr + sizeof(*parser->udp); + parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; + return (ptr); + case IPPROTO_TCP: + parser->tcp = ptr; + if (update_data) { + parser->data.lro_type = LRO_TYPE_IPV6_TCP; + parser->data.s_port = parser->tcp->th_sport; + parser->data.d_port = parser->tcp->th_dport; + } else { + MPASS(parser->data.lro_type == LRO_TYPE_IPV6_TCP); + } + ptr = (uint8_t *)ptr + (parser->tcp->th_off << 2); + parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; + return (ptr); + default: + break; + } break; #endif + default: + break; + } + /* Invalid packet - cannot parse */ + return (NULL); +} + +static const int vxlan_csum = CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | + CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID; + +static inline struct lro_parser * +tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, bool update_data) +{ + void *data_ptr; + + /* Try to parse outer headers first. */ + data_ptr = tcp_lro_low_level_parser(m->m_data, po, update_data, false); + if (data_ptr == NULL || po->total_hdr_len > m->m_len) + return (NULL); + + if (update_data) { + /* Store VLAN ID, if any. */ + if (__predict_false(m->m_flags & M_VLANTAG)) { + po->data.vlan_id = + htons(m->m_pkthdr.ether_vtag) & htons(EVL_VLID_MASK); + } + } + + switch (po->data.lro_type) { + case LRO_TYPE_IPV4_UDP: + case LRO_TYPE_IPV6_UDP: + /* Check for VXLAN headers. */ + if ((m->m_pkthdr.csum_flags & vxlan_csum) != vxlan_csum) + break; + + /* Try to parse inner headers. */ + data_ptr = tcp_lro_low_level_parser(data_ptr, pi, update_data, true); + if (data_ptr == NULL || pi->total_hdr_len > m->m_len) + break; + + /* Verify supported header types. */ + switch (pi->data.lro_type) { + case LRO_TYPE_IPV4_TCP: + case LRO_TYPE_IPV6_TCP: + return (pi); + default: + break; + } + break; + case LRO_TYPE_IPV4_TCP: + case LRO_TYPE_IPV6_TCP: + if (update_data) + memset(pi, 0, sizeof(*pi)); + return (po); + default: + break; + } + return (NULL); +} + +static inline int +tcp_lro_trim_mbuf_chain(struct mbuf *m, const struct lro_parser *po) +{ + int len; + + switch (po->data.lro_type) { #ifdef INET - case ETHERTYPE_IP: - ip4 = (struct ip *)(eh + 1); - th = (struct tcphdr *)(ip4 + 1); + case LRO_TYPE_IPV4_TCP: + len = ((uint8_t *)po->ip4 - (uint8_t *)m->m_data) + + ntohs(po->ip4->ip_len); break; #endif +#ifdef INET6 + case LRO_TYPE_IPV6_TCP: + len = ((uint8_t *)po->ip6 - (uint8_t *)m->m_data) + + ntohs(po->ip6->ip6_plen) + sizeof(*po->ip6); + break; +#endif + default: + return (TCP_LRO_CANNOT); + } + + /* + * If the frame is padded beyond the end of the IP packet, + * then trim the extra bytes off: + */ + if (__predict_true(m->m_pkthdr.len == len)) { + return (0); + } else if (m->m_pkthdr.len > len) { + m_adj(m, len - m->m_pkthdr.len); + return (0); } - return (th); + return (TCP_LRO_CANNOT); +} + +static struct tcphdr * +tcp_lro_get_th(struct mbuf *m) +{ + return ((struct tcphdr *)((uint8_t *)m->m_data + m->m_pkthdr.lro_tcp_h_off)); } static void @@ -300,86 +484,67 @@ tcp_lro_free(struct lro_ctrl *lc) } static uint16_t -tcp_lro_csum_th(struct tcphdr *th) +tcp_lro_rx_csum_tcphdr(const struct tcphdr *th) { - uint32_t ch; - uint16_t *p, l; - - ch = th->th_sum = 0x0000; - l = th->th_off; - p = (uint16_t *)th; - while (l > 0) { - ch += *p; - p++; - ch += *p; - p++; - l--; + const uint16_t *ptr; + uint32_t csum; + uint16_t len; + + csum = -th->th_sum; /* exclude checksum field */ + len = th->th_off; + ptr = (const uint16_t *)th; + while (len--) { + csum += *ptr; + ptr++; + csum += *ptr; + ptr++; } - while (ch > 0xffff) - ch = (ch >> 16) + (ch & 0xffff); + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); - return (ch & 0xffff); + return (csum); } static uint16_t -tcp_lro_rx_csum_fixup(struct lro_entry *le, void *l3hdr, struct tcphdr *th, - uint16_t tcp_data_len, uint16_t csum) +tcp_lro_rx_csum_data(const struct lro_parser *pa, uint16_t tcp_csum) { uint32_t c; uint16_t cs; - c = csum; + c = tcp_csum; - /* Remove length from checksum. */ - switch (le->eh_type) { + switch (pa->data.lro_type) { #ifdef INET6 - case ETHERTYPE_IPV6: - { - struct ip6_hdr *ip6; - - ip6 = (struct ip6_hdr *)l3hdr; - if (le->append_cnt == 0) - cs = ip6->ip6_plen; - else { - uint32_t cx; - - cx = ntohs(ip6->ip6_plen); - cs = in6_cksum_pseudo(ip6, cx, ip6->ip6_nxt, 0); - } + case LRO_TYPE_IPV6_TCP: + /* Compute full pseudo IPv6 header checksum. */ + cs = in6_cksum_pseudo(pa->ip6, ntohs(pa->ip6->ip6_plen), pa->ip6->ip6_nxt, 0); break; - } #endif #ifdef INET - case ETHERTYPE_IP: - { - struct ip *ip4; - - ip4 = (struct ip *)l3hdr; - if (le->append_cnt == 0) - cs = ip4->ip_len; - else { - cs = in_addword(ntohs(ip4->ip_len) - sizeof(*ip4), - IPPROTO_TCP); - cs = in_pseudo(ip4->ip_src.s_addr, ip4->ip_dst.s_addr, - htons(cs)); - } + case LRO_TYPE_IPV4_TCP: + /* Compute full pseudo IPv4 header checsum. */ + cs = in_addword(ntohs(pa->ip4->ip_len) - sizeof(*pa->ip4), IPPROTO_TCP); + cs = in_pseudo(pa->ip4->ip_src.s_addr, pa->ip4->ip_dst.s_addr, htons(cs)); break; - } #endif default: cs = 0; /* Keep compiler happy. */ + break; } + /* Complement checksum. */ cs = ~cs; c += cs; - /* Remove TCP header csum. */ - cs = ~tcp_lro_csum_th(th); + /* Remove TCP header checksum. */ + cs = ~tcp_lro_rx_csum_tcphdr(pa->tcp); c += cs; + + /* Compute checksum remainder. */ while (c > 0xffff) c = (c >> 16) + (c & 0xffff); - return (c & 0xffff); + return (c); } static void @@ -397,84 +562,51 @@ void tcp_lro_flush_inactive(struct lro_ctrl *lc, const struct timeval *timeout) { struct lro_entry *le, *le_tmp; - struct timeval tv; + sbintime_t sbt; if (LIST_EMPTY(&lc->lro_active)) return; - getmicrouptime(&tv); - timevalsub(&tv, timeout); + /* get timeout time */ + sbt = getsbinuptime() - tvtosbt(*timeout); + LIST_FOREACH_SAFE(le, &lc->lro_active, next, le_tmp) { - if (timevalcmp(&tv, &le->mtime, >=)) { + if (sbt >= le->alloc_time) { tcp_lro_active_remove(le); tcp_lro_flush(lc, le); } } } -#ifdef INET6 -static int -tcp_lro_rx_ipv6(struct lro_ctrl *lc, struct mbuf *m, struct ip6_hdr *ip6, - struct tcphdr **th) -{ - - /* XXX-BZ we should check the flow-label. */ - - /* XXX-BZ We do not yet support ext. hdrs. */ - if (ip6->ip6_nxt != IPPROTO_TCP) - return (TCP_LRO_NOT_SUPPORTED); - - /* Find the TCP header. */ - *th = (struct tcphdr *)(ip6 + 1); - - return (0); -} -#endif - #ifdef INET static int -tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *m, struct ip *ip4, - struct tcphdr **th) +tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *m, struct ip *ip4) { - int csum_flags; uint16_t csum; - if (ip4->ip_p != IPPROTO_TCP) - return (TCP_LRO_NOT_SUPPORTED); - - /* Ensure there are no options. */ - if ((ip4->ip_hl << 2) != sizeof (*ip4)) - return (TCP_LRO_CANNOT); - - /* .. and the packet is not fragmented. */ - if (ip4->ip_off & htons(IP_MF|IP_OFFMASK)) - return (TCP_LRO_CANNOT); - /* Legacy IP has a header checksum that needs to be correct. */ - csum_flags = m->m_pkthdr.csum_flags; - if (csum_flags & CSUM_IP_CHECKED) { - if (__predict_false((csum_flags & CSUM_IP_VALID) == 0)) { + if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) { + if (__predict_false((m->m_pkthdr.csum_flags & CSUM_IP_VALID) == 0)) { lc->lro_bad_csum++; return (TCP_LRO_CANNOT); } } else { csum = in_cksum_hdr(ip4); - if (__predict_false((csum) != 0)) { + if (__predict_false(csum != 0)) { lc->lro_bad_csum++; return (TCP_LRO_CANNOT); } } - /* Find the TCP header (we assured there are no IP options). */ - *th = (struct tcphdr *)(ip4 + 1); return (0); } #endif #ifdef TCPHPTS static void -tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, - struct lro_entry *le, struct mbuf *m, int frm, int32_t tcp_data_len, - uint32_t th_seq , uint32_t th_ack, uint16_t th_win) +tcp_lro_log(struct tcpcb *tp, const struct lro_ctrl *lc, + const struct lro_entry *le, const struct mbuf *m, + int frm, int32_t tcp_data_len, uint32_t th_seq, + uint32_t th_ack, uint16_t th_win) { if (tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; @@ -489,8 +621,8 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, log.u_bbr.flex2 = m->m_pkthdr.len; else log.u_bbr.flex2 = 0; - log.u_bbr.flex3 = le->append_cnt; - log.u_bbr.flex4 = le->p_len; + log.u_bbr.flex3 = le->m_head->m_pkthdr.lro_nsegs; + log.u_bbr.flex4 = le->m_head->m_pkthdr.lro_tcp_d_len; if (le->m_head) { log.u_bbr.flex5 = le->m_head->m_pkthdr.len; log.u_bbr.delRate = le->m_head->m_flags; @@ -505,11 +637,9 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, log.u_bbr.cwnd_gain = le->window; log.u_bbr.cur_del_rate = (uintptr_t)m; log.u_bbr.bw_inuse = (uintptr_t)le->m_head; - log.u_bbr.pkts_out = le->mbuf_cnt; /* Total mbufs added */ - log.u_bbr.applimited = le->ulp_csum; - log.u_bbr.lost = le->mbuf_appended; - log.u_bbr.pkt_epoch = le->cmp_ack_cnt; - log.u_bbr.flex6 = tcp_tv_to_usectick(&lc->lro_last_flush); + log.u_bbr.flex6 = sbttous(lc->lro_last_queue_time); + log.u_bbr.flex7 = le->compressed; + log.u_bbr.pacing_gain = le->uncompressed; if (in_epoch(net_epoch_preempt)) log.u_bbr.inhpts = 1; else @@ -523,198 +653,292 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, } #endif -static void -tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le) +static inline void +tcp_lro_assign_and_checksum_16(uint16_t *ptr, uint16_t value, uint16_t *psum) { - if (le->append_cnt > 1) { - struct tcphdr *th; - uint16_t p_len; + uint32_t csum; - p_len = htons(le->p_len); - switch (le->eh_type) { -#ifdef INET6 - case ETHERTYPE_IPV6: - { - struct ip6_hdr *ip6; + csum = 0xffff - *ptr + value; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + *ptr = value; + *psum = csum; +} + +static uint16_t +tcp_lro_update_checksum(const struct lro_parser *pa, const struct lro_entry *le, + uint16_t payload_len, uint16_t delta_sum) +{ + uint32_t csum; + uint16_t tlen; + uint16_t temp[5] = {}; + + switch (pa->data.lro_type) { + case LRO_TYPE_IPV4_TCP: + /* Compute new IPv4 length. */ + tlen = (pa->ip4->ip_hl << 2) + (pa->tcp->th_off << 2) + payload_len; + tcp_lro_assign_and_checksum_16(&pa->ip4->ip_len, htons(tlen), &temp[0]); + + /* Subtract delta from current IPv4 checksum. */ + csum = pa->ip4->ip_sum + 0xffff - temp[0]; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + tcp_lro_assign_and_checksum_16(&pa->ip4->ip_sum, csum, &temp[1]); + goto update_tcp_header; + + case LRO_TYPE_IPV6_TCP: + /* Compute new IPv6 length. */ + tlen = (pa->tcp->th_off << 2) + payload_len; + tcp_lro_assign_and_checksum_16(&pa->ip6->ip6_plen, htons(tlen), &temp[0]); + goto update_tcp_header; + + case LRO_TYPE_IPV4_UDP: + /* Compute new IPv4 length. */ + tlen = (pa->ip4->ip_hl << 2) + sizeof(*pa->udp) + payload_len; + tcp_lro_assign_and_checksum_16(&pa->ip4->ip_len, htons(tlen), &temp[0]); + + /* Subtract delta from current IPv4 checksum. */ + csum = pa->ip4->ip_sum + 0xffff - temp[0]; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + tcp_lro_assign_and_checksum_16(&pa->ip4->ip_sum, csum, &temp[1]); + goto update_udp_header; + + case LRO_TYPE_IPV6_UDP: + /* Compute new IPv6 length. */ + tlen = sizeof(*pa->udp) + payload_len; + tcp_lro_assign_and_checksum_16(&pa->ip6->ip6_plen, htons(tlen), &temp[0]); + goto update_udp_header; + + default: + return (0); + } + +update_tcp_header: + /* Compute current TCP header checksum. */ + temp[2] = tcp_lro_rx_csum_tcphdr(pa->tcp); + + /* Incorporate the latest ACK into the TCP header. */ + pa->tcp->th_ack = le->ack_seq; + pa->tcp->th_win = le->window; + + /* Incorporate latest timestamp into the TCP header. */ + if (le->timestamp != 0) { + uint32_t *ts_ptr; + + ts_ptr = (uint32_t *)(pa->tcp + 1); + ts_ptr[1] = htonl(le->tsval); + ts_ptr[2] = le->tsecr; + } + + /* Compute new TCP header checksum. */ + temp[3] = tcp_lro_rx_csum_tcphdr(pa->tcp); + + /* Compute new TCP checksum. */ + csum = pa->tcp->th_sum + 0xffff - delta_sum + + 0xffff - temp[0] + 0xffff - temp[3] + temp[2]; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + + /* Assign new TCP checksum. */ + tcp_lro_assign_and_checksum_16(&pa->tcp->th_sum, csum, &temp[4]); + + /* Compute all modififications affecting next checksum. */ + csum = temp[0] + temp[1] + 0xffff - temp[2] + + temp[3] + temp[4] + delta_sum; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + + /* Return delta checksum to next stage, if any. */ + return (csum); + +update_udp_header: + tlen = sizeof(*pa->udp) + payload_len; + /* Assign new UDP length and compute checksum delta. */ + tcp_lro_assign_and_checksum_16(&pa->udp->uh_ulen, htons(tlen), &temp[2]); + + /* Check if there is a UDP checksum. */ + if (__predict_false(pa->udp->uh_sum != 0)) { + /* Compute new UDP checksum. */ + csum = pa->udp->uh_sum + 0xffff - delta_sum + + 0xffff - temp[0] + 0xffff - temp[2]; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + /* Assign new UDP checksum. */ + tcp_lro_assign_and_checksum_16(&pa->udp->uh_sum, csum, &temp[3]); + } - ip6 = le->le_ip6; - ip6->ip6_plen = p_len; - th = (struct tcphdr *)(ip6 + 1); + /* Compute all modififications affecting next checksum. */ + csum = temp[0] + temp[1] + temp[2] + temp[3] + delta_sum; + while (csum > 0xffff) + csum = (csum >> 16) + (csum & 0xffff); + + /* Return delta checksum to next stage, if any. */ + return (csum); +} + +static void +tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) +{ + /* Check if we need to recompute any checksums. */ + if (le->m_head->m_pkthdr.lro_nsegs > 1) { + uint16_t csum; + + switch (le->inner.data.lro_type) { + case LRO_TYPE_IPV4_TCP: + csum = tcp_lro_update_checksum(&le->inner, le, + le->m_head->m_pkthdr.lro_tcp_d_len, + le->m_head->m_pkthdr.lro_tcp_d_csum); + csum = tcp_lro_update_checksum(&le->outer, NULL, + le->m_head->m_pkthdr.lro_tcp_d_len + + le->inner.total_hdr_len, csum); le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | - CSUM_PSEUDO_HDR; - le->p_len += ETHER_HDR_LEN + sizeof(*ip6); + CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; + le->m_head->m_pkthdr.csum_data = 0xffff; break; - } -#endif -#ifdef INET - case ETHERTYPE_IP: - { - struct ip *ip4; - uint32_t cl; - uint16_t c; - - ip4 = le->le_ip4; - /* Fix IP header checksum for new length. */ - c = ~ip4->ip_sum; - cl = c; - c = ~ip4->ip_len; - cl += c + p_len; - while (cl > 0xffff) - cl = (cl >> 16) + (cl & 0xffff); - c = cl; - ip4->ip_sum = ~c; - ip4->ip_len = p_len; - th = (struct tcphdr *)(ip4 + 1); + case LRO_TYPE_IPV6_TCP: + csum = tcp_lro_update_checksum(&le->inner, le, + le->m_head->m_pkthdr.lro_tcp_d_len, + le->m_head->m_pkthdr.lro_tcp_d_csum); + csum = tcp_lro_update_checksum(&le->outer, NULL, + le->m_head->m_pkthdr.lro_tcp_d_len + + le->inner.total_hdr_len, csum); le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | - CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; - le->p_len += ETHER_HDR_LEN; + CSUM_PSEUDO_HDR; + le->m_head->m_pkthdr.csum_data = 0xffff; + break; + case LRO_TYPE_NONE: + switch (le->outer.data.lro_type) { + case LRO_TYPE_IPV4_TCP: + csum = tcp_lro_update_checksum(&le->outer, le, + le->m_head->m_pkthdr.lro_tcp_d_len, + le->m_head->m_pkthdr.lro_tcp_d_csum); + le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | + CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; + le->m_head->m_pkthdr.csum_data = 0xffff; + break; + case LRO_TYPE_IPV6_TCP: + csum = tcp_lro_update_checksum(&le->outer, le, + le->m_head->m_pkthdr.lro_tcp_d_len, + le->m_head->m_pkthdr.lro_tcp_d_csum); + le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + le->m_head->m_pkthdr.csum_data = 0xffff; + break; + default: + break; + } break; - } -#endif default: - th = NULL; /* Keep compiler happy. */ - } - le->m_head->m_pkthdr.csum_data = 0xffff; - le->m_head->m_pkthdr.len = le->p_len; - - /* Incorporate the latest ACK into the TCP header. */ - th->th_ack = le->ack_seq; - th->th_win = le->window; - /* Incorporate latest timestamp into the TCP header. */ - if (le->timestamp != 0) { - uint32_t *ts_ptr; - - ts_ptr = (uint32_t *)(th + 1); - ts_ptr[1] = htonl(le->tsval); - ts_ptr[2] = le->tsecr; + break; } - /* Update the TCP header checksum. */ - le->ulp_csum += p_len; - le->ulp_csum += tcp_lro_csum_th(th); - while (le->ulp_csum > 0xffff) - le->ulp_csum = (le->ulp_csum >> 16) + - (le->ulp_csum & 0xffff); - th->th_sum = (le->ulp_csum & 0xffff); - th->th_sum = ~th->th_sum; } + /* * Break any chain, this is not set to NULL on the singleton * case m_nextpkt points to m_head. Other case set them * m_nextpkt to NULL in push_and_replace. */ le->m_head->m_nextpkt = NULL; - le->m_head->m_pkthdr.lro_nsegs = le->append_cnt; + lc->lro_queued += le->m_head->m_pkthdr.lro_nsegs; (*lc->ifp->if_input)(lc->ifp, le->m_head); - lc->lro_queued += le->append_cnt; } static void -tcp_set_le_to_m(struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m) +tcp_set_entry_to_mbuf(struct lro_ctrl *lc, struct lro_entry *le, + struct mbuf *m, struct tcphdr *th) { - struct ether_header *eh; - void *l3hdr = NULL; /* Keep compiler happy. */ - struct tcphdr *th; -#ifdef INET6 - struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ -#endif -#ifdef INET - struct ip *ip4 = NULL; /* Keep compiler happy. */ -#endif uint32_t *ts_ptr; - int error, l, ts_failed = 0; uint16_t tcp_data_len; - uint16_t csum; + uint16_t tcp_opt_len; - error = -1; - eh = mtod(m, struct ether_header *); - /* - * We must reset the other pointers since the mbuf - * we were pointing too is about to go away. - */ - switch (le->eh_type) { -#ifdef INET6 - case ETHERTYPE_IPV6: - l3hdr = ip6 = (struct ip6_hdr *)(eh + 1); - error = tcp_lro_rx_ipv6(lc, m, ip6, &th); - le->le_ip6 = ip6; - le->source_ip6 = ip6->ip6_src; - le->dest_ip6 = ip6->ip6_dst; - le->p_len = m->m_pkthdr.len - ETHER_HDR_LEN - sizeof(*ip6); - break; -#endif -#ifdef INET - case ETHERTYPE_IP: - l3hdr = ip4 = (struct ip *)(eh + 1); - error = tcp_lro_rx_ipv4(lc, m, ip4, &th); - le->le_ip4 = ip4; - le->source_ip4 = ip4->ip_src.s_addr; - le->dest_ip4 = ip4->ip_dst.s_addr; - le->p_len = m->m_pkthdr.len - ETHER_HDR_LEN; - break; -#endif - } - KASSERT(error == 0, ("%s: le=%p tcp_lro_rx_xxx failed\n", - __func__, le)); ts_ptr = (uint32_t *)(th + 1); - l = (th->th_off << 2); - l -= sizeof(*th); - if (l != 0 && - (__predict_false(l != TCPOLEN_TSTAMP_APPA) || - (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| - TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) { - /* We have failed to find a timestamp some other option? */ - ts_failed = 1; - } - if ((l != 0) && (ts_failed == 0)) { + tcp_opt_len = (th->th_off << 2); + tcp_opt_len -= sizeof(*th); + + /* Check if there is a timestamp option. */ + if (tcp_opt_len == 0 || + __predict_false(tcp_opt_len != TCPOLEN_TSTAMP_APPA || + *ts_ptr != TCP_LRO_TS_OPTION)) { + /* We failed to find the timestamp option. */ + le->timestamp = 0; + } else { le->timestamp = 1; le->tsval = ntohl(*(ts_ptr + 1)); le->tsecr = *(ts_ptr + 2); - } else *** 2084 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Apr 20 12:56:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6131B5F4F70; Tue, 20 Apr 2021 12:56: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 4FPkG626CHz4hpJ; Tue, 20 Apr 2021 12:56:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B39612CFE; Tue, 20 Apr 2021 12:56: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 13KCuUkj005597; Tue, 20 Apr 2021 12:56:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KCuU63005596; Tue, 20 Apr 2021 12:56:30 GMT (envelope-from git) Date: Tue, 20 Apr 2021 12:56:30 GMT Message-Id: <202104201256.13KCuU63005596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: a649f1f6fd7a - main - tcp: Deal with DSACKs, and adjust rescue hole on success. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a649f1f6fd7a098ab173a69fe87916c04a8c6f8d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 12:56:30 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=a649f1f6fd7a098ab173a69fe87916c04a8c6f8d commit a649f1f6fd7a098ab173a69fe87916c04a8c6f8d Author: Richard Scheffenegger AuthorDate: 2021-04-20 12:53:56 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-20 12:54:28 +0000 tcp: Deal with DSACKs, and adjust rescue hole on success. When a rescue retransmission is successful, rather than inserting new holes to the left of it, adjust the old rescue entry to cover the missed sequence space. Also, as snd_fack may be stale by that point, pull it forward in order to never create a hole left of snd_una/th_ack. Finally, with DSACKs, tcp_sack_doack() may be called with new full ACKs but a DSACK block. Account for this eventuality properly to keep sacked_bytes >= 0. MFC after: 3 days Reviewed By: kbowling, tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29835 --- sys/netinet/tcp_sack.c | 76 +++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index fffba2e75045..bfe40854c76b 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -497,7 +497,7 @@ static struct sackhole * tcp_sackhole_insert(struct tcpcb *tp, tcp_seq start, tcp_seq end, struct sackhole *after) { - struct sackhole *hole, *tail; + struct sackhole *hole; /* Allocate a new SACK hole. */ hole = tcp_sackhole_alloc(tp, start, end); @@ -508,15 +508,7 @@ tcp_sackhole_insert(struct tcpcb *tp, tcp_seq start, tcp_seq end, if (after != NULL) TAILQ_INSERT_AFTER(&tp->snd_holes, after, hole, scblink); else - /* - * With Rescue Retransmission, new holes may need to - * be inserted just before the tail. - */ - if (((tail = TAILQ_LAST_FAST(&tp->snd_holes, sackhole, - scblink)) != NULL) && SEQ_LEQ(end, tail->start)) - TAILQ_INSERT_BEFORE(tail, hole, scblink); - else - TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink); + TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink); /* Update SACK hint. */ if (tp->sackhint.nexthole == NULL) @@ -573,6 +565,15 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) left_edge_delta = th_ack - tp->snd_una; sack_blocks[num_sack_blks].start = tp->snd_una; sack_blocks[num_sack_blks++].end = th_ack; + /* + * Pulling snd_fack forward if we got here + * due to DSACK blocks + */ + if (SEQ_LT(tp->snd_fack, th_ack)) { + delivered_data += th_ack - tp->snd_una; + tp->snd_fack = th_ack; + sack_changed = 1; + } } /* * Append received valid SACK blocks to sack_blocks[], but only if we @@ -642,35 +643,52 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) tp->sackhint.last_sack_ack = sblkp->end; if (SEQ_LT(tp->snd_fack, sblkp->start)) { /* - * The highest SACK block is beyond fack. Append new SACK - * hole at the tail. If the second or later highest SACK - * blocks are also beyond the current fack, they will be - * inserted by way of hole splitting in the while-loop below. + * The highest SACK block is beyond fack. First, + * check if there was a successful Rescue Retransmission, + * and move this hole left. With normal holes, snd_fack + * is always to the right of the end. */ - temp = tcp_sackhole_insert(tp, tp->snd_fack,sblkp->start,NULL); - if (temp != NULL) { + if (((temp = TAILQ_LAST(&tp->snd_holes, sackhole_head)) != NULL) && + SEQ_LEQ(tp->snd_fack,temp->end)) { + temp->start = SEQ_MAX(tp->snd_fack, SEQ_MAX(tp->snd_una, th_ack)); + temp->end = sblkp->start; + temp->rxmit = temp->start; delivered_data += sblkp->end - sblkp->start; tp->snd_fack = sblkp->end; - /* Go to the previous sack block. */ sblkp--; sack_changed = 1; } else { /* - * We failed to add a new hole based on the current - * sack block. Skip over all the sack blocks that - * fall completely to the right of snd_fack and - * proceed to trim the scoreboard based on the - * remaining sack blocks. This also trims the - * scoreboard for th_ack (which is sack_blocks[0]). + * Append a new SACK hole at the tail. If the + * second or later highest SACK blocks are also + * beyond the current fack, they will be inserted + * by way of hole splitting in the while-loop below. */ - while (sblkp >= sack_blocks && - SEQ_LT(tp->snd_fack, sblkp->start)) - sblkp--; - if (sblkp >= sack_blocks && - SEQ_LT(tp->snd_fack, sblkp->end)) { - delivered_data += sblkp->end - tp->snd_fack; + temp = tcp_sackhole_insert(tp, tp->snd_fack,sblkp->start,NULL); + if (temp != NULL) { + delivered_data += sblkp->end - sblkp->start; tp->snd_fack = sblkp->end; + /* Go to the previous sack block. */ + sblkp--; sack_changed = 1; + } else { + /* + * We failed to add a new hole based on the current + * sack block. Skip over all the sack blocks that + * fall completely to the right of snd_fack and + * proceed to trim the scoreboard based on the + * remaining sack blocks. This also trims the + * scoreboard for th_ack (which is sack_blocks[0]). + */ + while (sblkp >= sack_blocks && + SEQ_LT(tp->snd_fack, sblkp->start)) + sblkp--; + if (sblkp >= sack_blocks && + SEQ_LT(tp->snd_fack, sblkp->end)) { + delivered_data += sblkp->end - tp->snd_fack; + tp->snd_fack = sblkp->end; + sack_changed = 1; + } } } } else if (SEQ_LT(tp->snd_fack, sblkp->end)) { From owner-dev-commits-src-main@freebsd.org Tue Apr 20 15:19:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F226B5DAFB1; Tue, 20 Apr 2021 15:19:51 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPnRW27Ldz4rtm; Tue, 20 Apr 2021 15:19:50 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x731.google.com with SMTP id z2so2680594qkb.9; Tue, 20 Apr 2021 08:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qUSs71Gmi388ciFd3Hzs+kKYVnzXBAiZFpJYEyLnp8Q=; b=I6GZm8VX9SByhk/Q+2+CreoEExUsrzGI2I0WXwV9Ooj1X2RCR/rHeujHVx/a/6Y22v 9p919QkGvmIB363QAg1U2qw++8xe1AZ/i93NeLKhe9jCa4Hqtf37NTxXtmOlNP3Ye6uU pHLka8jMSpe9XuIBFjbGamh74QrFcoXWZ9osy6lGHv2Pj71XUlW7+6KB9/8ZCujv8t0o sI/K+GRlyISa3fkneHMo509fshydntvjHQAxe2bcXbMEQ2JD7lbO/fJiWn0nDygr+UXH DQ2Ev802ccLxRnZKbK3a3y3ai+Yyh2Jodo1Gv66y9x9fajOmAfFcjXZ1hu4GUBxpMbm2 1usw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=qUSs71Gmi388ciFd3Hzs+kKYVnzXBAiZFpJYEyLnp8Q=; b=AcG8z4RspMI/4lBAcr01MBAxiMsO8olg92PR1DNFBNRPQE5cvM38aYJd6yAIC1Na5J YkPrru3oxluuJz1P6F5NoFsoGFA81oNcYGxl70p5WdKxq5NYnaldDcQsG6w/92FdLW7E SLrMkvZQpkQIqFqoh69Gl3yW/pTqe7/sDgMa1guudicqRc2xWf63v9g+JZCLBOfT2EHK 9neMZiPSkHvBiOwMIBw67g4S5vS5XMyXZOn4kk2gk+qrsBox98MaujgXmkcTXjdElLA6 cjRZXv0pE5SCxXHzDMpaq86rTMOw3lX6xulLVrWoBuK+H2YXQnbHnycGAU7IBdVNOkDf s+Gg== X-Gm-Message-State: AOAM530bw7r2yM0fWlT7TzeFZeIRGFH8rmr7lFqf35bHT3FQYSm2TxuA H5fewxg/59pt0e5FOBOlPvw= X-Google-Smtp-Source: ABdhPJxuI2ZfRsCRrsksV67k+navDX5KrFshsZP2NMo2FSZj9iBK38Ae6KZSiIyWTsOn/5LsT0V9Jg== X-Received: by 2002:a37:7043:: with SMTP id l64mr17730500qkc.358.1618931990202; Tue, 20 Apr 2021 08:19:50 -0700 (PDT) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id x85sm8233556qkb.44.2021.04.20.08.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 08:19:49 -0700 (PDT) Sender: Mark Johnston Date: Tue, 20 Apr 2021 11:19:50 -0400 From: Mark Johnston To: Warner Losh Cc: John Baldwin , Alex Richardson , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 73c14cc76b5f - main - Remove history.immutable from .arcconfig Message-ID: References: <202104131138.13DBcgrt085662@gitrepo.freebsd.org> <9e0d4574-bcad-b24c-78ad-c172d6d2c221@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FPnRW27Ldz4rtm X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=I6GZm8VX; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::731 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::731:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::731:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::731:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 15:19:52 -0000 On Tue, Apr 13, 2021 at 01:53:07PM -0600, Warner Losh wrote: > On Tue, Apr 13, 2021 at 9:23 AM John Baldwin wrote: > > > On 4/13/21 4:38 AM, Alex Richardson wrote: > > > The branch main has been updated by arichardson: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=73c14cc76b5f815c6b1bd93089ebafdd9269d343 > > > > > > commit 73c14cc76b5f815c6b1bd93089ebafdd9269d343 > > > Author: Alex Richardson > > > AuthorDate: 2021-04-13 11:36:24 +0000 > > > Commit: Alex Richardson > > > CommitDate: 2021-04-13 11:36:25 +0000 > > > > > > Remove history.immutable from .arcconfig > > > > > > The `history.immutable` setting prevents arcanist from updating > > > the commit messages with the Differential URL and therefore > > > makes updating patches awkward with a rebase workflow. > > > > > > In case this new behaviour is not wanted the old one can be restored > > > by running `arc set-config --local history.immutable true`. > > > > > > Test Plan: `arc diff --create HEAD^` adds the metadata now. > > > > > > Reviewed By: #phabric-admin, imp, lwhsu > > > Differential Revision: https://reviews.freebsd.org/D27971 > > > > FYI, this might break git arc since arc will now start rewriting commits > > rather than leaving them alone. Empirically, arc does not do this when git-arc is used. One of the options passed to arc diff --create apparently inhibits that behaviour, though I'm having trouble figuring out exactly why from reading the arcanist sources. > > If so, we can look use 'arc diff' > > with --head to turn off some of its magic. It would also avoid having > > 'git arc' have to adjust the working copy. > > > > I'd honestly rather have 'git arc create' stamp this in from the git go. > I really dislike having it not there until just before I go to commit. This is pretty easy to do if the commit is currently checked out. The question is what we should do when uploading a series of patches. Rewriting history would make child branches stale, so one would have to go through them and manually rebase --onto the rewritten branch. I'm not sure if this is a problem for most developers. In general it seems there is a preference for rewriting history to add reviewers and differential revision tags over the current approach, which avoids rewriting history. From owner-dev-commits-src-main@freebsd.org Tue Apr 20 15:24:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B13B35DB4A4; Tue, 20 Apr 2021 15:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPnYM4kbLz4s90; Tue, 20 Apr 2021 15:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 7D957D13B; Tue, 20 Apr 2021 15:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104200656.13K6uZPZ069494@gndrsh.dnsmgr.net> From: Jung-uk Kim Organization: FreeBSD.org Message-ID: <5dcdd0e7-2bb4-36ae-ec45-404e421cf180@FreeBSD.org> Date: Tue, 20 Apr 2021 11:24:54 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <202104200656.13K6uZPZ069494@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 15:24:55 -0000 On 21. 4. 20., Rodney W. Grimes wrote: >> The branch main has been updated by jkim: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d >> >> commit 686cf5468c4a85c2a6385cdbab2383900876a41d >> Author: Jung-uk Kim >> AuthorDate: 2021-04-19 18:20:51 +0000 >> Commit: Jung-uk Kim >> CommitDate: 2021-04-19 18:20:51 +0000 >> >> flex: Regen bootstrap files >> >> This also partially reverts r326025 (8a16b7a18f5d). I do not see any >> point of adding SPDX tag in generated file. > > The SPDX identifies the copyright that follows it, so please put this back. It is a generated file. If you really think it is necessary, you need to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. However, I don't see much sense in automatically adding BSD license in every generated file in the first place. In fact, I think it should not appear on generated file at all. It may say something along the line of "generated by flex" instead but IANAL. Jung-uk Kim From owner-dev-commits-src-main@freebsd.org Tue Apr 20 16:10:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE1EF5DD89B; Tue, 20 Apr 2021 16:10:07 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPpYW4Zjbz4vRF; Tue, 20 Apr 2021 16:10:07 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 13KG9wQo071569; Tue, 20 Apr 2021 09:09:58 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 13KG9w0e071568; Tue, 20 Apr 2021 09:09:58 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202104201609.13KG9w0e071568@gndrsh.dnsmgr.net> Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files In-Reply-To: <5dcdd0e7-2bb4-36ae-ec45-404e421cf180@FreeBSD.org> To: Jung-uk Kim Date: Tue, 20 Apr 2021 09:09:58 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FPpYW4Zjbz4vRF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:10:07 -0000 > On 21. 4. 20., Rodney W. Grimes wrote: > >> The branch main has been updated by jkim: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > >> > >> commit 686cf5468c4a85c2a6385cdbab2383900876a41d > >> Author: Jung-uk Kim > >> AuthorDate: 2021-04-19 18:20:51 +0000 > >> Commit: Jung-uk Kim > >> CommitDate: 2021-04-19 18:20:51 +0000 > >> > >> flex: Regen bootstrap files > >> > >> This also partially reverts r326025 (8a16b7a18f5d). I do not see any > >> point of adding SPDX tag in generated file. > > > > The SPDX identifies the copyright that follows it, so please put this back. > > It is a generated file. If you really think it is necessary, you need > to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. Just because it is a generated file does not change the fact that its contents are copyrighted. Leaving the copyright out at best defaults to Bern convention, so the fact of the mater is the contents is copyrighted, and it is best to explicitly state that it is. > > However, I don't see much sense in automatically adding BSD license in > every generated file in the first place. In fact, I think it should not > appear on generated file at all. It may say something along the line of > "generated by flex" instead but IANAL. Well, someone before you did see since in it, and hence put that SPDX in it. > Jung-uk Kim -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Tue Apr 20 16:24:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD6825DE3D5; Tue, 20 Apr 2021 16:24:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPptH5x9wz3CYK; Tue, 20 Apr 2021 16:24:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id A8D12DAED; Tue, 20 Apr 2021 16:24:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104201609.13KG9w0e071568@gndrsh.dnsmgr.net> From: Jung-uk Kim Organization: FreeBSD.org Message-ID: <782d3c7b-fb30-d013-0426-692cc1ead645@FreeBSD.org> Date: Tue, 20 Apr 2021 12:24:35 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <202104201609.13KG9w0e071568@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:24:39 -0000 On 21. 4. 20., Rodney W. Grimes wrote: >> On 21. 4. 20., Rodney W. Grimes wrote: >>>> The branch main has been updated by jkim: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d >>>> >>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d >>>> Author: Jung-uk Kim >>>> AuthorDate: 2021-04-19 18:20:51 +0000 >>>> Commit: Jung-uk Kim >>>> CommitDate: 2021-04-19 18:20:51 +0000 >>>> >>>> flex: Regen bootstrap files >>>> >>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see any >>>> point of adding SPDX tag in generated file. >>> >>> The SPDX identifies the copyright that follows it, so please put this back. >> >> It is a generated file. If you really think it is necessary, you need >> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. > > Just because it is a generated file does not change the fact that > its contents are copyrighted. Leaving the copyright out at best > defaults to Bern convention, so the fact of the mater is the contents > is copyrighted, and it is best to explicitly state that it is. Of course, it is copyrighted. My point was parse.y should have been patched, not the generated file, if necessary. >> However, I don't see much sense in automatically adding BSD license in >> every generated file in the first place. In fact, I think it should not >> appear on generated file at all. It may say something along the line of >> "generated by flex" instead but IANAL. > > Well, someone before you did see since in it, and hence put that SPDX in it. Let me put it in another way. Do we really want to tag contrib code? Jung-uk Kim From owner-dev-commits-src-main@freebsd.org Tue Apr 20 16:44:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBD6C5DF0A7 for ; Tue, 20 Apr 2021 16:44:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPqKL4kmHz3DQC for ; Tue, 20 Apr 2021 16:44:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id z2so2991913qkb.9 for ; Tue, 20 Apr 2021 09:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5/SHM99+BddDQYVEyl19MxIwMTYeUMC3oX+GURfGMYE=; b=me9QGcPgT32CAOXGJjmptK77AUj7K3+n2Y4Gg/6vSIOH8iOwveTaIKYgzyhT/d2upN hwRgNm2rRZrDteW38r+eBhXxt2DWlNZoQHafp84drB0Sf8TUntm0wP91WMXWlWGDMVhp vb74m0CyNB5uZJ59SHAs4qk8YWWakAdxA4ouCsqF2uGrin84F5qKE499WCOtrku+fou8 NuN8yFKr7nrpFZUc8oMEcgi4uMtV9OZWJ8mlu5bMY8LDk0Ddk/amgWUrx0q15fFR/Ogu BOIMqfnimNHOaewVaSUg4Dkgy/vV6mIcVmv5ME51mVc+eEXlOOG6s+PphvU5Q35lZkXT cadA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5/SHM99+BddDQYVEyl19MxIwMTYeUMC3oX+GURfGMYE=; b=UzioVdjuEfMImJwhxdJKylGMDjqqdAtPpxa8P1jVXg/Gk5B4JPsqMWH553sPY7uEpB g+Kdl+X/Gyq47I7prEtErhhx6xmnbMsE+ri4MjDynHOPEZ3ALgcJIuBVbI4v6/XKxSCh p37RT1PVlVmXEgzY49SZLSmtEad+e1HtXUi+oyynNepb0/7meZIUlCXw/h/7IEBO3fjf PlkEIcwJ0OVckZpvxSgvwL0ZdfEgTdzFrx/Bn7TmBGhA+Htr9vSg797+CWgDwOQbcKSS qBJzwAgTJuvEBytyrI8lIhp3sOv2SnKWm8kiLi3fu7hUGbjxnB8MamyEu7YJSqtfd+wc V8WQ== X-Gm-Message-State: AOAM533FRGp1VPoSUWKX5LhV5YWtNUX5HteQcPdx/SmgQ3i4zo/fr+LH /p3nVxZgwi1MO7vUe4HtnWUKp6ayc4JVcxaDN1aPmteHuvYJSw== X-Google-Smtp-Source: ABdhPJzgBRZhabBcYa4op9eaUL13/su08MVSO1V6aNnIqmqjMbWdYIJltEhCyUqjVDjSl9m2ObShI8n83NzTHw1EnCk= X-Received: by 2002:a37:6492:: with SMTP id y140mr9752605qkb.89.1618937077033; Tue, 20 Apr 2021 09:44:37 -0700 (PDT) MIME-Version: 1.0 References: <202104201609.13KG9w0e071568@gndrsh.dnsmgr.net> <782d3c7b-fb30-d013-0426-692cc1ead645@FreeBSD.org> In-Reply-To: <782d3c7b-fb30-d013-0426-692cc1ead645@FreeBSD.org> From: Warner Losh Date: Tue, 20 Apr 2021 10:44:26 -0600 Message-ID: Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files To: Jung-uk Kim Cc: "Rodney W. Grimes" , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FPqKL4kmHz3DQC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:44:38 -0000 On Tue, Apr 20, 2021 at 10:24 AM Jung-uk Kim wrote: > On 21. 4. 20., Rodney W. Grimes wrote: > >> On 21. 4. 20., Rodney W. Grimes wrote: > >>>> The branch main has been updated by jkim: > >>>> > >>>> URL: > https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > >>>> > >>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d > >>>> Author: Jung-uk Kim > >>>> AuthorDate: 2021-04-19 18:20:51 +0000 > >>>> Commit: Jung-uk Kim > >>>> CommitDate: 2021-04-19 18:20:51 +0000 > >>>> > >>>> flex: Regen bootstrap files > >>>> > >>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see > any > >>>> point of adding SPDX tag in generated file. > >>> > >>> The SPDX identifies the copyright that follows it, so please put this > back. > >> > >> It is a generated file. If you really think it is necessary, you need > >> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. > > > > Just because it is a generated file does not change the fact that > > its contents are copyrighted. Leaving the copyright out at best > > defaults to Bern convention, so the fact of the mater is the contents > > is copyrighted, and it is best to explicitly state that it is. > > Of course, it is copyrighted. My point was parse.y should have been > patched, not the generated file, if necessary. > Yes. It was a mistake to put it into the generated file. > >> However, I don't see much sense in automatically adding BSD license in > >> every generated file in the first place. In fact, I think it should not > >> appear on generated file at all. It may say something along the line of > >> "generated by flex" instead but IANAL. > > > > Well, someone before you did see since in it, and hence put that SPDX in > it. > > Let me put it in another way. Do we really want to tag contrib code? > I tend to agree. I tend to agree because the SPDX tags are generally only looked at in the source tree by existing tools. The generated code won't be looked at typically. We should work to get this upstream, imho. By itself, the SPDX tag is just information. There's no legal requirement in copyright law to have it. Current project policy states they are just informative, though there's some desire to have a good framework to allow code with just a copyright and a SDPX tag into the tree, so long as that framework can be used to know what the license is for any file in a clear and unambiguous way. Warner From owner-dev-commits-src-main@freebsd.org Tue Apr 20 16:58:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A15965DFBAB; Tue, 20 Apr 2021 16:58:44 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPqdc0dx3z3FFB; Tue, 20 Apr 2021 16:58:43 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 13KGwgkm071813; Tue, 20 Apr 2021 09:58:42 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 13KGwgnh071812; Tue, 20 Apr 2021 09:58:42 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202104201658.13KGwgnh071812@gndrsh.dnsmgr.net> Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files In-Reply-To: <782d3c7b-fb30-d013-0426-692cc1ead645@FreeBSD.org> To: Jung-uk Kim Date: Tue, 20 Apr 2021 09:58:42 -0700 (PDT) CC: rgrimes@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FPqdc0dx3z3FFB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:58:44 -0000 > On 21. 4. 20., Rodney W. Grimes wrote: > >> On 21. 4. 20., Rodney W. Grimes wrote: > >>>> The branch main has been updated by jkim: > >>>> > >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > >>>> > >>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d > >>>> Author: Jung-uk Kim > >>>> AuthorDate: 2021-04-19 18:20:51 +0000 > >>>> Commit: Jung-uk Kim > >>>> CommitDate: 2021-04-19 18:20:51 +0000 > >>>> > >>>> flex: Regen bootstrap files > >>>> > >>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see any > >>>> point of adding SPDX tag in generated file. > >>> > >>> The SPDX identifies the copyright that follows it, so please put this back. > >> > >> It is a generated file. If you really think it is necessary, you need > >> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. > > > > Just because it is a generated file does not change the fact that > > its contents are copyrighted. Leaving the copyright out at best > > defaults to Bern convention, so the fact of the mater is the contents > > is copyrighted, and it is best to explicitly state that it is. > > Of course, it is copyrighted. My point was parse.y should have been > patched, not the generated file, if necessary. My complaint was ABOUT the change to parse.y that REMOVED the SPDX tag. This is NOT a generated file, it IS the right place to put the SPDX, immediatly before the copyright it refers to. > >> However, I don't see much sense in automatically adding BSD license in > >> every generated file in the first place. In fact, I think it should not > >> appear on generated file at all. It may say something along the line of > >> "generated by flex" instead but IANAL. > > > > Well, someone before you did see since in it, and hence put that SPDX in it. > > Let me put it in another way. Do we really want to tag contrib code? Now that is a seperate discussion, but again, someone did infact decide to do this in the past. I am simply asking that the tag be put back. > Jung-uk Kim -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Tue Apr 20 17:02:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9509E5DFE5E; Tue, 20 Apr 2021 17:02:14 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPqjf1W70z3Fs9; Tue, 20 Apr 2021 17:02:13 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 13KH2B25071848; Tue, 20 Apr 2021 10:02:11 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 13KH2BEF071847; Tue, 20 Apr 2021 10:02:11 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202104201702.13KH2BEF071847@gndrsh.dnsmgr.net> Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files In-Reply-To: To: Warner Losh Date: Tue, 20 Apr 2021 10:02:11 -0700 (PDT) CC: Jung-uk Kim , "Rodney W. Grimes" , src-committers , "" , dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FPqjf1W70z3Fs9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:02:14 -0000 [ Charset UTF-8 unsupported, converting... ] > On Tue, Apr 20, 2021 at 10:24 AM Jung-uk Kim wrote: > > > On 21. 4. 20., Rodney W. Grimes wrote: > > >> On 21. 4. 20., Rodney W. Grimes wrote: > > >>>> The branch main has been updated by jkim: > > >>>> > > >>>> URL: > > https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > > >>>> > > >>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d > > >>>> Author: Jung-uk Kim > > >>>> AuthorDate: 2021-04-19 18:20:51 +0000 > > >>>> Commit: Jung-uk Kim > > >>>> CommitDate: 2021-04-19 18:20:51 +0000 > > >>>> > > >>>> flex: Regen bootstrap files > > >>>> > > >>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see > > any > > >>>> point of adding SPDX tag in generated file. > > >>> > > >>> The SPDX identifies the copyright that follows it, so please put this > > back. > > >> > > >> It is a generated file. If you really think it is necessary, you need > > >> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. > > > > > > Just because it is a generated file does not change the fact that > > > its contents are copyrighted. Leaving the copyright out at best > > > defaults to Bern convention, so the fact of the mater is the contents > > > is copyrighted, and it is best to explicitly state that it is. > > > > Of course, it is copyrighted. My point was parse.y should have been > > patched, not the generated file, if necessary. > > > > Yes. It was a mistake to put it into the generated file. He removed the SPDX from parse.y, now says that is the right place to put the SPDX. You agree. So can we have this undone? > > >> However, I don't see much sense in automatically adding BSD license in > > >> every generated file in the first place. In fact, I think it should not > > >> appear on generated file at all. It may say something along the line of > > >> "generated by flex" instead but IANAL. > > > > > > Well, someone before you did see since in it, and hence put that SPDX in > > it. > > > > Let me put it in another way. Do we really want to tag contrib code? > > > > I tend to agree. > > I tend to agree because the SPDX tags are generally only looked at in the > source tree by existing tools. The generated code won't be looked at > typically. > We should work to get this upstream, imho. Is parse.y not a source file? What am I missing? > By itself, the SPDX tag is just information. There's no legal requirement in > copyright law to have it. Current project policy states they are just > informative, > though there's some desire to have a good framework to allow code with > just a copyright and a SDPX tag into the tree, so long as that framework > can be used to know what the license is for any file in a clear and > unambiguous > way. > > Warner -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Tue Apr 20 17:06:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD8715E0514; Tue, 20 Apr 2021 17:06: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 4FPqpg5pk8z3Fb6; Tue, 20 Apr 2021 17:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA76D16A8F; Tue, 20 Apr 2021 17:06: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 13KH6Z4m039565; Tue, 20 Apr 2021 17:06:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KH6ZNk039564; Tue, 20 Apr 2021 17:06:35 GMT (envelope-from git) Date: Tue, 20 Apr 2021 17:06:35 GMT Message-Id: <202104201706.13KH6ZNk039564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 7b5053ce2296 - main - tcp_input: remove comments and assertions about tcpbinfo locking MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b5053ce2296e0fd96f162e308beb344b4ee654c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:06:35 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7b5053ce2296e0fd96f162e308beb344b4ee654c commit 7b5053ce2296e0fd96f162e308beb344b4ee654c Author: Gleb Smirnoff AuthorDate: 2021-04-16 21:39:19 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-20 17:02:20 +0000 tcp_input: remove comments and assertions about tcpbinfo locking They aren't valid since d40c0d47cd2. --- sys/netinet/tcp_input.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 8592f3313725..cac67024705e 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -984,16 +984,6 @@ findpcb: * or duplicate segments arriving late. If this segment was a * legitimate new connection attempt, the old INPCB gets removed and * we can try again to find a listening socket. - * - * At this point, due to earlier optimism, we may hold only an inpcb - * lock, and not the inpcbinfo write lock. If so, we need to try to - * acquire it, or if that fails, acquire a reference on the inpcb, - * drop all locks, acquire a global write lock, and then re-acquire - * the inpcb lock. We may at that point discover that another thread - * has tried to free the inpcb, in which case we need to loop back - * and try to find a new inpcb to deliver to. - * - * XXXRW: It may be time to rethink timewait locking. */ if (inp->inp_flags & INP_TIMEWAIT) { tcp_dooptions(&to, optp, optlen, @@ -1361,7 +1351,6 @@ tfo_socket_result: * Entry added to syncache and mbuf consumed. * Only the listen socket is unlocked by syncache_add(). */ - INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); return (IPPROTO_DONE); } else if (tp->t_state == TCPS_LISTEN) { /* @@ -1414,7 +1403,6 @@ dropunlock: INP_UNLOCK(inp); drop: - INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); if (s != NULL) free(s, M_TCPLOG); if (m != NULL) From owner-dev-commits-src-main@freebsd.org Tue Apr 20 17:06:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FE3A5E04B9; Tue, 20 Apr 2021 17:06: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 4FPqpj01vHz3G0l; Tue, 20 Apr 2021 17:06:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEC39166E9; Tue, 20 Apr 2021 17:06: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 13KH6ajK039586; Tue, 20 Apr 2021 17:06:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KH6aMh039585; Tue, 20 Apr 2021 17:06:36 GMT (envelope-from git) Date: Tue, 20 Apr 2021 17:06:36 GMT Message-Id: <202104201706.13KH6aMh039585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1db08fbe3ffa - main - tcp_input: always request read-locking of PCB for any pure SYN segment. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1db08fbe3ffad1be59c9449628ee867b50f6be6f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:06:37 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1db08fbe3ffad1be59c9449628ee867b50f6be6f commit 1db08fbe3ffad1be59c9449628ee867b50f6be6f Author: Gleb Smirnoff AuthorDate: 2021-04-16 21:56:14 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-20 17:02:20 +0000 tcp_input: always request read-locking of PCB for any pure SYN segment. This is further rework of 08d9c920275. Now we carry the knowledge of lock type all the way through tcp_input() and also into tcp_twcheck(). Ideally the rlocking for pure SYNs should propagate all the way into the alternative TCP stacks, but not yet today. This should close a race when socket is bind(2)-ed but not yet listen(2)-ed and a SYN-packet arrives racing with listen(2), discovered recently by pho@. --- sys/netinet/in_pcb.c | 14 ++++---------- sys/netinet/in_pcb.h | 3 +-- sys/netinet/tcp_input.c | 16 +++++++++++++--- sys/netinet/tcp_timewait.c | 29 ++++++++++++++++++++++++----- sys/netinet6/in6_pcb.c | 13 +++---------- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 43cd469e0fcf..43eb31c4e31d 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2524,12 +2524,6 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, INP_WLOCK(inp); } else if (lookupflags & INPLOOKUP_RLOCKPCB) { INP_RLOCK(inp); - } else if (lookupflags & INPLOOKUP_RLOCKLISTEN) { - if (inp->inp_socket != NULL && - SOLISTENING(inp->inp_socket)) - INP_RLOCK(inp); - else - INP_WLOCK(inp); } else panic("%s: locking bug", __func__); if (__predict_false(inp->inp_flags2 & INP_FREED)) { @@ -2557,8 +2551,8 @@ in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB | - INPLOOKUP_RLOCKLISTEN)) != 0, ("%s: LOCKPCB not set", __func__)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); /* * When not using RSS, use connection groups in preference to the @@ -2593,8 +2587,8 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr, KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB | - INPLOOKUP_RLOCKLISTEN)) != 0, ("%s: LOCKPCB not set", __func__)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); #ifdef PCBGROUP /* diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 4959fc238dfb..923c5ba4edff 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -761,10 +761,9 @@ int inp_so_options(const struct inpcb *inp); #define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */ #define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */ #define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */ -#define INPLOOKUP_RLOCKLISTEN 0x00000008 /* Rlock if listening, W if !.*/ #define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ - INPLOOKUP_WLOCKPCB | INPLOOKUP_RLOCKLISTEN) + INPLOOKUP_WLOCKPCB) #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index cac67024705e..9d45c5ab42dc 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -834,11 +834,12 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); /* - * For initial SYN packets arriving on listening socket, - * we don't need write lock. + * For initial SYN packets we don't need write lock on matching + * PCB, be it a listening one or a synchronized one. The packet + * shall not modify its state. */ lookupflag = (thflags & (TH_ACK|TH_SYN)) == TH_SYN ? - INPLOOKUP_RLOCKLISTEN : INPLOOKUP_WLOCKPCB; + INPLOOKUP_RLOCKPCB : INPLOOKUP_WLOCKPCB; findpcb: #ifdef INET6 if (isipv6 && fwd_tag != NULL) { @@ -1380,7 +1381,16 @@ tfo_socket_result: * Segment belongs to a connection in SYN_SENT, ESTABLISHED or later * state. tcp_do_segment() always consumes the mbuf chain, unlocks * the inpcb, and unlocks pcbinfo. + * + * XXXGL: in case of a pure SYN arriving on existing connection + * TCP stacks won't need to modify the PCB, they would either drop + * the segment silently, or send a challenge ACK. However, we try + * to upgrade the lock, because calling convention for stacks is + * write-lock on PCB. If upgrade fails, drop the SYN. */ + if (lookupflag == INPLOOKUP_RLOCKPCB && INP_TRY_UPGRADE(inp) == 0) + goto dropunlock; + tp->t_fb->tfb_tcp_do_segment(m, th, so, tp, drop_hdrlen, tlen, iptos); return (IPPROTO_DONE); diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index b62386ddca05..695ec4413ac9 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -377,7 +377,9 @@ tcp_twstart(struct tcpcb *tp) /* * Returns 1 if the TIME_WAIT state was killed and we should start over, * looking for a pcb in the listen state. Returns 0 otherwise. - * It be called with to == NULL only for pure SYN-segments. + * + * For pure SYN-segments the PCB shall be read-locked and the tcpopt pointer + * may be NULL. For the rest write-lock and valid tcpopt. */ int tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, @@ -388,7 +390,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, tcp_seq seq; NET_EPOCH_ASSERT(); - INP_WLOCK_ASSERT(inp); + INP_LOCK_ASSERT(inp); /* * XXXRW: Time wait state for inpcb has been recycled, but inpcb is @@ -401,8 +403,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, goto drop; thflags = th->th_flags; - KASSERT(to != NULL || (thflags & (TH_SYN | TH_ACK)) == TH_SYN, - ("tcp_twcheck: called without options on a non-SYN segment")); +#ifdef INVARIANTS + if ((thflags & (TH_SYN | TH_ACK)) == TH_SYN) + INP_RLOCK_ASSERT(inp); + else { + INP_WLOCK_ASSERT(inp); + KASSERT(to != NULL, + ("%s: called without options on a non-SYN segment", + __func__)); + } +#endif /* * NOTE: for FIN_WAIT_2 (to be added later), @@ -442,6 +452,13 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, * Allow UDP port number changes in this case. */ if ((thflags & TH_SYN) && SEQ_GT(th->th_seq, tw->rcv_nxt)) { + /* + * In case we can't upgrade our lock just pretend we have + * lost this packet. + */ + if (((thflags & (TH_SYN | TH_ACK)) == TH_SYN) && + INP_TRY_UPGRADE(inp) == 0) + goto drop; tcp_twclose(tw, 0); return (1); } @@ -471,6 +488,8 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, if ((thflags & TH_ACK) == 0) goto drop; + INP_WLOCK_ASSERT(inp); + /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop @@ -503,7 +522,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, drop: TCP_PROBE5(receive, NULL, NULL, m, NULL, th); dropnoprobe: - INP_WUNLOCK(inp); + INP_UNLOCK(inp); m_freem(m); return (0); } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 96be795d5757..4cdd2a8f152f 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1299,12 +1299,6 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, INP_WLOCK(inp); } else if (lookupflags & INPLOOKUP_RLOCKPCB) { INP_RLOCK(inp); - } else if (lookupflags & INPLOOKUP_RLOCKLISTEN) { - if (inp->inp_socket != NULL && - SOLISTENING(inp->inp_socket)) - INP_RLOCK(inp); - else - INP_WLOCK(inp); } else panic("%s: locking bug", __func__); if (__predict_false(inp->inp_flags2 & INP_FREED)) { @@ -1331,8 +1325,8 @@ in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB | - INPLOOKUP_RLOCKLISTEN)) != 0, ("%s: LOCKPCB not set", __func__)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); /* * When not using RSS, use connection groups in preference to the @@ -1367,8 +1361,7 @@ in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB | - INPLOOKUP_RLOCKLISTEN)) != 0, + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, ("%s: LOCKPCB not set", __func__)); #ifdef PCBGROUP From owner-dev-commits-src-main@freebsd.org Tue Apr 20 17:06:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E8285E043B; Tue, 20 Apr 2021 17:06: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 4FPqpk16J1z3G2H; Tue, 20 Apr 2021 17:06:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F348016A90; Tue, 20 Apr 2021 17:06: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 13KH6bWY039607; Tue, 20 Apr 2021 17:06:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KH6b2Y039606; Tue, 20 Apr 2021 17:06:37 GMT (envelope-from git) Date: Tue, 20 Apr 2021 17:06:37 GMT Message-Id: <202104201706.13KH6b2Y039606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d554522f6e68 - main - tcp_hostcache: use SMR for lookups, mutex(9) for updates. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d554522f6e687a365ebe935010298024fa2c1c9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:06:38 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d554522f6e687a365ebe935010298024fa2c1c9d commit d554522f6e687a365ebe935010298024fa2c1c9d Author: Gleb Smirnoff AuthorDate: 2021-03-22 22:32:57 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-20 17:02:20 +0000 tcp_hostcache: use SMR for lookups, mutex(9) for updates. In certain cases, e.g. a SYN-flood from a limited set of hosts, the TCP hostcache becomes the main contention point. To solve that, this change introduces lockless lookups on the hostcache. The cache remains a hash, however buckets are now CK_SLIST. For updates a bucket mutex is obtained, for read an SMR section is entered. Reviewed by: markj, rscheff Differential revision: https://reviews.freebsd.org/D29729 --- sys/netinet/tcp_hostcache.c | 463 ++++++++++++++++++++++---------------------- 1 file changed, 233 insertions(+), 230 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index baefa55fd076..6d05bfc667e7 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG + * Copyright (c) 2021 Gleb Smirnoff * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,18 +46,18 @@ * more lightwight and only carries information related to packet forwarding. * * tcp_hostcache is designed for multiple concurrent access in SMP - * environments and high contention. All bucket rows have their own lock and - * thus multiple lookups and modifies can be done at the same time as long as - * they are in different bucket rows. If a request for insertion of a new - * record can't be satisfied, it simply returns an empty structure. Nobody - * and nothing outside of tcp_hostcache.c will ever point directly to any - * entry in the tcp_hostcache. All communication is done in an - * object-oriented way and only functions of tcp_hostcache will manipulate - * hostcache entries. Otherwise, we are unable to achieve good behaviour in - * concurrent access situations. Since tcp_hostcache is only caching - * information, there are no fatal consequences if we either can't satisfy - * any particular request or have to drop/overwrite an existing entry because - * of bucket limit memory constrains. + * environments and high contention. It is a straight hash. Each bucket row + * is protected by its own lock for modification. Readers are protected by + * SMR. This puts certain restrictions on writers, e.g. a writer shall only + * insert a fully populated entry into a row. Writer can't reuse least used + * entry if a hash is full. Value updates for an entry shall be atomic. + * + * TCP stack(s) communication with tcp_hostcache() is done via KBI functions + * tcp_hc_*() and the hc_metrics_lite structure. + * + * Since tcp_hostcache is only caching information, there are no fatal + * consequences if we either can't allocate a new entry or have to drop + * an existing entry, or return somewhat stale information. */ /* @@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -92,18 +94,15 @@ __FBSDID("$FreeBSD$"); #include -TAILQ_HEAD(hc_qhead, hc_metrics); - struct hc_head { - struct hc_qhead hch_bucket; + CK_SLIST_HEAD(hc_qhead, hc_metrics) hch_bucket; u_int hch_length; struct mtx hch_mtx; }; struct hc_metrics { /* housekeeping */ - TAILQ_ENTRY(hc_metrics) rmx_q; - struct hc_head *rmx_head; /* head of bucket tail queue */ + CK_SLIST_ENTRY(hc_metrics) rmx_q; struct in_addr ip4; /* IP address */ struct in6_addr ip6; /* IP6 address */ uint32_t ip6_zoneid; /* IPv6 scope zone id */ @@ -126,6 +125,7 @@ struct hc_metrics { struct tcp_hostcache { struct hc_head *hashbase; uma_zone_t zone; + smr_t smr; u_int hashsize; u_int hashmask; u_int hashsalt; @@ -149,8 +149,7 @@ VNET_DEFINE_STATIC(struct tcp_hostcache, tcp_hostcache); VNET_DEFINE_STATIC(struct callout, tcp_hc_callout); #define V_tcp_hc_callout VNET(tcp_hc_callout) -static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *, bool); -static struct hc_metrics *tcp_hc_insert(struct in_conninfo *); +static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS); @@ -213,14 +212,13 @@ SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, purgenow, static MALLOC_DEFINE(M_HOSTCACHE, "hostcache", "TCP hostcache"); /* Use jenkins_hash32(), as in other parts of the tcp stack */ -#define HOSTCACHE_HASH(ip) \ - (jenkins_hash32((uint32_t *)(ip), 1, V_tcp_hostcache.hashsalt) & \ - V_tcp_hostcache.hashmask) - -#define HOSTCACHE_HASH6(ip6) \ - (jenkins_hash32((uint32_t *)&((ip6)->s6_addr32[0]), 4, \ - V_tcp_hostcache.hashsalt) & \ - V_tcp_hostcache.hashmask) +#define HOSTCACHE_HASH(inc) \ + ((inc)->inc_flags & INC_ISIPV6) ? \ + (jenkins_hash32((inc)->inc6_faddr.s6_addr32, 4, \ + V_tcp_hostcache.hashsalt) & V_tcp_hostcache.hashmask) \ + : \ + (jenkins_hash32(&(inc)->inc_faddr.s_addr, 1, \ + V_tcp_hostcache.hashsalt) & V_tcp_hostcache.hashmask) #define THC_LOCK(h) mtx_lock(&(h)->hch_mtx) #define THC_UNLOCK(h) mtx_unlock(&(h)->hch_mtx) @@ -270,7 +268,7 @@ tcp_hc_init(void) * Initialize the hash buckets. */ for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - TAILQ_INIT(&V_tcp_hostcache.hashbase[i].hch_bucket); + CK_SLIST_INIT(&V_tcp_hostcache.hashbase[i].hch_bucket); V_tcp_hostcache.hashbase[i].hch_length = 0; mtx_init(&V_tcp_hostcache.hashbase[i].hch_mtx, "tcp_hc_entry", NULL, MTX_DEF); @@ -281,8 +279,9 @@ tcp_hc_init(void) */ V_tcp_hostcache.zone = uma_zcreate("hostcache", sizeof(struct hc_metrics), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_SMR); uma_zone_set_max(V_tcp_hostcache.zone, V_tcp_hostcache.cache_limit); + V_tcp_hostcache.smr = uma_zone_get_smr(V_tcp_hostcache.zone); /* * Set up periodic cache cleanup. @@ -313,169 +312,58 @@ tcp_hc_destroy(void) #endif /* - * Internal function: look up an entry in the hostcache or return NULL. - * - * If an entry has been returned, the caller becomes responsible for - * unlocking the bucket row after he is done reading/modifying the entry. + * Internal function: compare cache entry to a connection. */ -static struct hc_metrics * -tcp_hc_lookup(struct in_conninfo *inc, bool update) +static bool +tcp_hc_cmp(struct hc_metrics *hc_entry, struct in_conninfo *inc) { - int hash; - struct hc_head *hc_head; - struct hc_metrics *hc_entry; - - KASSERT(inc != NULL, ("%s: NULL in_conninfo", __func__)); - - /* - * Hash the foreign ip address. - */ - if (inc->inc_flags & INC_ISIPV6) - hash = HOSTCACHE_HASH6(&inc->inc6_faddr); - else - hash = HOSTCACHE_HASH(&inc->inc_faddr); - hc_head = &V_tcp_hostcache.hashbase[hash]; - - /* - * Acquire lock for this bucket row; we release the lock if we don't - * find an entry, otherwise the caller has to unlock after he is - * done. - */ - THC_LOCK(hc_head); - - /* - * Iterate through entries in bucket row looking for a match. - */ - TAILQ_FOREACH(hc_entry, &hc_head->hch_bucket, rmx_q) { - if (inc->inc_flags & INC_ISIPV6) { - /* XXX: check ip6_zoneid */ - if (memcmp(&inc->inc6_faddr, &hc_entry->ip6, - sizeof(inc->inc6_faddr)) == 0) - goto found; - } else { - if (memcmp(&inc->inc_faddr, &hc_entry->ip4, - sizeof(inc->inc_faddr)) == 0) - goto found; - } + if (inc->inc_flags & INC_ISIPV6) { + /* XXX: check ip6_zoneid */ + if (memcmp(&inc->inc6_faddr, &hc_entry->ip6, + sizeof(inc->inc6_faddr)) == 0) + return (true); + } else { + if (memcmp(&inc->inc_faddr, &hc_entry->ip4, + sizeof(inc->inc_faddr)) == 0) + return (true); } - /* - * We were unsuccessful and didn't find anything. - */ - THC_UNLOCK(hc_head); - return (NULL); - -found: -#ifdef TCP_HC_COUNTERS - if (update) - hc_entry->rmx_updates++; - else - hc_entry->rmx_hits++; -#endif - hc_entry->rmx_expire = V_tcp_hostcache.expire; - - return (hc_entry); + return (false); } /* - * Internal function: insert an entry into the hostcache or return NULL if - * unable to allocate a new one. - * - * If an entry has been returned, the caller becomes responsible for - * unlocking the bucket row after he is done reading/modifying the entry. + * Internal function: look up an entry in the hostcache for read. + * On success returns in SMR section. */ static struct hc_metrics * -tcp_hc_insert(struct in_conninfo *inc) +tcp_hc_lookup(struct in_conninfo *inc) { - int hash; struct hc_head *hc_head; struct hc_metrics *hc_entry; KASSERT(inc != NULL, ("%s: NULL in_conninfo", __func__)); - /* - * Hash the foreign ip address. - */ - if (inc->inc_flags & INC_ISIPV6) - hash = HOSTCACHE_HASH6(&inc->inc6_faddr); - else - hash = HOSTCACHE_HASH(&inc->inc_faddr); - - hc_head = &V_tcp_hostcache.hashbase[hash]; + hc_head = &V_tcp_hostcache.hashbase[HOSTCACHE_HASH(inc)]; /* - * Acquire lock for this bucket row; we release the lock if we don't - * find an entry, otherwise the caller has to unlock after he is - * done. - */ - THC_LOCK(hc_head); - - /* - * If the bucket limit is reached, reuse the least-used element. + * Iterate through entries in bucket row looking for a match. */ - if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || - atomic_load_int(&V_tcp_hostcache.cache_count) >= V_tcp_hostcache.cache_limit) { - hc_entry = TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); - /* - * At first we were dropping the last element, just to - * reacquire it in the next two lines again, which isn't very - * efficient. Instead just reuse the least used element. - * We may drop something that is still "in-use" but we can be - * "lossy". - * Just give up if this bucket row is empty and we don't have - * anything to replace. - */ - if (hc_entry == NULL) { - THC_UNLOCK(hc_head); - return (NULL); - } - TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); - KASSERT(V_tcp_hostcache.hashbase[hash].hch_length > 0 && - V_tcp_hostcache.hashbase[hash].hch_length <= - V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket length range violated at %u: %u", - hash, V_tcp_hostcache.hashbase[hash].hch_length)); - V_tcp_hostcache.hashbase[hash].hch_length--; - atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); - TCPSTAT_INC(tcps_hc_bucketoverflow); -#if 0 - uma_zfree(V_tcp_hostcache.zone, hc_entry); + smr_enter(V_tcp_hostcache.smr); + CK_SLIST_FOREACH(hc_entry, &hc_head->hch_bucket, rmx_q) + if (tcp_hc_cmp(hc_entry, inc)) + break; + + if (hc_entry != NULL) { + if (atomic_load_int(&hc_entry->rmx_expire) != + V_tcp_hostcache.expire) + atomic_store_int(&hc_entry->rmx_expire, + V_tcp_hostcache.expire); +#ifdef TCP_HC_COUNTERS + hc_entry->rmx_hits++; #endif - } else { - /* - * Allocate a new entry, or balk if not possible. - */ - hc_entry = uma_zalloc(V_tcp_hostcache.zone, M_NOWAIT); - if (hc_entry == NULL) { - THC_UNLOCK(hc_head); - return (NULL); - } - } - - /* - * Initialize basic information of hostcache entry. - */ - bzero(hc_entry, sizeof(*hc_entry)); - if (inc->inc_flags & INC_ISIPV6) { - hc_entry->ip6 = inc->inc6_faddr; - hc_entry->ip6_zoneid = inc->inc6_zoneid; } else - hc_entry->ip4 = inc->inc_faddr; - hc_entry->rmx_head = hc_head; - hc_entry->rmx_expire = V_tcp_hostcache.expire; - - /* - * Put it upfront. - */ - TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); - V_tcp_hostcache.hashbase[hash].hch_length++; - KASSERT(V_tcp_hostcache.hashbase[hash].hch_length <= - V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket length too high at %u: %u", - hash, V_tcp_hostcache.hashbase[hash].hch_length)); - atomic_add_int(&V_tcp_hostcache.cache_count, 1); - TCPSTAT_INC(tcps_hc_added); + smr_exit(V_tcp_hostcache.smr); return (hc_entry); } @@ -498,7 +386,7 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) /* * Find the right bucket. */ - hc_entry = tcp_hc_lookup(inc, false); + hc_entry = tcp_hc_lookup(inc); /* * If we don't have an existing object. @@ -508,18 +396,15 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) return; } - hc_metrics_lite->rmx_mtu = hc_entry->rmx_mtu; - hc_metrics_lite->rmx_ssthresh = hc_entry->rmx_ssthresh; - hc_metrics_lite->rmx_rtt = hc_entry->rmx_rtt; - hc_metrics_lite->rmx_rttvar = hc_entry->rmx_rttvar; - hc_metrics_lite->rmx_cwnd = hc_entry->rmx_cwnd; - hc_metrics_lite->rmx_sendpipe = hc_entry->rmx_sendpipe; - hc_metrics_lite->rmx_recvpipe = hc_entry->rmx_recvpipe; + hc_metrics_lite->rmx_mtu = atomic_load_32(&hc_entry->rmx_mtu); + hc_metrics_lite->rmx_ssthresh = atomic_load_32(&hc_entry->rmx_ssthresh); + hc_metrics_lite->rmx_rtt = atomic_load_32(&hc_entry->rmx_rtt); + hc_metrics_lite->rmx_rttvar = atomic_load_32(&hc_entry->rmx_rttvar); + hc_metrics_lite->rmx_cwnd = atomic_load_32(&hc_entry->rmx_cwnd); + hc_metrics_lite->rmx_sendpipe = atomic_load_32(&hc_entry->rmx_sendpipe); + hc_metrics_lite->rmx_recvpipe = atomic_load_32(&hc_entry->rmx_recvpipe); - /* - * Unlock bucket row. - */ - THC_UNLOCK(hc_entry->rmx_head); + smr_exit(V_tcp_hostcache.smr); } /* @@ -536,13 +421,14 @@ tcp_hc_getmtu(struct in_conninfo *inc) if (!V_tcp_use_hostcache) return (0); - hc_entry = tcp_hc_lookup(inc, false); + hc_entry = tcp_hc_lookup(inc); if (hc_entry == NULL) { return (0); } - mtu = hc_entry->rmx_mtu; - THC_UNLOCK(hc_entry->rmx_head); + mtu = atomic_load_32(&hc_entry->rmx_mtu); + smr_exit(V_tcp_hostcache.smr); + return (mtu); } @@ -565,75 +451,175 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) void tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) { - struct hc_metrics *hc_entry; + struct hc_head *hc_head; + struct hc_metrics *hc_entry, *hc_prev; + uint32_t v; + bool new; if (!V_tcp_use_hostcache) return; - hc_entry = tcp_hc_lookup(inc, true); - if (hc_entry == NULL) { - hc_entry = tcp_hc_insert(inc); - if (hc_entry == NULL) + hc_head = &V_tcp_hostcache.hashbase[HOSTCACHE_HASH(inc)]; + hc_prev = NULL; + + THC_LOCK(hc_head); + CK_SLIST_FOREACH(hc_entry, &hc_head->hch_bucket, rmx_q) { + if (tcp_hc_cmp(hc_entry, inc)) + break; + if (CK_SLIST_NEXT(hc_entry, rmx_q) != NULL) + hc_prev = hc_entry; + } + + if (hc_entry != NULL) { + if (atomic_load_int(&hc_entry->rmx_expire) != + V_tcp_hostcache.expire) + atomic_store_int(&hc_entry->rmx_expire, + V_tcp_hostcache.expire); +#ifdef TCP_HC_COUNTERS + hc_entry->rmx_updates++; +#endif + new = false; + } else { + /* + * Try to allocate a new entry. If the bucket limit is + * reached, delete the least-used element, located at the end + * of the CK_SLIST. During lookup we saved the pointer to + * the second to last element, in case if list has at least 2 + * elements. This will allow to delete last element without + * extra traversal. + * + * Give up if the row is empty. + */ + if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || + atomic_load_int(&V_tcp_hostcache.cache_count) >= + V_tcp_hostcache.cache_limit) { + if (hc_prev != NULL) { + hc_entry = CK_SLIST_NEXT(hc_prev, rmx_q); + KASSERT(CK_SLIST_NEXT(hc_entry, rmx_q) == NULL, + ("%s: %p is not one to last", + __func__, hc_prev)); + CK_SLIST_REMOVE_AFTER(hc_prev, rmx_q); + } else if ((hc_entry = + CK_SLIST_FIRST(&hc_head->hch_bucket)) != NULL) { + KASSERT(CK_SLIST_NEXT(hc_entry, rmx_q) == NULL, + ("%s: %p is not the only element", + __func__, hc_entry)); + CK_SLIST_REMOVE_HEAD(&hc_head->hch_bucket, + rmx_q); + } else { + THC_UNLOCK(hc_head); + return; + } + KASSERT(hc_head->hch_length > 0 && + hc_head->hch_length <= V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length violated at %p", + hc_head)); + hc_head->hch_length--; + atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); + TCPSTAT_INC(tcps_hc_bucketoverflow); + uma_zfree_smr(V_tcp_hostcache.zone, hc_entry); + } + + /* + * Allocate a new entry, or balk if not possible. + */ + hc_entry = uma_zalloc_smr(V_tcp_hostcache.zone, M_NOWAIT); + if (hc_entry == NULL) { + THC_UNLOCK(hc_head); return; + } + + /* + * Initialize basic information of hostcache entry. + */ + bzero(hc_entry, sizeof(*hc_entry)); + if (inc->inc_flags & INC_ISIPV6) { + hc_entry->ip6 = inc->inc6_faddr; + hc_entry->ip6_zoneid = inc->inc6_zoneid; + } else + hc_entry->ip4 = inc->inc_faddr; + hc_entry->rmx_expire = V_tcp_hostcache.expire; + new = true; } + /* + * Fill in data. Use atomics, since an existing entry is + * accessible by readers in SMR section. + */ if (hcml->rmx_mtu != 0) { - hc_entry->rmx_mtu = hcml->rmx_mtu; + atomic_store_32(&hc_entry->rmx_mtu, hcml->rmx_mtu); } if (hcml->rmx_rtt != 0) { if (hc_entry->rmx_rtt == 0) - hc_entry->rmx_rtt = hcml->rmx_rtt; + v = hcml->rmx_rtt; else - hc_entry->rmx_rtt = ((uint64_t)hc_entry->rmx_rtt + + v = ((uint64_t)hc_entry->rmx_rtt + (uint64_t)hcml->rmx_rtt) / 2; + atomic_store_32(&hc_entry->rmx_rtt, v); TCPSTAT_INC(tcps_cachedrtt); } if (hcml->rmx_rttvar != 0) { - if (hc_entry->rmx_rttvar == 0) - hc_entry->rmx_rttvar = hcml->rmx_rttvar; + if (hc_entry->rmx_rttvar == 0) + v = hcml->rmx_rttvar; else - hc_entry->rmx_rttvar = ((uint64_t)hc_entry->rmx_rttvar + + v = ((uint64_t)hc_entry->rmx_rttvar + (uint64_t)hcml->rmx_rttvar) / 2; + atomic_store_32(&hc_entry->rmx_rttvar, v); TCPSTAT_INC(tcps_cachedrttvar); } if (hcml->rmx_ssthresh != 0) { if (hc_entry->rmx_ssthresh == 0) - hc_entry->rmx_ssthresh = hcml->rmx_ssthresh; + v = hcml->rmx_ssthresh; else - hc_entry->rmx_ssthresh = - (hc_entry->rmx_ssthresh + hcml->rmx_ssthresh) / 2; + v = (hc_entry->rmx_ssthresh + hcml->rmx_ssthresh) / 2; + atomic_store_32(&hc_entry->rmx_ssthresh, v); TCPSTAT_INC(tcps_cachedssthresh); } if (hcml->rmx_cwnd != 0) { if (hc_entry->rmx_cwnd == 0) - hc_entry->rmx_cwnd = hcml->rmx_cwnd; + v = hcml->rmx_cwnd; else - hc_entry->rmx_cwnd = ((uint64_t)hc_entry->rmx_cwnd + + v = ((uint64_t)hc_entry->rmx_cwnd + (uint64_t)hcml->rmx_cwnd) / 2; + atomic_store_32(&hc_entry->rmx_cwnd, v); /* TCPSTAT_INC(tcps_cachedcwnd); */ } if (hcml->rmx_sendpipe != 0) { if (hc_entry->rmx_sendpipe == 0) - hc_entry->rmx_sendpipe = hcml->rmx_sendpipe; + v = hcml->rmx_sendpipe; else - hc_entry->rmx_sendpipe = - ((uint64_t)hc_entry->rmx_sendpipe + + v = ((uint64_t)hc_entry->rmx_sendpipe + (uint64_t)hcml->rmx_sendpipe) /2; + atomic_store_32(&hc_entry->rmx_sendpipe, v); /* TCPSTAT_INC(tcps_cachedsendpipe); */ } if (hcml->rmx_recvpipe != 0) { if (hc_entry->rmx_recvpipe == 0) - hc_entry->rmx_recvpipe = hcml->rmx_recvpipe; + v = hcml->rmx_recvpipe; else - hc_entry->rmx_recvpipe = - ((uint64_t)hc_entry->rmx_recvpipe + + v = ((uint64_t)hc_entry->rmx_recvpipe + (uint64_t)hcml->rmx_recvpipe) /2; + atomic_store_32(&hc_entry->rmx_recvpipe, v); /* TCPSTAT_INC(tcps_cachedrecvpipe); */ } - TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); - TAILQ_INSERT_HEAD(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); - THC_UNLOCK(hc_entry->rmx_head); + /* + * Put it upfront. + */ + if (new) { + CK_SLIST_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); + hc_head->hch_length++; + KASSERT(hc_head->hch_length <= V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length too high at %p", hc_head)); + atomic_add_int(&V_tcp_hostcache.cache_count, 1); + TCPSTAT_INC(tcps_hc_added); + } else if (hc_entry != CK_SLIST_FIRST(&hc_head->hch_bucket)) { + KASSERT(CK_SLIST_NEXT(hc_prev, rmx_q) == hc_entry, + ("%s: %p next is not %p", __func__, hc_prev, hc_entry)); + CK_SLIST_REMOVE_AFTER(hc_prev, rmx_q); + CK_SLIST_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); + } + THC_UNLOCK(hc_head); } /* @@ -683,8 +669,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) #define msec(u) (((u) + 500) / 1000) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { THC_LOCK(&V_tcp_hostcache.hashbase[i]); - TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, - rmx_q) { + CK_SLIST_FOREACH(hc_entry, + &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { sbuf_printf(&sb, "%-15s %5u %8u %6lums %6lums %8u %8u %8u " #ifdef TCP_HC_COUNTERS @@ -770,29 +756,46 @@ sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS) static void tcp_hc_purge_internal(int all) { - struct hc_metrics *hc_entry, *hc_next; + struct hc_head *head; + struct hc_metrics *hc_entry, *hc_next, *hc_prev; int i; for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - THC_LOCK(&V_tcp_hostcache.hashbase[i]); - TAILQ_FOREACH_SAFE(hc_entry, - &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { - KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && - V_tcp_hostcache.hashbase[i].hch_length <= + head = &V_tcp_hostcache.hashbase[i]; + hc_prev = NULL; + THC_LOCK(head); + CK_SLIST_FOREACH_SAFE(hc_entry, &head->hch_bucket, rmx_q, + hc_next) { + KASSERT(head->hch_length > 0 && head->hch_length <= V_tcp_hostcache.bucket_limit, ("tcp_hostcache: " - "bucket length out of range at %u: %u", - i, V_tcp_hostcache.hashbase[i].hch_length)); - if (all || hc_entry->rmx_expire <= 0) { - TAILQ_REMOVE( - &V_tcp_hostcache.hashbase[i].hch_bucket, - hc_entry, rmx_q); - uma_zfree(V_tcp_hostcache.zone, hc_entry); - V_tcp_hostcache.hashbase[i].hch_length--; + "bucket length out of range at %u: %u", i, + head->hch_length)); + if (all || + atomic_load_int(&hc_entry->rmx_expire) <= 0) { + if (hc_prev != NULL) { + KASSERT(hc_entry == + CK_SLIST_NEXT(hc_prev, rmx_q), + ("%s: %p is not next to %p", + __func__, hc_entry, hc_prev)); + CK_SLIST_REMOVE_AFTER(hc_prev, rmx_q); + } else { + KASSERT(hc_entry == + CK_SLIST_FIRST(&head->hch_bucket), + ("%s: %p is not first", + __func__, hc_entry)); + CK_SLIST_REMOVE_HEAD(&head->hch_bucket, + rmx_q); + } + uma_zfree_smr(V_tcp_hostcache.zone, hc_entry); + head->hch_length--; atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); - } else - hc_entry->rmx_expire -= V_tcp_hostcache.prune; + } else { + atomic_subtract_int(&hc_entry->rmx_expire, + V_tcp_hostcache.prune); + hc_prev = hc_entry; + } } - THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); + THC_UNLOCK(head); } } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 17:24:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B083E5E0E88; Tue, 20 Apr 2021 17:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPrCq4jlDz3GNs; Tue, 20 Apr 2021 17:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 7CDBFE29A; Tue, 20 Apr 2021 17:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files To: rgrimes@freebsd.org, Warner Losh Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104201702.13KH2BEF071847@gndrsh.dnsmgr.net> From: Jung-uk Kim Organization: FreeBSD.org Message-ID: <1b95e1cc-0461-f7ef-9f29-e992c5d1e6d9@FreeBSD.org> Date: Tue, 20 Apr 2021 13:24:51 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <202104201702.13KH2BEF071847@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:24:55 -0000 On 21. 4. 20., Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> On Tue, Apr 20, 2021 at 10:24 AM Jung-uk Kim wrote: >> >>> On 21. 4. 20., Rodney W. Grimes wrote: >>>>> On 21. 4. 20., Rodney W. Grimes wrote: >>>>>>> The branch main has been updated by jkim: >>>>>>> >>>>>>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d >>>>>>> >>>>>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d >>>>>>> Author: Jung-uk Kim >>>>>>> AuthorDate: 2021-04-19 18:20:51 +0000 >>>>>>> Commit: Jung-uk Kim >>>>>>> CommitDate: 2021-04-19 18:20:51 +0000 >>>>>>> >>>>>>> flex: Regen bootstrap files >>>>>>> >>>>>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see >>> any >>>>>>> point of adding SPDX tag in generated file. >>>>>> >>>>>> The SPDX identifies the copyright that follows it, so please put this >>> back. >>>>> >>>>> It is a generated file. If you really think it is necessary, you need >>>>> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. >>>> >>>> Just because it is a generated file does not change the fact that >>>> its contents are copyrighted. Leaving the copyright out at best >>>> defaults to Bern convention, so the fact of the mater is the contents >>>> is copyrighted, and it is best to explicitly state that it is. >>> >>> Of course, it is copyrighted. My point was parse.y should have been >>> patched, not the generated file, if necessary. >>> >> >> Yes. It was a mistake to put it into the generated file. > > He removed the SPDX from parse.y, now says that is the right place > to put the SPDX. You agree. So can we have this undone? > >>>>> However, I don't see much sense in automatically adding BSD license in >>>>> every generated file in the first place. In fact, I think it should not >>>>> appear on generated file at all. It may say something along the line of >>>>> "generated by flex" instead but IANAL. >>>> >>>> Well, someone before you did see since in it, and hence put that SPDX in >>> it. >>> >>> Let me put it in another way. Do we really want to tag contrib code? >>> >> >> I tend to agree. >> >> I tend to agree because the SPDX tags are generally only looked at in the >> source tree by existing tools. The generated code won't be looked at >> typically. >> We should work to get this upstream, imho. > > Is parse.y not a source file? What am I missing? I guess you're confused somehow. 686cf5468c4a85c2a6385cdbab2383900876a41d did not touch parse.y. https://cgit.freebsd.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d parse.y never had the tag from the day 1. https://cgit.freebsd.org/src/log/contrib/flex/src/parse.y Jung-uk Kim >> By itself, the SPDX tag is just information. There's no legal requirement in >> copyright law to have it. Current project policy states they are just >> informative, >> though there's some desire to have a good framework to allow code with >> just a copyright and a SDPX tag into the tree, so long as that framework >> can be used to know what the license is for any file in a clear and >> unambiguous >> way. >> >> Warner From owner-dev-commits-src-main@freebsd.org Tue Apr 20 18:13:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70BF65E22E3; Tue, 20 Apr 2021 18:13: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 4FPsHY2KRRz3JwP; Tue, 20 Apr 2021 18:13:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42A1F179A0; Tue, 20 Apr 2021 18:13: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 13KIDDsV032116; Tue, 20 Apr 2021 18:13:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KIDDnw032115; Tue, 20 Apr 2021 18:13:13 GMT (envelope-from git) Date: Tue, 20 Apr 2021 18:13:13 GMT Message-Id: <202104201813.13KIDDnw032115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sofian Brabez Subject: git: 561d34d70596 - main - iwnstats: fix build with clang and allow install under /usr/local/sbin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sbz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 561d34d70596b455c6a513431f8ad007076f90c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 18:13:13 -0000 The branch main has been updated by sbz (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=561d34d70596b455c6a513431f8ad007076f90c5 commit 561d34d70596b455c6a513431f8ad007076f90c5 Author: Sofian Brabez AuthorDate: 2021-04-20 17:58:46 +0000 Commit: Sofian Brabez CommitDate: 2021-04-20 18:07:56 +0000 iwnstats: fix build with clang and allow install under /usr/local/sbin iwnstats was not compiling because of some issues raised by the clang compiler due to -Werror. As a tool it is not connected to world build. Add missing field "barker_mrc" initialization in struct iwn_sensitivity_limits for -Wmissing-field-initializers, remove unused pointer *is on iwn_stats_*_print functions and unused variables for -Wunused-parameter and -Wunused-variable. The value for field "barker_mrc" of struct iwn2030_sensitivity_limits was obtained from linux 3.2 wireless/iwlwifi driver code (iwl-2000.c:115 .barker_corr_th_min_mrc = 390). Also set BINDIR in Makefile to make it possible to install under /usr/local/sbin/iwnstats as it require super user. Reviewed by: adrian MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29800 --- sys/dev/iwn/if_iwnreg.h | 3 ++- tools/tools/iwn/iwnstats/Makefile | 2 ++ tools/tools/iwn/iwnstats/main.c | 26 +++++++++++--------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sys/dev/iwn/if_iwnreg.h b/sys/dev/iwn/if_iwnreg.h index e53343cfbf4a..54945f63df16 100644 --- a/sys/dev/iwn/if_iwnreg.h +++ b/sys/dev/iwn/if_iwnreg.h @@ -2267,7 +2267,8 @@ static const struct iwn_sensitivity_limits iwn2030_sensitivity_limits = { 160,310, 97, 97, - 110 + 110, + 390 }; /* Map TID to TX scheduler's FIFO. */ diff --git a/tools/tools/iwn/iwnstats/Makefile b/tools/tools/iwn/iwnstats/Makefile index b35530c324b0..685e40759fb2 100644 --- a/tools/tools/iwn/iwnstats/Makefile +++ b/tools/tools/iwn/iwnstats/Makefile @@ -15,6 +15,8 @@ PROG= iwnstats # to not compile, use gcc for now. #CC= gcc +BINDIR?=/usr/local/sbin + SRCS= main.c iwn_ioctl.c # CFLAGS.clang+= -fbracket-depth=512 diff --git a/tools/tools/iwn/iwnstats/main.c b/tools/tools/iwn/iwnstats/main.c index b047e11ce6b8..8717bc48f824 100644 --- a/tools/tools/iwn/iwnstats/main.c +++ b/tools/tools/iwn/iwnstats/main.c @@ -72,8 +72,7 @@ iwnstats_new(const char *ifname) } static void -iwn_stats_phy_print(struct iwnstats *is, struct iwn_rx_phy_stats *rxphy, - const char *prefix) +iwn_stats_phy_print(struct iwn_rx_phy_stats *rxphy, const char *prefix) { printf("%s: %s: ina=%d, fina=%d, bad_plcp=%d, bad_crc32=%d, overrun=%d, eoverrun=%d\n", @@ -108,7 +107,7 @@ iwn_stats_phy_print(struct iwnstats *is, struct iwn_rx_phy_stats *rxphy, } static void -iwn_stats_rx_general_print(struct iwnstats *is, struct iwn_rx_general_stats *g) +iwn_stats_rx_general_print(struct iwn_rx_general_stats *g) { printf("%s: bad_cts=%d, bad_ack=%d, not_bss=%d, filtered=%d, bad_chan=%d, beacons=%d\n", @@ -147,7 +146,7 @@ iwn_stats_rx_general_print(struct iwnstats *is, struct iwn_rx_general_stats *g) } static void -iwn_stats_tx_print(struct iwnstats *is, struct iwn_tx_stats *tx) +iwn_stats_tx_print(struct iwn_tx_stats *tx) { printf("%s: preamble=%d, rx_detected=%d, bt_defer=%d, bt_kill=%d, short_len=%d\n", @@ -191,7 +190,7 @@ iwn_stats_tx_print(struct iwnstats *is, struct iwn_tx_stats *tx) } static void -iwn_stats_ht_phy_print(struct iwnstats *is, struct iwn_rx_ht_phy_stats *ht) +iwn_stats_ht_phy_print(struct iwn_rx_ht_phy_stats *ht) { printf("%s: bad_plcp=%d, overrun=%d, eoverrun=%d, good_crc32=%d, bad_crc32=%d\n", @@ -212,7 +211,7 @@ iwn_stats_ht_phy_print(struct iwnstats *is, struct iwn_rx_ht_phy_stats *ht) static void -iwn_stats_general_print(struct iwnstats *is, struct iwn_stats *stats) +iwn_stats_general_print(struct iwn_stats *stats) { /* General */ @@ -249,16 +248,16 @@ iwn_print(struct iwnstats *is) gettimeofday(&tv, NULL); printf("time=%ld.%.6ld\n", (long)tv.tv_sec, (long)tv.tv_usec); - iwn_stats_general_print(is, s); + iwn_stats_general_print(s); /* RX */ - iwn_stats_phy_print(is, &s->rx.ofdm, "ofdm"); - iwn_stats_phy_print(is, &s->rx.cck, "cck"); - iwn_stats_ht_phy_print(is, &s->rx.ht); - iwn_stats_rx_general_print(is, &s->rx.general); + iwn_stats_phy_print(&s->rx.ofdm, "ofdm"); + iwn_stats_phy_print(&s->rx.cck, "cck"); + iwn_stats_ht_phy_print(&s->rx.ht); + iwn_stats_rx_general_print(&s->rx.general); /* TX */ - iwn_stats_tx_print(is, &s->tx); + iwn_stats_tx_print(&s->tx); printf("--\n"); } @@ -278,9 +277,6 @@ main(int argc, char *argv[]) int ch; char *ifname; bool first; - char *sysctlname; - size_t len; - int ret; ifname = strdup(IWN_DEFAULT_IF); From owner-dev-commits-src-main@freebsd.org Tue Apr 20 19:23:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E3F15E4A4C; Tue, 20 Apr 2021 19:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPtr81Jycz3NFq; Tue, 20 Apr 2021 19:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FD1F1887B; Tue, 20 Apr 2021 19:23: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 13KJN4E8024314; Tue, 20 Apr 2021 19:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KJN40G024313; Tue, 20 Apr 2021 19:23:04 GMT (envelope-from git) Date: Tue, 20 Apr 2021 19:23:04 GMT Message-Id: <202104201923.13KJN40G024313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: fc9780fd41e7 - main - mprutil: add big endian support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc9780fd41e7b29db04e9cb843cb5034b88ae662 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 19:23:04 -0000 The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=fc9780fd41e7b29db04e9cb843cb5034b88ae662 commit fc9780fd41e7b29db04e9cb843cb5034b88ae662 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-04-17 01:01:38 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-04-20 22:19:47 +0000 mprutil: add big endian support This fix mprutil on big endian platforms, as follow up of D25785. Flash operations are still not working, such as MPI2_FUNCTION_FW_UPLOAD failing due to timeout. Firmware version used during tests: 16.00.01.00 Submitted by: Andre Fernando da Silva Reviewed by: luporl, Sreekanth Reddy (by e-mail) Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26040 --- usr.sbin/mpsutil/mps_cmd.c | 61 +++++++++++++++++++++++++++++++++++--------- usr.sbin/mpsutil/mps_flash.c | 9 ++++--- usr.sbin/mpsutil/mps_show.c | 59 +++++++++++++++++++++--------------------- usr.sbin/mpsutil/mps_slot.c | 4 ++- usr.sbin/mpsutil/mpsutil.8 | 3 +++ 5 files changed, 90 insertions(+), 46 deletions(-) diff --git a/usr.sbin/mpsutil/mps_cmd.c b/usr.sbin/mpsutil/mps_cmd.c index f0ff98c2442b..a9cb269abc5f 100644 --- a/usr.sbin/mpsutil/mps_cmd.c +++ b/usr.sbin/mpsutil/mps_cmd.c @@ -41,6 +41,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -241,6 +242,8 @@ struct mprs_btdh_mapping { uint16_t Reserved; }; +static void adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts); + const char * mps_ioc_status(U16 IOCStatus) { @@ -296,7 +299,7 @@ mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status) NULL, 0, NULL, 0, 30) != 0) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) return (EIO); return (0); } @@ -319,7 +322,7 @@ mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, NULL, 0, NULL, 0, 30)) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; return (EIO); @@ -342,15 +345,15 @@ mps_read_ext_config_page_header(int fd, U8 ExtPageType, U8 PageNumber, U32 PageA req.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; req.ExtPageType = ExtPageType; req.Header.PageNumber = PageNumber; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), NULL, 0, NULL, 0, 30)) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) { if (IOCStatus != NULL) - *IOCStatus = reply.IOCStatus; + *IOCStatus = le16toh(reply.IOCStatus); return (EIO); } if ((header == NULL) || (ExtPageLength == NULL)) @@ -381,7 +384,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, bzero(&req, sizeof(req)); req.Function = MPI2_FUNCTION_CONFIG; req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); req.Header = header; if (req.Header.PageLength == 0) req.Header.PageLength = 4; @@ -395,6 +398,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, errno = error; return (NULL); } + reply.IOCStatus = le16toh(reply.IOCStatus); if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; @@ -432,14 +436,14 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, bzero(&req, sizeof(req)); req.Function = MPI2_FUNCTION_CONFIG; req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); req.Header = header; if (pagelen == 0) - pagelen = 4; + pagelen = htole16(4); req.ExtPageLength = pagelen; req.ExtPageType = ExtPageType; - len = pagelen * 4; + len = le16toh(pagelen) * 4; buf = malloc(len); if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), buf, len, NULL, 0, 30)) { @@ -448,6 +452,7 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, errno = error; return (NULL); } + reply.IOCStatus = le16toh(reply.IOCStatus); if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; @@ -471,7 +476,7 @@ mps_firmware_send(int fd, unsigned char *fw, uint32_t len, bool bios) bzero(&reply, sizeof(reply)); req.Function = MPI2_FUNCTION_FW_DOWNLOAD; req.ImageType = bios ? MPI2_FW_DOWNLOAD_ITYPE_BIOS : MPI2_FW_DOWNLOAD_ITYPE_FW; - req.TotalImageSize = len; + req.TotalImageSize = htole32(len); req.MsgFlags = MPI2_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT; if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply), @@ -502,7 +507,7 @@ mps_firmware_get(int fd, unsigned char **firmware, bool bios) return (-1); } - size = reply.ActualImageSize; + size = le32toh(reply.ActualImageSize); *firmware = calloc(size, sizeof(unsigned char)); if (*firmware == NULL) { warn("calloc"); @@ -571,6 +576,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, errno = error; return (NULL); } + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -598,9 +604,10 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, req.header.PageVersion = PageVersion; req.header.PageNumber = PageNumber; req.header.ExtPageType = ExtPageType; - req.page_address = PageAddress; + req.page_address = htole32(PageAddress); if (ioctl(fd, MPSIO_READ_EXT_CFG_HEADER, &req) < 0) return (NULL); + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -620,6 +627,7 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, errno = error; return (NULL); } + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -761,6 +769,35 @@ mps_get_iocfacts(int fd) errno = EINVAL; return (NULL); } + adjust_iocfacts_endianness(facts); return (facts); } +static void +adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts) +{ + facts->MsgVersion = le16toh(facts->MsgVersion); + facts->HeaderVersion = le16toh(facts->HeaderVersion); + facts->Reserved1 = le16toh(facts->Reserved1); + facts->IOCExceptions = le16toh(facts->IOCExceptions); + facts->IOCStatus = le16toh(facts->IOCStatus); + facts->IOCLogInfo = le32toh(facts->IOCLogInfo); + facts->RequestCredit = le16toh(facts->RequestCredit); + facts->ProductID = le16toh(facts->ProductID); + facts->IOCCapabilities = le32toh(facts->IOCCapabilities); + facts->IOCRequestFrameSize = + le16toh(facts->IOCRequestFrameSize); + facts->FWVersion.Word = le32toh(facts->FWVersion.Word); + facts->MaxInitiators = le16toh(facts->MaxInitiators); + facts->MaxTargets = le16toh(facts->MaxTargets); + facts->MaxSasExpanders = le16toh(facts->MaxSasExpanders); + facts->MaxEnclosures = le16toh(facts->MaxEnclosures); + facts->ProtocolFlags = le16toh(facts->ProtocolFlags); + facts->HighPriorityCredit = le16toh(facts->HighPriorityCredit); + facts->MaxReplyDescriptorPostQueueDepth = + le16toh(facts->MaxReplyDescriptorPostQueueDepth); + facts->MaxDevHandle = le16toh(facts->MaxDevHandle); + facts->MaxPersistentEntries = + le16toh(facts->MaxPersistentEntries); + facts->MinDevHandle = le16toh(facts->MinDevHandle); +} diff --git a/usr.sbin/mpsutil/mps_flash.c b/usr.sbin/mpsutil/mps_flash.c index 22beaae79bb0..a0cc4a877b7d 100644 --- a/usr.sbin/mpsutil/mps_flash.c +++ b/usr.sbin/mpsutil/mps_flash.c @@ -29,6 +29,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -203,21 +204,21 @@ flash_update(int argc, char **argv) } } else { fwheader = (MPI2_FW_IMAGE_HEADER *)mem; - if (fwheader->VendorID != MPI2_MFGPAGE_VENDORID_LSI) { + if (le16toh(fwheader->VendorID) != MPI2_MFGPAGE_VENDORID_LSI) { warnx("Invalid firmware:"); warnx(" Expected Vendor ID: %04x", MPI2_MFGPAGE_VENDORID_LSI); - warnx(" Image Vendor ID: %04x", fwheader->VendorID); + warnx(" Image Vendor ID: %04x", le16toh(fwheader->VendorID)); munmap(mem, st.st_size); close(fd); free(facts); return (1); } - if (fwheader->ProductID != facts->ProductID) { + if (le16toh(fwheader->ProductID) != facts->ProductID) { warnx("Invalid image:"); warnx(" Expected Product ID: %04x", facts->ProductID); - warnx(" Image Product ID: %04x", fwheader->ProductID); + warnx(" Image Product ID: %04x", le16toh(fwheader->ProductID)); munmap(mem, st.st_size); close(fd); free(facts); diff --git a/usr.sbin/mpsutil/mps_show.c b/usr.sbin/mpsutil/mps_show.c index bb790fe21229..620bb5e27f89 100644 --- a/usr.sbin/mpsutil/mps_show.c +++ b/usr.sbin/mpsutil/mps_show.c @@ -36,6 +36,7 @@ __RCSID("$FreeBSD$"); #include #include +#include #include #include #include @@ -105,7 +106,7 @@ show_adapter(int ac, char **av) warn("Failed to get BIOS page 3 info"); return (error); } - v = bios3->BiosVersion; + v = le32toh(bios3->BiosVersion); printf(" BIOS Revision: %d.%02d.%02d.%02d\n", ((v & 0xff000000) >> 24), ((v &0xff0000) >> 16), ((v & 0xff00) >> 8), (v & 0xff)); @@ -172,12 +173,12 @@ show_adapter(int ac, char **av) minspeed = get_device_speed(phy1->MaxMinLinkRate); maxspeed = get_device_speed(phy1->MaxMinLinkRate >> 4); - type = get_device_type(phy0->ControllerPhyDeviceInfo); + type = get_device_type(le32toh(phy0->ControllerPhyDeviceInfo)); - if (phy0->AttachedDevHandle != 0) { - snprintf(devhandle, 5, "%04x", phy0->AttachedDevHandle); + if (le16toh(phy0->AttachedDevHandle) != 0) { + snprintf(devhandle, 5, "%04x", le16toh(phy0->AttachedDevHandle)); snprintf(ctrlhandle, 5, "%04x", - phy0->ControllerDevHandle); + le16toh(phy0->ControllerDevHandle)); speed = get_device_speed(phy0->NegotiatedLinkRate); } else { snprintf(devhandle, 5, " "); @@ -520,7 +521,7 @@ show_devices(int ac, char **av) close(fd); return (error); } - handle = device->DevHandle; + handle = le16toh(device->DevHandle); if (device->ParentDevHandle == 0x0) { free(device); @@ -539,7 +540,7 @@ show_devices(int ac, char **av) else snprintf(bt, sizeof(bt), "%02d %02d", bus, target); - type = get_device_type(device->DeviceInfo); + type = get_device_type(le32toh(device->DeviceInfo)); if (device->PhyNum < nphys) { phydata = &sas0->PhyData[device->PhyNum]; @@ -551,7 +552,7 @@ show_devices(int ac, char **av) MPI2_SAS_EXPAND_PGAD_FORM_HNDL_PHY_NUM | (device->PhyNum << MPI2_SAS_EXPAND_PGAD_PHYNUM_SHIFT) | - device->ParentDevHandle, &IOCStatus); + le16toh(device->ParentDevHandle), &IOCStatus); if (exp1 == NULL) { if (IOCStatus != MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) { error = errno; @@ -570,19 +571,19 @@ show_devices(int ac, char **av) speed = " "; if (device->EnclosureHandle != 0) { - snprintf(enchandle, 5, "%04x", device->EnclosureHandle); - snprintf(slot, 3, "%02d", device->Slot); + snprintf(enchandle, 5, "%04x", le16toh(device->EnclosureHandle)); + snprintf(slot, 3, "%02d", le16toh(device->Slot)); } else { snprintf(enchandle, 5, " "); snprintf(slot, 3, " "); } printf("%-10s", bt); - snprintf(buf, sizeof(buf), "%08x%08x", device->SASAddress.High, - device->SASAddress.Low); + snprintf(buf, sizeof(buf), "%08x%08x", le32toh(device->SASAddress.High), + le32toh(device->SASAddress.Low)); printf("%-17s", buf); - snprintf(buf, sizeof(buf), "%04x", device->DevHandle); + snprintf(buf, sizeof(buf), "%04x", le16toh(device->DevHandle)); printf("%-8s", buf); - snprintf(buf, sizeof(buf), "%04x", device->ParentDevHandle); + snprintf(buf, sizeof(buf), "%04x", le16toh(device->ParentDevHandle)); printf("%-10s", buf); printf("%-14s%-6s%-5s%-6s%d\n", type, speed, enchandle, slot, device->MaxPortConnections); @@ -626,16 +627,16 @@ show_enclosures(int ac, char **av) close(fd); return (error); } - type = get_enc_type(enc->Flags, &issep); + type = get_enc_type(le16toh(enc->Flags), &issep); if (issep == 0) snprintf(sepstr, 5, " "); else - snprintf(sepstr, 5, "%04x", enc->SEPDevHandle); + snprintf(sepstr, 5, "%04x", le16toh(enc->SEPDevHandle)); printf(" %.2d %08x%08x %s %04x %s\n", - enc->NumSlots, enc->EnclosureLogicalID.High, - enc->EnclosureLogicalID.Low, sepstr, enc->EnclosureHandle, + le16toh(enc->NumSlots), le32toh(enc->EnclosureLogicalID.High), + le32toh(enc->EnclosureLogicalID.Low), sepstr, le16toh(enc->EnclosureHandle), type); - handle = enc->EnclosureHandle; + handle = le16toh(enc->EnclosureHandle); free(enc); } printf("\n"); @@ -679,19 +680,19 @@ show_expanders(int ac, char **av) } nphys = exp0->NumPhys; - handle = exp0->DevHandle; + handle = le16toh(exp0->DevHandle); if (exp0->EnclosureHandle == 0x00) snprintf(enchandle, 5, " "); else - snprintf(enchandle, 5, "%04d", exp0->EnclosureHandle); + snprintf(enchandle, 5, "%04d", le16toh(exp0->EnclosureHandle)); if (exp0->ParentDevHandle == 0x0) snprintf(parent, 5, " "); else - snprintf(parent, 5, "%04x", exp0->ParentDevHandle); + snprintf(parent, 5, "%04x", le16toh(exp0->ParentDevHandle)); printf(" %02d %08x%08x %04x %s %s %d\n", - exp0->NumPhys, exp0->SASAddress.High, exp0->SASAddress.Low, - exp0->DevHandle, parent, enchandle, exp0->SASLevel); + exp0->NumPhys, le32toh(exp0->SASAddress.High), le32toh(exp0->SASAddress.Low), + le16toh(exp0->DevHandle), parent, enchandle, exp0->SASLevel); printf("\n"); printf(" Phy RemotePhy DevHandle Speed Min Max Device\n"); @@ -708,8 +709,8 @@ show_expanders(int ac, char **av) warn("Error retrieving expander pg 1"); continue; } - type = get_device_type(exp1->AttachedDeviceInfo); - if ((exp1->AttachedDeviceInfo &0x7) == 0) { + type = get_device_type(le32toh(exp1->AttachedDeviceInfo)); + if ((le32toh(exp1->AttachedDeviceInfo) &0x7) == 0) { speed = " "; snprintf(rphy, 3, " "); snprintf(rhandle, 5, " "); @@ -719,7 +720,7 @@ show_expanders(int ac, char **av) snprintf(rphy, 3, "%02d", exp1->AttachedPhyIdentifier); snprintf(rhandle, 5, "%04x", - exp1->AttachedDevHandle); + le16toh(exp1->AttachedDevHandle)); } min = get_device_speed(exp1->HwLinkRate); max = get_device_speed(exp1->HwLinkRate >> 4); @@ -762,7 +763,7 @@ show_cfgpage(int ac, char **av) switch (ac) { case 4: - addr = (uint32_t)strtoul(av[3], NULL, 0); + addr = htole32((uint32_t)strtoul(av[3], NULL, 0)); case 3: num = (uint8_t)strtoul(av[2], NULL, 0); case 2: @@ -789,7 +790,7 @@ show_cfgpage(int ac, char **av) if (page >= 0x10) { ehdr = data; - len = ehdr->ExtPageLength * 4; + len = le16toh(ehdr->ExtPageLength) * 4; page = ehdr->ExtPageType; attrs = ehdr->PageType >> 4; } else { diff --git a/usr.sbin/mpsutil/mps_slot.c b/usr.sbin/mpsutil/mps_slot.c index 1879d699067a..bb4a7324c461 100644 --- a/usr.sbin/mpsutil/mps_slot.c +++ b/usr.sbin/mpsutil/mps_slot.c @@ -31,6 +31,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -99,7 +100,8 @@ slot_set(int argc, char **argv) return (error); } - if (mps_set_slot_status(fd, handle, slot, status) != 0) { + if (mps_set_slot_status(fd, htole16(handle), htole16(slot), + htole32(status)) != 0) { warnx("Failed to set status"); close(fd); return (1); diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index 1dd4f0509174..1bb7c4d5eaec 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -163,3 +163,6 @@ The .Nm utility first appeared in .Fx 11.0 . +.Sh TODO +Flash operations (save/update) are not supported on big-endian architectures. +.Pp From owner-dev-commits-src-main@freebsd.org Tue Apr 20 19:32:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5BB55E5A8B; Tue, 20 Apr 2021 19:32: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 4FPv3T5mRqz3PQc; Tue, 20 Apr 2021 19:32:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8D9D1899A; Tue, 20 Apr 2021 19:32: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 13KJWrAH037839; Tue, 20 Apr 2021 19:32:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KJWrfN037838; Tue, 20 Apr 2021 19:32:53 GMT (envelope-from git) Date: Tue, 20 Apr 2021 19:32:53 GMT Message-Id: <202104201932.13KJWrfN037838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sofian Brabez Subject: git: b8be8094958a - main - wlanstats: fix build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sbz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8be8094958a01255f5430bd6a36ff936bdd53c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 19:32:53 -0000 The branch main has been updated by sbz (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b8be8094958a01255f5430bd6a36ff936bdd53c3 commit b8be8094958a01255f5430bd6a36ff936bdd53c3 Author: Sofian Brabez AuthorDate: 2021-04-20 18:31:48 +0000 Commit: Sofian Brabez CommitDate: 2021-04-20 19:31:44 +0000 wlanstats: fix build Add -Wno-cast-align to the CFLAGS to fix the build of wlanstats Approved by: adrian MFC after: 1 week --- tools/tools/net80211/wlanstats/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/net80211/wlanstats/Makefile b/tools/tools/net80211/wlanstats/Makefile index 2d23932a62a5..f4384c6d0709 100644 --- a/tools/tools/net80211/wlanstats/Makefile +++ b/tools/tools/net80211/wlanstats/Makefile @@ -10,6 +10,6 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/ SRCS= wlanstats.c main.c -CFLAGS.clang+= -fbracket-depth=512 +CFLAGS.clang+= -fbracket-depth=512 -Wno-cast-align .include From owner-dev-commits-src-main@freebsd.org Tue Apr 20 19:44:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 961B15E60EB; Tue, 20 Apr 2021 19:44: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 4FPvKP3s8Yz3QQd; Tue, 20 Apr 2021 19:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7735818BAC; Tue, 20 Apr 2021 19:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13KJivvH051158; Tue, 20 Apr 2021 19:44:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KJivFd051157; Tue, 20 Apr 2021 19:44:57 GMT (envelope-from git) Date: Tue, 20 Apr 2021 19:44:57 GMT Message-Id: <202104201944.13KJivFd051157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: dd559118ab3f - main - Fix leak in libc NFSv4 flags parsing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd559118ab3f065ae230b324c3fe4bb1c9b7ca56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 19:44:57 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=dd559118ab3f065ae230b324c3fe4bb1c9b7ca56 commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56 Author: Andrew Walker AuthorDate: 2021-04-20 19:34:44 +0000 Commit: Ryan Moeller CommitDate: 2021-04-20 19:39:56 +0000 Fix leak in libc NFSv4 flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker Reported by: valgrind Reviewed by: allanjude, freqlabs, rpokala MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 --- lib/libc/posix1e/acl_support_nfs4.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index 3962eaa6daa8..92ec666b2313 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -142,9 +142,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -166,12 +167,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 20:23:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01DA25E7994; Tue, 20 Apr 2021 20:23: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 4FPw9y6fSJz3hhv; Tue, 20 Apr 2021 20:23:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7086191B2; Tue, 20 Apr 2021 20:23: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 13KKNYdt004233; Tue, 20 Apr 2021 20:23:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KKNY7n004232; Tue, 20 Apr 2021 20:23:34 GMT (envelope-from git) Date: Tue, 20 Apr 2021 20:23:34 GMT Message-Id: <202104202023.13KKNY7n004232@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: 0611aec3cf3a - main - etcupdate: Always extract to a temporary tree. 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: 0611aec3cf3a373e6a06f103699dbc91c3d6d472 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 20:23:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0611aec3cf3a373e6a06f103699dbc91c3d6d472 commit 0611aec3cf3a373e6a06f103699dbc91c3d6d472 Author: John Baldwin AuthorDate: 2021-04-20 20:21:42 +0000 Commit: John Baldwin CommitDate: 2021-04-20 20:21:42 +0000 etcupdate: Always extract to a temporary tree. etcupdate has had a somewhat nasty race condition since its creation in that its state machine can get very confused if it is interrupted while building the tree to compare against. This is exacerbated by the fact that etcupdate doesn't emit any output while building the tree which can take several seconds (especially in recent years with the addition of the tree-wide buildconfig/installconfig passes). To mitigate this, always install a new tree into a temporary directory created via mktemp as was previously done only for dry-runs via -n. The existing trees are only rotated and the new tree installed as /var/db/etcupdate/current after the update command has completed. Reported by: dim, np (and many others) Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29843 --- usr.sbin/etcupdate/etcupdate.sh | 148 +++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 56 deletions(-) diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index 87d269f2ca69..72fa3e9d524d 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -226,9 +226,11 @@ build_tree() return 0 } -# Generate a new NEWTREE tree. If tarball is set, then the tree is +# Generate a new tree. If tarball is set, then the tree is # extracted from the tarball. Otherwise the tree is built from a # source tree. +# +# $1 - directory to store new tree in extract_tree() { local files @@ -239,16 +241,16 @@ extract_tree() if [ -n "$preworld" ]; then files="$PREWORLD_FILES" fi - if ! (mkdir -p $NEWTREE && tar xf $tarball -C $NEWTREE $files) \ + if ! (mkdir -p $1 && tar xf $tarball -C $1 $files) \ >&3 2>&1; then echo "Failed to extract new tree." - remove_tree $NEWTREE + remove_tree $1 exit 1 fi else - if ! build_tree $NEWTREE; then + if ! build_tree $1; then echo "Failed to build new tree." - remove_tree $NEWTREE + remove_tree $1 exit 1 fi fi @@ -1353,14 +1355,28 @@ extract_cmd() log "extract command: tarball=$tarball" + # Create a temporary directory to hold the tree + dir=`mktemp -d $WORKDIR/etcupdate-XXXXXXX` + if [ $? -ne 0 ]; then + echo "Unable to create temporary directory." + exit 1 + fi + + extract_tree $dir + if [ -d $NEWTREE ]; then if ! remove_tree $NEWTREE; then echo "Unable to remove current tree." + remove_tree $dir exit 1 fi fi - extract_tree + if ! mv $dir $NEWTREE >&3 2>&1; then + echo "Unable to rename temp tree to current tree." + remove_tree $dir + exit 1 + fi } # Resolve conflicts left from an earlier merge. @@ -1420,7 +1436,7 @@ status_cmd() # source tree. update_cmd() { - local dir + local dir new old if [ $# -ne 0 ]; then usage @@ -1449,60 +1465,44 @@ update_cmd() exit 1 fi + # Save tree names to use for rotation later. + old=$OLDTREE + new=$NEWTREE if [ -z "$rerun" ]; then - # For a dryrun that is not a rerun, do not rotate the existing - # stock tree. Instead, extract a tree to a temporary directory - # and use that for the comparison. - if [ -n "$dryrun" ]; then - dir=`mktemp -d $WORKDIR/etcupdate-XXXXXXX` - if [ $? -ne 0 ]; then - echo "Unable to create temporary directory." - exit 1 - fi - - # A pre-world dryrun has already set OLDTREE to - # point to the current stock tree. - if [ -z "$preworld" ]; then - OLDTREE=$NEWTREE - fi - NEWTREE=$dir - - # For a pre-world update, blow away any pre-existing - # NEWTREE. - elif [ -n "$preworld" ]; then - if ! remove_tree $NEWTREE; then - echo "Unable to remove pre-world tree." - exit 1 - fi + # Extract the new tree to a temporary directory. The + # trees are only rotated after a successful update to + # avoid races if an update command is interrupted + # before it completes. + dir=`mktemp -d $WORKDIR/etcupdate-XXXXXXX` + if [ $? -ne 0 ]; then + echo "Unable to create temporary directory." + exit 1 + fi - # Rotate the existing stock tree to the old tree. - elif [ -d $NEWTREE ]; then - # First, delete the previous old tree if it exists. - if ! remove_tree $OLDTREE; then - echo "Unable to remove old tree." - exit 1 - fi + # Populate the new tree. + extract_tree $dir - # Move the current stock tree. - if ! mv $NEWTREE $OLDTREE >&3 2>&1; then - echo "Unable to rename current stock tree." - exit 1 - fi + # Compare the new tree against the previous tree. For + # the preworld case OLDTREE already points to the + # current stock tree. + if [ -z "$preworld" ]; then + OLDTREE=$NEWTREE fi + NEWTREE=$dir + fi - if ! [ -d $OLDTREE ]; then - cat <&3 2>&1; then + echo "Unable to rename old tree." + exit 1 + fi + fi + + # Rotate the new tree. Remove a previous pre-world + # tree if it exists. + if [ -d $new ]; then + if [ -z "$preworld" ]; then + panic "New tree should be rotated to old" + fi + if ! remove_tree $old; then + echo "Unable to remove previous pre-world tree." + exit 1 + fi + fi + + if ! mv $NEWTREE $new >&3 2>&1; then + echo "Unable to rename current tree." + exit 1 + fi fi } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 20:23:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58A065E7995; Tue, 20 Apr 2021 20:23: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 4FPwB01Zvlz3hNZ; Tue, 20 Apr 2021 20:23:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 181BB19609; Tue, 20 Apr 2021 20:23: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 13KKNZnS004254; Tue, 20 Apr 2021 20:23:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KKNZdM004253; Tue, 20 Apr 2021 20:23:35 GMT (envelope-from git) Date: Tue, 20 Apr 2021 20:23:35 GMT Message-Id: <202104202023.13KKNZdM004253@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: 1f7afa936480 - main - etcupdate: Gracefully handle SIGINT when building trees. 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: 1f7afa9364805a912270c9d6a70dc4a889d47a4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 20:23:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1f7afa9364805a912270c9d6a70dc4a889d47a4e commit 1f7afa9364805a912270c9d6a70dc4a889d47a4e Author: John Baldwin AuthorDate: 2021-04-20 20:22:11 +0000 Commit: John Baldwin CommitDate: 2021-04-20 20:22:11 +0000 etcupdate: Gracefully handle SIGINT when building trees. Run the 'build_tree' function inside of a subshell and trap SIGINT to return an error to the caller. This allows callers to gracefully cleanup a partially created tree. While here, redirect stdout/stderr of the subshell to the log file instead of applying redirections individually to each command executed while building the tree. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29844 --- usr.sbin/etcupdate/etcupdate.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index 72fa3e9d524d..d0c27805562e 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -179,17 +179,21 @@ always_install() return 1 } -# Build a new tree +# Build a new tree. This runs inside a subshell to trap SIGINT. # # $1 - directory to store new tree in build_tree() -{ +( local destdir dir file make make="make $MAKE_OPTIONS -DNO_FILEMON" log "Building tree at $1 with $make" - mkdir -p $1/usr/obj >&3 2>&1 + + exec >&3 2>&1 + trap 'return 1' INT + + mkdir -p $1/usr/obj destdir=`realpath $1` if [ -n "$preworld" ]; then @@ -197,34 +201,33 @@ build_tree() # crucial to installworld. for file in $PREWORLD_FILES; do name=$(basename $file) - mkdir -p $1/etc >&3 2>&1 || return 1 + mkdir -p $1/etc || return 1 cp -p $SRCDIR/$file $1/etc/$name || return 1 done elif ! [ -n "$nobuild" ]; then (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs && MAKEOBJDIRPREFIX=$destdir/usr/obj $make _obj SUBDIR_OVERRIDE=etc && MAKEOBJDIRPREFIX=$destdir/usr/obj $make everything SUBDIR_OVERRIDE=etc && - MAKEOBJDIRPREFIX=$destdir/usr/obj $make DESTDIR=$destdir distribution) \ - >&3 2>&1 || return 1 + MAKEOBJDIRPREFIX=$destdir/usr/obj $make DESTDIR=$destdir distribution) || \ + return 1 else (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs && - $make DESTDIR=$destdir distribution) >&3 2>&1 || return 1 + $make DESTDIR=$destdir distribution) || return 1 fi - chflags -R noschg $1 >&3 2>&1 || return 1 - rm -rf $1/usr/obj >&3 2>&1 || return 1 + chflags -R noschg $1 || return 1 + rm -rf $1/usr/obj || return 1 # Purge auto-generated files. Only the source files need to # be updated after which these files are regenerated. - rm -f $1/etc/*.db $1/etc/passwd $1/var/db/services.db >&3 2>&1 || \ - return 1 + rm -f $1/etc/*.db $1/etc/passwd $1/var/db/services.db || return 1 # Remove empty files. These just clutter the output of 'diff'. - find $1 -type f -size 0 -delete >&3 2>&1 || return 1 + find $1 -type f -size 0 -delete || return 1 # Trim empty directories. - find -d $1 -type d -empty -delete >&3 2>&1 || return 1 + find -d $1 -type d -empty -delete || return 1 return 0 -} +) # Generate a new tree. If tarball is set, then the tree is # extracted from the tarball. Otherwise the tree is built from a From owner-dev-commits-src-main@freebsd.org Tue Apr 20 20:23:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E6AD5E7A14; Tue, 20 Apr 2021 20:23: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 4FPwB12j4Gz3hYf; Tue, 20 Apr 2021 20:23:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F9FA19423; Tue, 20 Apr 2021 20:23: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 13KKNbga004275; Tue, 20 Apr 2021 20:23:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KKNbPR004274; Tue, 20 Apr 2021 20:23:37 GMT (envelope-from git) Date: Tue, 20 Apr 2021 20:23:37 GMT Message-Id: <202104202023.13KKNbPR004274@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: ada7fd17d57f - main - etcupdate: Trim trailing whitespace. 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: ada7fd17d57fac3dbafff5a1b3268afb872c8b0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 20:23:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ada7fd17d57fac3dbafff5a1b3268afb872c8b0b commit ada7fd17d57fac3dbafff5a1b3268afb872c8b0b Author: John Baldwin AuthorDate: 2021-04-20 20:22:24 +0000 Commit: John Baldwin CommitDate: 2021-04-20 20:22:24 +0000 etcupdate: Trim trailing whitespace. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29845 --- usr.sbin/etcupdate/etcupdate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index d0c27805562e..2b14b3a4d71b 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -442,7 +442,7 @@ empty_destdir() # # $1 - first tree # $2 - second tree -# $3 - node name +# $3 - node name # $4 - label for first tree # $5 - label for second tree diffnode() @@ -867,7 +867,7 @@ merge_file() # $1 - pathname of the file to resolve (relative to DESTDIR) has_conflicts() { - + egrep -q '^(<{7}|\|{7}|={7}|>{7}) ' $CONFLICTS/$1 } @@ -1526,7 +1526,7 @@ EOF if [ -n "$preworld" ]; then > $WORKDIR/removed.files fi - + # The order for the following sections is important. In the # odd case that a directory is converted into a file, the # existing subfiles need to be removed if possible before the From owner-dev-commits-src-main@freebsd.org Tue Apr 20 20:23:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 875CB5E7A15; Tue, 20 Apr 2021 20:23: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 4FPwB22xY7z3hRQ; Tue, 20 Apr 2021 20:23:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D0BF19590; Tue, 20 Apr 2021 20:23: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 13KKNcjj004296; Tue, 20 Apr 2021 20:23:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KKNcJ4004295; Tue, 20 Apr 2021 20:23:38 GMT (envelope-from git) Date: Tue, 20 Apr 2021 20:23:38 GMT Message-Id: <202104202023.13KKNcJ4004295@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: ba30215ae0ef - main - etcupdate: Add a revert mode to restore one or more stock files. 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: ba30215ae0efeb49e5e9ca2469d95edaea78680d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 20:23:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ba30215ae0efeb49e5e9ca2469d95edaea78680d commit ba30215ae0efeb49e5e9ca2469d95edaea78680d Author: John Baldwin AuthorDate: 2021-04-20 20:22:35 +0000 Commit: John Baldwin CommitDate: 2021-04-20 20:23:08 +0000 etcupdate: Add a revert mode to restore one or more stock files. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29846 --- usr.sbin/etcupdate/etcupdate.8 | 24 ++++++++++++-------- usr.sbin/etcupdate/etcupdate.sh | 49 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/usr.sbin/etcupdate/etcupdate.8 b/usr.sbin/etcupdate/etcupdate.8 index 24afbca12951..5f13ed1d6733 100644 --- a/usr.sbin/etcupdate/etcupdate.8 +++ b/usr.sbin/etcupdate/etcupdate.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 27, 2018 +.Dd April 20, 2021 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -69,6 +69,12 @@ .Op Fl D Ar destdir .Op Fl L Ar logfile .Nm +.Cm revert +.Op Fl d Ar workdir +.Op Fl D Ar destdir +.Op Fl L Ar logfile +.Ar +.Nm .Cm status .Op Fl d Ar workdir .Op Fl D Ar destdir @@ -342,6 +348,14 @@ tree and discard any local changes made to the file. .It (h) help Display the list of commands. .El +.Ss Revert Mode +The +.Cm revert +mode is used to restore the stock versions of files. +In this mode, +.Nm +installs the stock version of requested files. +This mode cannot be used to restore directories, only individual files. .Ss Status Mode The .Cm status @@ -880,14 +894,6 @@ For example, one can imagine a syntax along the lines of .Pp to resolve a specific conflict in an automated fashion. .Pp -It might be nice to have something like a -.Sq revert -command to replace a locally modified version of a file with the stock -version of the file. -For example: -.Pp -.Dl "etcupdate revert /etc/mail/freebsd.cf" -.Pp Bootstrapping .Nm often results in gratuitous diffs in diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index 2b14b3a4d71b..bb9eb00bc646 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -58,7 +58,6 @@ # TODO: # - automatable conflict resolution -# - a 'revert' command to make a file "stock" usage() { @@ -72,6 +71,7 @@ usage: etcupdate [-npBF] [-d workdir] [-r | -s source | -t tarball] etcupdate extract [-B] [-d workdir] [-s source | -t tarball] [-L logfile] [-M options] etcupdate resolve [-p] [-d workdir] [-D destdir] [-L logfile] + etcupdate revert [-d workdir] [-D destdir] [-L logfile] file ... etcupdate status [-d workdir] [-D destdir] EOF exit 1 @@ -1415,6 +1415,47 @@ resolve_cmd() fi } +# Restore files to the stock version. Only files with a local change +# are restored from the stock version. +revert_cmd() +{ + local cmp file + + if [ $# -eq 0 ]; then + usage + fi + + for file; do + log "revert $file" + + if ! [ -e $NEWTREE/$file ]; then + echo "File $file does not exist in the current tree." + exit 1 + fi + if [ -d $NEWTREE/$file ]; then + echo "File $file is a directory." + exit 1 + fi + + compare $DESTDIR/$file $NEWTREE/$file + cmp=$? + if [ $cmp -eq $COMPARE_EQUAL ]; then + continue + fi + + if update_unmodified $file; then + # If this file had a conflict, clean up the + # conflict. + if [ -e $CONFLICTS/$file ]; then + if ! rm $CONFLICTS/$file >&3 2>&1; then + echo "Failed to remove conflict " \ + "for $file". + fi + fi + fi + done +} + # Report a summary of the previous merge. Specifically, list any # remaining conflicts followed by any warnings from the previous # update. @@ -1622,7 +1663,7 @@ EOF command="update" if [ $# -gt 0 ]; then case "$1" in - build|diff|extract|status|resolve) + build|diff|extract|status|resolve|revert) command="$1" shift ;; @@ -1801,7 +1842,7 @@ case $command in usage fi ;; - build|diff|status) + build|diff|status|revert) if [ -n "$dryrun" -o -n "$rerun" -o -n "$tarball" -o \ -n "$preworld" ]; then usage @@ -1835,7 +1876,7 @@ if ! mkdir -p $WORKDIR 2>/dev/null; then fi case $command in - diff|resolve|status) + diff|resolve|revert|status) exec 3>>$LOGFILE ;; *) From owner-dev-commits-src-main@freebsd.org Tue Apr 20 20:34:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4F185E815E; Tue, 20 Apr 2021 20:34: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 4FPwQh5hRQz3jJW; Tue, 20 Apr 2021 20:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B65C91995B; Tue, 20 Apr 2021 20:34: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 13KKYaZd018208; Tue, 20 Apr 2021 20:34:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KKYa3f018207; Tue, 20 Apr 2021 20:34:36 GMT (envelope-from git) Date: Tue, 20 Apr 2021 20:34:36 GMT Message-Id: <202104202034.13KKYa3f018207@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: e15bf05e0abc - main - bhyve: Be explicit that setting config.dump will not start a VM. 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: e15bf05e0abcf4435a09edb8ff8d7e38d1508bb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 20:34:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e15bf05e0abcf4435a09edb8ff8d7e38d1508bb2 commit e15bf05e0abcf4435a09edb8ff8d7e38d1508bb2 Author: John Baldwin AuthorDate: 2021-04-20 20:33:28 +0000 Commit: John Baldwin CommitDate: 2021-04-20 20:34:07 +0000 bhyve: Be explicit that setting config.dump will not start a VM. Suggested by: rpokala Reviewed by: bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29738 --- usr.sbin/bhyve/bhyve_config.5 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index d65040513cb0..1a77b1bbacb4 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 24, 2021 +.Dd April 20, 2021 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -143,11 +143,13 @@ the host's hostname and the VM name. Use MSI-X interrupts for PCI VirtIO devices. If set to false, MSI interrupts are used instead. .It Va config.dump Ta bool Ta false Ta -If this value is set to true, +If this value is set to true after +.Xr bhyve 8 +has finished parsing command line options, then .Xr bhyve 8 -will write all of its configuration variables to stdout and exit -after it has finished parsing command line options. +will write all of its configuration variables to stdout and exit. +No VM will be started. .El .Ss x86-Specific Settings .Bl -column "x86.vmexit_on_pause" "integer" "Default" From owner-dev-commits-src-main@freebsd.org Tue Apr 20 21:10:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 223CA5E925B; Tue, 20 Apr 2021 21:10: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 4FPxD30Tl8z3kr1; Tue, 20 Apr 2021 21:10:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 038B319BF3; Tue, 20 Apr 2021 21:10: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 13KLAQrh067242; Tue, 20 Apr 2021 21:10:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KLAQBd067241; Tue, 20 Apr 2021 21:10:26 GMT (envelope-from git) Date: Tue, 20 Apr 2021 21:10:26 GMT Message-Id: <202104202110.13KLAQBd067241@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: 83223eb58bf7 - main - Fixup ObsoleteFiles after 76681661be28. 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: 83223eb58bf79270a84b34254679ff2c2adc304e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 21:10:27 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=83223eb58bf79270a84b34254679ff2c2adc304e commit 83223eb58bf79270a84b34254679ff2c2adc304e Author: Dmitry Chagin AuthorDate: 2021-04-20 21:06:16 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-20 21:06:16 +0000 Fixup ObsoleteFiles after 76681661be28. --- ObsoleteFiles.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5035017ade9e..6f4cf3e2b5da 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -44,11 +44,11 @@ OLD_FILES+=usr/share/man/man9/pfctlinput2.9.gz # 20210412: Remove kernel asymmetric crypto -OLD_FILES+=usr/share/man/man9/crypto_asym.9 -OLD_FILES+=usr/share/man/man9/crypto_kdispatch.9 -OLD_FILES+=usr/share/man/man9/crypto_kdone.9 -OLD_FILES+=usr/share/man/man9/crypto_kregister.9 -OLD_FILES+=usr/share/man/man9/CRYPTODEV_KPROCESS.9 +OLD_FILES+=usr/share/man/man9/crypto_asym.9.gz +OLD_FILES+=usr/share/man/man9/crypto_kdispatch.9.gz +OLD_FILES+=usr/share/man/man9/crypto_kdone.9.gz +OLD_FILES+=usr/share/man/man9/crypto_kregister.9.gz +OLD_FILES+=usr/share/man/man9/CRYPTODEV_KPROCESS.9.gz # 20210410: remove unused libexec/rc.d/archdep OLD_FILES+=etc/rc.d/archdep From owner-dev-commits-src-main@freebsd.org Tue Apr 20 21:35:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BA135E9E3F; Tue, 20 Apr 2021 21:35: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 4FPxmd41Vpz3lwW; Tue, 20 Apr 2021 21:35:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CDC519EFC; Tue, 20 Apr 2021 21:35: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 13KLZD8q097609; Tue, 20 Apr 2021 21:35:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KLZDPM097608; Tue, 20 Apr 2021 21:35:13 GMT (envelope-from git) Date: Tue, 20 Apr 2021 21:35:13 GMT Message-Id: <202104202135.13KLZDPM097608@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: b31fbebeb3d5 - main - Relax rtsock message restrictions. 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: b31fbebeb3d59af359a3417cddfbcf666b2c56c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 21:35:13 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b31fbebeb3d59af359a3417cddfbcf666b2c56c9 commit b31fbebeb3d59af359a3417cddfbcf666b2c56c9 Author: Alexander V. Chernikov AuthorDate: 2021-04-19 20:49:18 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-20 21:34:19 +0000 Relax rtsock message restrictions. Address multiple issues with strict rtsock message validation. D28668 "normalisation" approach was based on the assumption that we always have at least "standard" sockaddr len. It turned out to be false - certain older applications like quagga or routed abuse sin[6]_len field and set it to the offset to the first fully-zero bit in the mask. It is impossible to normalise such sockaddrs without reallocation. With that in mind, change the approach to use a distinct memory buffer for the altered sockaddrs. This allows supporting the older software while maintaining the guarantee on the "standard" sockaddrs. PR: 255273,255089 Differential Revision: https://reviews.freebsd.org/D29826 MFC after: 3 days --- sys/net/rtsock.c | 271 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 177 insertions(+), 94 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 5194a2a15c1e..b7a7e5170c74 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -126,6 +126,13 @@ struct ifa_msghdrl32 { #endif /* COMPAT_FREEBSD32 */ +struct linear_buffer { + char *base; /* Base allocated memory pointer */ + uint32_t offset; /* Currently used offset */ + uint32_t size; /* Total buffer size */ +}; +#define SCRATCH_BUFFER_SIZE 1024 + #define RTS_PID_PRINTF(_fmt, ...) \ printf("rtsock:%s(): PID %d: " _fmt "\n", __func__, curproc->p_pid, ## __VA_ARGS__) @@ -177,7 +184,7 @@ static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *plen); static int rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo); -static int cleanup_xaddrs(struct rt_addrinfo *info); +static int cleanup_xaddrs(struct rt_addrinfo *info, struct linear_buffer *lb); static int sysctl_dumpentry(struct rtentry *rt, void *vw); static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight, struct walkarg *w); @@ -621,7 +628,8 @@ fill_blackholeinfo(struct rt_addrinfo *info, union sockaddr_union *saun) * Returns 0 on success. */ static int -fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo *info) +fill_addrinfo(struct rt_msghdr *rtm, int len, struct linear_buffer *lb, u_int fibnum, + struct rt_addrinfo *info) { int error; sa_family_t saf; @@ -641,7 +649,7 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * return (EINVAL); info->rti_flags = rtm->rtm_flags; - error = cleanup_xaddrs(info); + error = cleanup_xaddrs(info, lb); if (error != 0) return (error); saf = info->rti_info[RTAX_DST]->sa_family; @@ -878,6 +886,45 @@ export_rtaddrs(const struct rtentry *rt, struct sockaddr *dst, #endif } +static int +update_rtm_from_info(struct rt_addrinfo *info, struct rt_msghdr **prtm, + int alloc_len) +{ + struct rt_msghdr *rtm, *orig_rtm = NULL; + struct walkarg w; + int len; + + rtm = *prtm; + /* Check if we need to realloc storage */ + rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len); + if (len > alloc_len) { + struct rt_msghdr *tmp_rtm; + + tmp_rtm = malloc(len, M_TEMP, M_NOWAIT); + if (tmp_rtm == NULL) + return (ENOBUFS); + bcopy(rtm, tmp_rtm, rtm->rtm_msglen); + orig_rtm = rtm; + rtm = tmp_rtm; + alloc_len = len; + + /* + * Delay freeing original rtm as info contains + * data referencing it. + */ + } + + w.w_tmem = (caddr_t)rtm; + w.w_tmemsize = alloc_len; + rtsock_msg_buffer(rtm->rtm_type, info, &w, &len); + rtm->rtm_addrs = info->rti_addrs; + + if (orig_rtm != NULL) + free(orig_rtm, M_TEMP); + *prtm = rtm; + return (0); +} + /* * Update sockaddrs, flags, etc in @prtm based on @rc data. @@ -891,11 +938,10 @@ static int update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, int alloc_len, struct rib_cmd_info *rc, struct nhop_object *nh) { - struct walkarg w; union sockaddr_union saun; - struct rt_msghdr *rtm, *orig_rtm = NULL; + struct rt_msghdr *rtm; struct ifnet *ifp; - int error, len; + int error; rtm = *prtm; union sockaddr_union sa_dst, sa_mask; @@ -927,28 +973,8 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, } else if (ifp != NULL) rtm->rtm_index = ifp->if_index; - /* Check if we need to realloc storage */ - rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len); - if (len > alloc_len) { - struct rt_msghdr *tmp_rtm; - - tmp_rtm = malloc(len, M_TEMP, M_NOWAIT); - if (tmp_rtm == NULL) - return (ENOBUFS); - bcopy(rtm, tmp_rtm, rtm->rtm_msglen); - orig_rtm = rtm; - rtm = tmp_rtm; - alloc_len = len; - - /* - * Delay freeing original rtm as info contains - * data referencing it. - */ - } - - w.w_tmem = (caddr_t)rtm; - w.w_tmemsize = alloc_len; - rtsock_msg_buffer(rtm->rtm_type, info, &w, &len); + if ((error = update_rtm_from_info(info, prtm, alloc_len)) != 0) + return (error); rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh); if (rtm->rtm_flags & RTF_GWFLAG_COMPAT) @@ -956,11 +982,6 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, (rtm->rtm_flags & ~RTF_GWFLAG_COMPAT); rt_getmetrics(rc->rc_rt, nh, &rtm->rtm_rmx); rtm->rtm_rmx.rmx_weight = rc->rc_nh_weight; - rtm->rtm_addrs = info->rti_addrs; - - if (orig_rtm != NULL) - free(orig_rtm, M_TEMP); - *prtm = rtm; return (0); } @@ -985,6 +1006,17 @@ save_add_notification(struct rib_cmd_info *rc, void *_cbdata) } #endif +static struct sockaddr * +alloc_sockaddr_aligned(struct linear_buffer *lb, int len) +{ + len |= (sizeof(uint64_t) - 1); + if (lb->offset + len > lb->size) + return (NULL); + struct sockaddr *sa = (struct sockaddr *)(lb->base + lb->offset); + lb->offset += len; + return (sa); +} + /*ARGSUSED*/ static int route_output(struct mbuf *m, struct socket *so, ...) @@ -1022,12 +1054,17 @@ route_output(struct mbuf *m, struct socket *so, ...) * buffer aligned on 1k boundaty. */ alloc_len = roundup2(len, 1024); - if ((rtm = malloc(alloc_len, M_TEMP, M_NOWAIT)) == NULL) + int total_len = alloc_len + SCRATCH_BUFFER_SIZE; + if ((rtm = malloc(total_len, M_TEMP, M_NOWAIT)) == NULL) senderr(ENOBUFS); m_copydata(m, 0, len, (caddr_t)rtm); bzero(&info, sizeof(info)); nh = NULL; + struct linear_buffer lb = { + .base = (char *)rtm + alloc_len, + .size = SCRATCH_BUFFER_SIZE, + }; if (rtm->rtm_version != RTM_VERSION) { /* Do not touch message since format is unknown */ @@ -1042,19 +1079,19 @@ route_output(struct mbuf *m, struct socket *so, ...) * caller PID and error value. */ - if ((error = fill_addrinfo(rtm, len, fibnum, &info)) != 0) { + if ((error = fill_addrinfo(rtm, len, &lb, fibnum, &info)) != 0) { senderr(error); } + /* fill_addringo() embeds scope into IPv6 addresses */ +#ifdef INET6 + rti_need_deembed = 1; +#endif saf = info.rti_info[RTAX_DST]->sa_family; /* support for new ARP code */ if (rtm->rtm_flags & RTF_LLDATA) { error = lla_rt_output(rtm, &info); -#ifdef INET6 - if (error == 0) - rti_need_deembed = 1; -#endif goto flush; } @@ -1067,7 +1104,6 @@ route_output(struct mbuf *m, struct socket *so, ...) error = EINVAL; if (error != 0) senderr(error); - /* TODO: rebuild rtm from scratch */ } switch (rtm->rtm_type) { @@ -1079,9 +1115,6 @@ route_output(struct mbuf *m, struct socket *so, ...) } error = rib_action(fibnum, rtm->rtm_type, &info, &rc); if (error == 0) { -#ifdef INET6 - rti_need_deembed = 1; -#endif #ifdef ROUTE_MPATH if (NH_IS_NHGRP(rc.rc_nh_new) || (rc.rc_nh_old && NH_IS_NHGRP(rc.rc_nh_old))) { @@ -1110,12 +1143,7 @@ route_output(struct mbuf *m, struct socket *so, ...) } #endif nh = rc.rc_nh_old; - goto report; } -#ifdef INET6 - /* rt_msg2() will not be used when RTM_DELETE fails. */ - rti_need_deembed = 1; -#endif break; case RTM_GET: @@ -1124,13 +1152,18 @@ route_output(struct mbuf *m, struct socket *so, ...) senderr(error); nh = rc.rc_nh_new; -report: if (!can_export_rte(curthread->td_ucred, info.rti_info[RTAX_NETMASK] == NULL, info.rti_info[RTAX_DST])) { senderr(ESRCH); } + break; + default: + senderr(EOPNOTSUPP); + } + + if (error == 0) { error = update_rtm_from_rc(&info, &rtm, alloc_len, &rc, nh); /* * Note that some sockaddr pointers may have changed to @@ -1147,12 +1180,6 @@ report: #ifdef INET6 rti_need_deembed = 0; #endif - if (error != 0) - senderr(error); - break; - - default: - senderr(EOPNOTSUPP); } flush: @@ -1174,6 +1201,10 @@ flush: bcopy(sin6, info.rti_info[i], sizeof(*sin6)); } + if (update_rtm_from_info(&info, &rtm, alloc_len) != 0) { + if (error != 0) + error = ENOBUFS; + } } } #endif @@ -1350,9 +1381,10 @@ cleanup_xaddrs_lladdr(struct rt_addrinfo *info) } static int -cleanup_xaddrs_gateway(struct rt_addrinfo *info) +cleanup_xaddrs_gateway(struct rt_addrinfo *info, struct linear_buffer *lb) { struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + struct sockaddr *sa; if (info->rti_flags & RTF_LLDATA) return (cleanup_xaddrs_lladdr(info)); @@ -1362,11 +1394,17 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) case AF_INET: { struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; - if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { + + /* Ensure reads do not go beyoud SA boundary */ + if (SA_SIZE(gw) < offsetof(struct sockaddr_in, sin_zero)) { RTS_PID_PRINTF("gateway sin_len too small: %d", gw->sa_len); return (EINVAL); } - fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); + sa = alloc_sockaddr_aligned(lb, sizeof(struct sockaddr_in)); + if (sa == NULL) + return (ENOBUFS); + fill_sockaddr_inet((struct sockaddr_in *)sa, gw_sin->sin_addr); + info->rti_info[RTAX_GATEWAY] = sa; } break; #endif @@ -1392,13 +1430,17 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) RTS_PID_PRINTF("gateway sdl_len too small: %d", gw_sdl->sdl_len); return (EINVAL); } + sa = alloc_sockaddr_aligned(lb, sizeof(struct sockaddr_dl_short)); + if (sa == NULL) + return (ENOBUFS); const struct sockaddr_dl_short sdl = { .sdl_family = AF_LINK, - .sdl_len = sdl_min_len, + .sdl_len = sizeof(struct sockaddr_dl_short), .sdl_index = gw_sdl->sdl_index, }; - memcpy(gw_sdl, &sdl, sdl_min_len); + *((struct sockaddr_dl_short *)sa) = sdl; + info->rti_info[RTAX_GATEWAY] = sa; break; } } @@ -1416,39 +1458,57 @@ remove_netmask(struct rt_addrinfo *info) #ifdef INET static int -cleanup_xaddrs_inet(struct rt_addrinfo *info) +cleanup_xaddrs_inet(struct rt_addrinfo *info, struct linear_buffer *lb) { struct sockaddr_in *dst_sa, *mask_sa; + const int sa_len = sizeof(struct sockaddr_in); + struct in_addr dst, mask; /* Check & fixup dst/netmask combination first */ dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; - struct in_addr mask = { - .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, - }; - struct in_addr dst = { - .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) - }; - - if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { - printf("dst sin_len too small\n"); + /* Ensure reads do not go beyound the buffer size */ + if (SA_SIZE(dst_sa) < offsetof(struct sockaddr_in, sin_zero)) return (EINVAL); - } - if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { - RTS_PID_PRINTF("prefix mask sin_len too small: %d", mask_sa->sin_len); - return (EINVAL); - } + + if ((mask_sa != NULL) && mask_sa->sin_len < sizeof(struct sockaddr_in)) { + /* + * Some older routing software encode mask length into the + * sin_len, thus resulting in "truncated" sockaddr. + */ + int len = mask_sa->sin_len - offsetof(struct sockaddr_in, sin_addr); + if (len >= 0) { + mask.s_addr = 0; + if (len > sizeof(struct in_addr)) + len = sizeof(struct in_addr); + memcpy(&mask, &mask_sa->sin_addr, len); + } else { + RTS_PID_PRINTF("prefix mask sin_len too small: %d", mask_sa->sin_len); + return (EINVAL); + } + } else + mask.s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST; + + dst.s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)); + + /* Construct new "clean" dst/mask sockaddresses */ + if ((dst_sa = (struct sockaddr_in *)alloc_sockaddr_aligned(lb, sa_len)) == NULL) + return (ENOBUFS); fill_sockaddr_inet(dst_sa, dst); + info->rti_info[RTAX_DST] = (struct sockaddr *)dst_sa; - if (mask.s_addr != INADDR_BROADCAST) + if (mask.s_addr != INADDR_BROADCAST) { + if ((mask_sa = (struct sockaddr_in *)alloc_sockaddr_aligned(lb, sa_len)) == NULL) + return (ENOBUFS); fill_sockaddr_inet(mask_sa, mask); - else + info->rti_info[RTAX_NETMASK] = (struct sockaddr *)mask_sa; + } else remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) - return (cleanup_xaddrs_gateway(info)); + return (cleanup_xaddrs_gateway(info, lb)); return (0); } @@ -1456,43 +1516,66 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) #ifdef INET6 static int -cleanup_xaddrs_inet6(struct rt_addrinfo *info) +cleanup_xaddrs_inet6(struct rt_addrinfo *info, struct linear_buffer *lb) { + struct sockaddr *sa; struct sockaddr_in6 *dst_sa, *mask_sa; - struct in6_addr mask; + struct in6_addr mask, *dst; + const int sa_len = sizeof(struct sockaddr_in6); /* Check & fixup dst/netmask combination first */ dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; - mask = mask_sa ? mask_sa->sin6_addr : in6mask128; - IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); - if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { RTS_PID_PRINTF("prefix dst sin6_len too small: %d", dst_sa->sin6_len); return (EINVAL); } + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { - RTS_PID_PRINTF("rtsock: prefix mask sin6_len too small: %d", mask_sa->sin6_len); - return (EINVAL); - } - fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); + /* + * Some older routing software encode mask length into the + * sin6_len, thus resulting in "truncated" sockaddr. + */ + int len = mask_sa->sin6_len - offsetof(struct sockaddr_in6, sin6_addr); + if (len >= 0) { + bzero(&mask, sizeof(mask)); + if (len > sizeof(struct in6_addr)) + len = sizeof(struct in6_addr); + memcpy(&mask, &mask_sa->sin6_addr, len); + } else { + RTS_PID_PRINTF("rtsock: prefix mask sin6_len too small: %d", mask_sa->sin6_len); + return (EINVAL); + } + } else + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; - if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) - fill_sockaddr_inet6(mask_sa, &mask, 0); - else + dst = &dst_sa->sin6_addr; + IN6_MASK_ADDR(dst, &mask); + + if ((sa = alloc_sockaddr_aligned(lb, sa_len)) == NULL) + return (ENOBUFS); + fill_sockaddr_inet6((struct sockaddr_in6 *)sa, dst, 0); + info->rti_info[RTAX_DST] = sa; + + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) { + if ((sa = alloc_sockaddr_aligned(lb, sa_len)) == NULL) + return (ENOBUFS); + fill_sockaddr_inet6((struct sockaddr_in6 *)sa, &mask, 0); + info->rti_info[RTAX_NETMASK] = sa; + } else remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) - return (cleanup_xaddrs_gateway(info)); + return (cleanup_xaddrs_gateway(info, lb)); return (0); } #endif static int -cleanup_xaddrs(struct rt_addrinfo *info) +cleanup_xaddrs(struct rt_addrinfo *info, struct linear_buffer *lb) { int error = EAFNOSUPPORT; @@ -1511,12 +1594,12 @@ cleanup_xaddrs(struct rt_addrinfo *info) switch (info->rti_info[RTAX_DST]->sa_family) { #ifdef INET case AF_INET: - error = cleanup_xaddrs_inet(info); + error = cleanup_xaddrs_inet(info, lb); break; #endif #ifdef INET6 case AF_INET6: - error = cleanup_xaddrs_inet6(info); + error = cleanup_xaddrs_inet6(info, lb); break; #endif } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 21:51:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0169C5EA94E; Tue, 20 Apr 2021 21:51: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 4FPy7V6gYTz3n7y; Tue, 20 Apr 2021 21:51:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7F451A66C; Tue, 20 Apr 2021 21:51: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 13KLpYGH019796; Tue, 20 Apr 2021 21:51:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KLpY5g019795; Tue, 20 Apr 2021 21:51:34 GMT (envelope-from git) Date: Tue, 20 Apr 2021 21:51:34 GMT Message-Id: <202104202151.13KLpY5g019795@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: ccefbe98d86e - main - bsdinstall: remove compat hacks for FreeBSD 9 and earlier 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: ccefbe98d86e437097a64e00cfde0578b84f1d3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 21:51:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ccefbe98d86e437097a64e00cfde0578b84f1d3e commit ccefbe98d86e437097a64e00cfde0578b84f1d3e Author: Warner Losh AuthorDate: 2021-04-20 21:41:39 +0000 Commit: Warner Losh CommitDate: 2021-04-20 21:51:31 +0000 bsdinstall: remove compat hacks for FreeBSD 9 and earlier Sponsored by: Netflix --- usr.sbin/bsdinstall/distextract/distextract.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c index 81d83f982e30..8ad6c7b2c64b 100644 --- a/usr.sbin/bsdinstall/distextract/distextract.c +++ b/usr.sbin/bsdinstall/distextract/distextract.c @@ -53,11 +53,6 @@ static void sig_int(int sig); static int count_files(const char *file); static int extract_files(struct dpv_file_node *file, int out); -#if __FreeBSD_version <= 1000008 /* r232154: bump for libarchive update */ -#define archive_read_support_filter_all(x) \ - archive_read_support_compression_all(x) -#endif - #define _errx(...) (end_dialog(), errx(__VA_ARGS__)) int From owner-dev-commits-src-main@freebsd.org Tue Apr 20 21:51:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BF955EAB91; Tue, 20 Apr 2021 21:51: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 4FPy7X0d5Nz3mvr; Tue, 20 Apr 2021 21:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06B021A4E8; Tue, 20 Apr 2021 21:51: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 13KLpZxk019817; Tue, 20 Apr 2021 21:51:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KLpZMB019816; Tue, 20 Apr 2021 21:51:35 GMT (envelope-from git) Date: Tue, 20 Apr 2021 21:51:35 GMT Message-Id: <202104202151.13KLpZMB019816@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: 4cc5ae5a3922 - main - fwcontrol: Remove support for FreeBSD 4.x 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: 4cc5ae5a39226cb76248a87cca799e1ac594b9ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 21:51:36 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4cc5ae5a39226cb76248a87cca799e1ac594b9ac commit 4cc5ae5a39226cb76248a87cca799e1ac594b9ac Author: Warner Losh AuthorDate: 2021-04-20 21:44:35 +0000 Commit: Warner Losh CommitDate: 2021-04-20 21:51:31 +0000 fwcontrol: Remove support for FreeBSD 4.x Sponsored by: Netflix --- usr.sbin/fwcontrol/fwdv.c | 4 ---- usr.sbin/fwcontrol/fwmpegts.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/usr.sbin/fwcontrol/fwdv.c b/usr.sbin/fwcontrol/fwdv.c index 2baf1c43c803..510d22fcbf7b 100644 --- a/usr.sbin/fwcontrol/fwdv.c +++ b/usr.sbin/fwcontrol/fwdv.c @@ -40,11 +40,7 @@ #include #include #include - -#if __FreeBSD_version >= 500000 #include -#endif - #include #include #include diff --git a/usr.sbin/fwcontrol/fwmpegts.c b/usr.sbin/fwcontrol/fwmpegts.c index 509d941021c8..c744b53a7d46 100644 --- a/usr.sbin/fwcontrol/fwmpegts.c +++ b/usr.sbin/fwcontrol/fwmpegts.c @@ -40,11 +40,7 @@ #include #include #include - -#if __FreeBSD_version >= 500000 #include -#endif - #include #include #include From owner-dev-commits-src-main@freebsd.org Tue Apr 20 21:51:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87CFB5EAB92; Tue, 20 Apr 2021 21:51: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 4FPy7Y1kcmz3mw3; Tue, 20 Apr 2021 21:51:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21B2A1A840; Tue, 20 Apr 2021 21:51: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 13KLpbfK019838; Tue, 20 Apr 2021 21:51:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KLpbNN019837; Tue, 20 Apr 2021 21:51:37 GMT (envelope-from git) Date: Tue, 20 Apr 2021 21:51:37 GMT Message-Id: <202104202151.13KLpbNN019837@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: 8ef97d2ba339 - main - dconschat: Remove support for FreeBSD 4.x and earlier. 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: 8ef97d2ba339f84d96b0c68235da92903fbf54ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 21:51:37 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef97d2ba339f84d96b0c68235da92903fbf54ce commit 8ef97d2ba339f84d96b0c68235da92903fbf54ce Author: Warner Losh AuthorDate: 2021-04-20 21:46:56 +0000 Commit: Warner Losh CommitDate: 2021-04-20 21:51:31 +0000 dconschat: Remove support for FreeBSD 4.x and earlier. Sponsored by: Netflix --- usr.sbin/dconschat/dconschat.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/usr.sbin/dconschat/dconschat.c b/usr.sbin/dconschat/dconschat.c index 6d4750585df6..c7e21460226c 100644 --- a/usr.sbin/dconschat/dconschat.c +++ b/usr.sbin/dconschat/dconschat.c @@ -383,11 +383,7 @@ dconschat_fetch_header(struct dcons_state *dc) } if (ntohl(dbuf.version) != DCONS_VERSION) { snprintf(ebuf, sizeof(ebuf), -#if __FreeBSD_version < 500000 - "wrong version %ld,%d", -#else "wrong version %d,%d", -#endif ntohl(dbuf.version), DCONS_VERSION); /* XXX exit? */ dconschat_ready(dc, 0, ebuf); @@ -419,13 +415,8 @@ dconschat_fetch_header(struct dcons_state *dc) if (verbose) { printf("port %d size offset gen pos\n", j); -#if __FreeBSD_version < 500000 - printf("output: %5d %6ld %5d %5d\n" - "input : %5d %6ld %5d %5d\n", -#else printf("output: %5d %6d %5d %5d\n" "input : %5d %6d %5d %5d\n", -#endif o->size, ntohl(dbuf.ooffset[j]), o->gen, o->pos, i->size, ntohl(dbuf.ioffset[j]), i->gen, i->pos); } From owner-dev-commits-src-main@freebsd.org Tue Apr 20 22:41:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB3A5EC09D; Tue, 20 Apr 2021 22:41: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 4FPzFY2YbSz3qLN; Tue, 20 Apr 2021 22:41:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A9E81B31B; Tue, 20 Apr 2021 22:41: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 13KMfrBs086588; Tue, 20 Apr 2021 22:41:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13KMfrKB086583; Tue, 20 Apr 2021 22:41:53 GMT (envelope-from git) Date: Tue, 20 Apr 2021 22:41:53 GMT Message-Id: <202104202241.13KMfrKB086583@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: 33cb3cb2e321 - main - Fix rib generation count for fib algo. 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: 33cb3cb2e3212705b10e7885b37f70a3c2987c9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 22:41:53 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=33cb3cb2e3212705b10e7885b37f70a3c2987c9e commit 33cb3cb2e3212705b10e7885b37f70a3c2987c9e Author: Alexander V. Chernikov AuthorDate: 2021-04-17 18:58:12 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-20 22:02:41 +0000 Fix rib generation count for fib algo. Currently, PCB caching mechanism relies on the rib generation counter (rnh_gen) to invalidate cached nhops/LLE entries. With certain fib algorithms, it is now possible that the datapath lookup state applies RIB changes with some delay. In that scenario, PCB cache will invalidate on the RIB change, but the new lookup may result in the same nexthop being returned. When fib algo finally gets in sync with the RIB changes, PCB cache will not receive any notification and will end up caching the stale data. To fix this, introduce additional counter, rnh_gen_rib, which is used only when FIB_ALGO is enabled. This counter is incremented by the control plane. Each time when fib algo synchronises with the RIB, it updates rnh_gen to the current rnh_gen_rib value. Differential Revision: https://reviews.freebsd.org/D29812 Reviewed by: donner MFC after: 2 weeks --- sys/net/route/fib_algo.c | 13 ++++++++++++- sys/net/route/route_ctl.c | 6 +++--- sys/net/route/route_var.h | 15 ++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 30e715e1e1ef..91565d727a9c 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -525,6 +525,13 @@ schedule_fd_rebuild(struct fib_data *fd, const char *reason) } } +static void +sync_rib_gen(struct fib_data *fd) +{ + FD_PRINTF(LOG_DEBUG, fd, "Sync gen %u -> %u", fd->fd_rh->rnh_gen, fd->fd_rh->rnh_gen_rib); + fd->fd_rh->rnh_gen = fd->fd_rh->rnh_gen_rib; +} + static int64_t get_tv_diff_ms(const struct timeval *old_tv, const struct timeval *new_tv) { @@ -680,6 +687,7 @@ apply_rtable_changes(struct fib_data *fd) result = fd->fd_flm->flm_change_rib_items_cb(fd->fd_rh, q, fd->fd_algo_data); if (result == FLM_SUCCESS) { + sync_rib_gen(fd); for (int i = 0; i < q->count; i++) if (q->entries[i].nh_old) fib_unref_nhop(fd, q->entries[i].nh_old); @@ -811,6 +819,7 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, switch (result) { case FLM_SUCCESS: + sync_rib_gen(fd); /* Unref old nexthop on success */ if (rc->rc_nh_old != NULL) fib_unref_nhop(fd, rc->rc_nh_old); @@ -1236,7 +1245,9 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, result = try_setup_fd_instance(flm, rh, prev_fd, &new_fd); if ((result == FLM_SUCCESS) && attach) { - if (!fib_set_datapath_ptr(new_fd, &new_fd->fd_dp)) + if (fib_set_datapath_ptr(new_fd, &new_fd->fd_dp)) + sync_rib_gen(new_fd); + else result = FLM_REBUILD; } diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index fb3dfff87019..a0c4a2283a00 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -808,7 +808,7 @@ rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo *info, struct rib_cmd_info rt->rte_flags &= ~RTF_UP; /* Finalize notification */ - rnh->rnh_gen++; + rib_bump_gen(rnh); rnh->rnh_prefixes--; rc->rc_cmd = RTM_DELETE; @@ -1060,7 +1060,7 @@ add_route_nhop(struct rib_head *rnh, struct rtentry *rt, tmproutes_update(rnh, rt); /* Finalize notification */ - rnh->rnh_gen++; + rib_bump_gen(rnh); rnh->rnh_prefixes++; rc->rc_cmd = RTM_ADD; @@ -1116,7 +1116,7 @@ change_route_nhop(struct rib_head *rnh, struct rtentry *rt, } /* Finalize notification */ - rnh->rnh_gen++; + rib_bump_gen(rnh); if (rnd->rnd_nhop == NULL) rnh->rnh_prefixes--; diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index 427c286a5090..f12931476fd3 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -60,7 +60,7 @@ struct rib_head { rn_walktree_t *rnh_walktree; /* traverse tree */ rn_walktree_from_t *rnh_walktree_from; /* traverse tree below a */ rnh_preadd_entry_f_t *rnh_preadd; /* hook to alter record prior to insertion */ - rt_gen_t rnh_gen; /* generation counter */ + rt_gen_t rnh_gen; /* datapath generation counter */ int rnh_multipath; /* multipath capable ? */ struct radix_node rnh_nodes[3]; /* empty tree for common case */ struct rmlock rib_lock; /* config/data path lock */ @@ -71,6 +71,9 @@ struct rib_head { struct callout expire_callout; /* Callout for expiring dynamic routes */ time_t next_expire; /* Next expire run ts */ uint32_t rnh_prefixes; /* Number of prefixes */ +#ifdef FIB_ALGO + rt_gen_t rnh_gen_rib; /* rib generation counter */ +#endif uint32_t rib_dying:1; /* rib is detaching */ uint32_t rib_algo_fixed:1;/* fixed algorithm */ struct nh_control *nh_control; /* nexthop subsystem data */ @@ -116,6 +119,16 @@ CHK_STRUCT_ROUTE_FIELDS(_ro_new); \ _Static_assert(__offsetof(struct route, ro_dst) == __offsetof(_ro_new, _dst_new),\ "ro_dst and " #_dst_new " are at different offset") +static inline void +rib_bump_gen(struct rib_head *rnh) +{ +#ifdef FIB_ALGO + rnh->rnh_gen_rib++; +#else + rnh->rnh_gen++; +#endif +} + struct rib_head *rt_tables_get_rnh(uint32_t table, sa_family_t family); int rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum); struct rib_cmd_info; From owner-dev-commits-src-main@freebsd.org Wed Apr 21 08:06:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F1035FBB48; Wed, 21 Apr 2021 08:06: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 4FQCmX1pBCz4mh5; Wed, 21 Apr 2021 08:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3011B225E2; Wed, 21 Apr 2021 08:06: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 13L864v2033012; Wed, 21 Apr 2021 08:06:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L864mf033011; Wed, 21 Apr 2021 08:06:04 GMT (envelope-from git) Date: Wed, 21 Apr 2021 08:06:04 GMT Message-Id: <202104210806.13L864mf033011@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: 438b5532070f - main - arcmsr(4): Fix SCSI command timeout on ARC-1886. 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: 438b5532070f7c52e88f514380ee8662de1f600b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 08:06:04 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=438b5532070f7c52e88f514380ee8662de1f600b commit 438b5532070f7c52e88f514380ee8662de1f600b Author: Xin LI AuthorDate: 2021-04-21 08:03:54 +0000 Commit: Xin LI CommitDate: 2021-04-21 08:03:54 +0000 arcmsr(4): Fix SCSI command timeout on ARC-1886. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 MFC after: 2 weeks --- sys/dev/arcmsr/arcmsr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index f2217deb1ce0..f7f913de89af 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -83,6 +83,8 @@ ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter +** 1.50.00.02 04/16/2021 Ching Huang Fixed scsi command timeout on ARC-1886 when +** scatter-gather count large than some number ****************************************************************************************** */ @@ -140,7 +142,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.02 2021-04-16" #include /* ************************************************************************** @@ -1183,8 +1185,12 @@ static void arcmsr_post_srb(struct AdapterControlBlock *acb, struct CommandContr if (srb->arc_cdb_size <= 0x300) arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; - else - arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + else { + arc_cdb_size = ((srb->arc_cdb_size + 0xff) >> 8) + 2; + if (arc_cdb_size > 0xF) + arc_cdb_size = 0xF; + arc_cdb_size = (arc_cdb_size << 1) | 1; + } ccb_post_stamp = (srb->smid | arc_cdb_size); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); From owner-dev-commits-src-main@freebsd.org Wed Apr 21 08:22:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4ADB75FC50F; Wed, 21 Apr 2021 08:22: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 4FQD7C1gpjz4nQb; Wed, 21 Apr 2021 08:22:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AAE722C59; Wed, 21 Apr 2021 08:22: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 13L8MFOq059866; Wed, 21 Apr 2021 08:22:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L8MFel059865; Wed, 21 Apr 2021 08:22:15 GMT (envelope-from git) Date: Wed, 21 Apr 2021 08:22:15 GMT Message-Id: <202104210822.13L8MFel059865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 4ce1ba652383 - main - sndstat: nvlist schema and API definition changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ce1ba6523839b5c88331de22937b1e0483fc40b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 08:22:15 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=4ce1ba6523839b5c88331de22937b1e0483fc40b commit 4ce1ba6523839b5c88331de22937b1e0483fc40b Author: Ka Ho Ng AuthorDate: 2021-04-21 08:19:15 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-21 08:19:15 +0000 sndstat: nvlist schema and API definition changes - SNDSTAT_LABEL_* are renamed to SNDST_DSPS_*, and SNDSTAT_LABEL_DSPS becomes SNDST_DSPS. - Centralize channel number/rate/formats into a single nvlist The above nvlist is named "info_play" and "info_rec" - Expose only encoding format in pfmts/rfmts. Userland has no direct access to AFMT_ENCODING/CHANNEL/EXTCHANNEL macros, thus it serves no meaning to expose too much information through this pair of labels. However pminrate/rminrate, pmaxrate/rmaxrate, pfmts/rfmts are deprecated and will be removed in future. This commit keeps ioctls ABI compatibility with __FreeBSD_version 1400006 for now. In future the compat ABI with 1400006 will be removed once audio/virtual_oss is rebuilt. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29770 --- share/man/man4/sndstat.4 | 101 ++++++++------ sys/dev/sound/pcm/sndstat.c | 329 ++++++++++++++++++++++++++++++-------------- sys/sys/sndstat.h | 73 +++++----- 3 files changed, 322 insertions(+), 181 deletions(-) diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4 index ad5f4a76ea7e..26ecf9084dc1 100644 --- a/share/man/man4/sndstat.4 +++ b/share/man/man4/sndstat.4 @@ -31,7 +31,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd December 7, 2020 +.Dd April 15, 2021 .Dt SNDSTAT 4 .Os .Sh NAME @@ -52,7 +52,7 @@ device allows callers to enumeration PCM audio devices available for use. For all ioctls requiring data exchange between the subsystem and callers, the following structures are used to describe a serialized nvlist: .Bd -literal -offset indent -struct sndstat_nvlbuf_arg { +struct sndstioc_nv_arg { size_t nbytes; void *buf; }; @@ -67,9 +67,12 @@ dsps (NVLIST ARRAY): 1 desc (STRING): [Generic (0x8086) (Analog Line-out)] pchan (NUMBER): 1 (1) (0x1) rchan (NUMBER): 0 (0) (0x0) - pminrate (NUMBER): 48000 (48000) (0xbb80) - pmaxrate (NUMBER): 48000 (48000) (0xbb80) - pfmts (NUMBER): 2097168 (2097168) (0x200010) + info_play (NVLIST): + min_rate (NUMBER): 48000 (48000) (0xbb80) + max_rate (NUMBER): 48000 (48000) (0xbb80) + formats (NUMBER): 16 (16) (0x10) + min_chn (NUMBER): 2 (2) (0x2) + max_chn (NUMBER): 2 (2) (0x2) provider_info (NVLIST): unit (NUMBER): 0 (0) (0x0) bitperfect (BOOL): FALSE @@ -94,24 +97,38 @@ This can be 0 if this PCM audio device does not support playback at all. .It Dv rchan The number of recording channels supported by hardware. This can be 0 if this PCM audio device does not support recording at all. -.It Dv pminrate -The minimum supported playback direction sampling rate. -Only exists if pchan is greater than 0. -.It Dv pmaxrate -The maximum supported playback direction sampling rate. -Only exists if pchan is greater than 0. -.It Dv pfmts -The supported playback direction sample format. -Only exists if pchan is greater than 0. -.It Dv rminrate -The minimum supported recording direction sampling rate. -Only exists if rchan is greater than 0. -.It Dv rmaxrate -The maximum supported recording direction sampling rate. -Only exists if rchan is greater than 0. -.It Dv rfmts -The supported playback recording sample format. -Only exists if rchan is greater than 0. +.It Dv info_play +Supported configurations in playback direction. +This exists only if this PCM audio device supports playback. +There are a number of name/value pairs inside this field: +.Bl -tag -width ".Dv min_rate" +.It Dv min_rate +Minimum supported sampling rate. +.It Dv max_rate +Maximum supported sampling rate. +.It Dv formats +Supported sample formats. +.It Dv min_chn +Minimum supported number of channels in channel layout +.It Dv max_chn +Maximum supported number of channels in channel layout +.El +.It Dv info_rec +Supported configurations in recording direction. +This exists only if this PCM audio device supports recording. +There are a number of name/value pairs inside this field: +.Bl -tag -width ".Dv min_rate" +.It Dv min_rate +Minimum supported sampling rate. +.It Dv max_rate +Maximum supported sampling rate. +.It Dv formats +Supported sample formats. +.It Dv min_chn +Minimum supported number of channels in channel layout +.It Dv max_chn +Maximum supported number of channels in channel layout +.El .It Dv provider_info Provider-specific fields. This field may not exist if the PCM audio device is not provided by in-kernel @@ -121,15 +138,15 @@ This field will not exist if the provider field is an empty string. A string specifying the provider of the PCm audio device. .El .Pp -The following ioctls are providede for use: -.Bl -tag -width ".Dv SNDSTAT_FLUSH_USER_DEVS" -.It Dv SNDSTAT_REFRESH_DEVS +The following ioctls are provided for use: +.Bl -tag -width ".Dv SNDSTIOC_FLUSH_USER_DEVS" +.It Dv SNDSTIOC_REFRESH_DEVS Drop any previously fetched PCM audio devices list snapshots. This ioctl takes no arguments. -.It Dv SNDSTAT_GET_DEVS +.It Dv SNDSTIOC_GET_DEVS Generate and/or return PCM audio devices list snapshots to callers. This ioctl takes a pointer to -.Fa struct sndstat_nvlbuf_arg +.Fa struct sndstioc_nv_arg as the first and the only argument. Callers need to provide a sufficiently large buffer to hold a serialized nvlist. @@ -159,12 +176,12 @@ Once a PCM audio device list snapshot is returned to user-space successfully, the snapshot stored in the subsystem's internal structure of the given .Fa fd will be freed. -.It Dv SNDSTAT_ADD_USER_DEVS +.It Dv SNDSTIOC_ADD_USER_DEVS Add a list of PCM audio devices provided by callers to .Pa /dev/sndstat device. This ioctl takes a pointer to -.Fa struct sndstat_nvlbuf_arg +.Fa struct sndstioc_nv_arg as the first and the only argument. Callers have to provide a buffer holding a serialized nvlist. .Fa nbytes @@ -173,7 +190,7 @@ should be set to the length in bytes of the serialized nvlist. should be pointed to a buffer storing the serialized nvlist. Userspace-backed PCM audio device nodes should be listed inside the serialized nvlist. -.It Dv SNDSTAT_FLUSH_USER_DEVS +.It Dv SNDSTIOC_FLUSH_USER_DEVS Flush any PCM audio devices previously added by callers. This ioctl takes no arguments. .El @@ -198,7 +215,7 @@ int main() { int fd; - struct sndstat_nvlbuf_arg arg; + struct sndstioc_nv_arg arg; const nvlist_t * const *di; size_t i, nitems; nvlist_t *nvl; @@ -206,28 +223,28 @@ main() /* Open sndstat node in read-only first */ fd = open("/dev/sndstat", O_RDONLY); - if (ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)) - err(1, "ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)"); + if (ioctl(fd, SNDSTIOC_REFRESH_DEVS, NULL)) + err(1, "ioctl(fd, SNDSTIOC_REFRESH_DEVS, NULL)"); /* Get the size of snapshot, when nbytes = 0 */ arg.nbytes = 0; arg.buf = NULL; - if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) - err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + if (ioctl(fd, SNDSTIOC_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTIOC_GET_DEVS, &arg)"); /* Get snapshot data */ arg.buf = malloc(arg.nbytes); if (arg.buf == NULL) err(EX_OSERR, "malloc"); - if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) - err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + if (ioctl(fd, SNDSTIOC_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTIOC_GET_DEVS, &arg)"); /* Deserialize the nvlist stream */ nvl = nvlist_unpack(arg.buf, arg.nbytes, 0); free(arg.buf); /* Get DSPs array */ - di = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &nitems); + di = nvlist_get_nvlist_array(nvl, SNDST_DSPS, &nitems); for (i = 0; i < nitems; i++) { const char *nameunit, *devnode, *desc; @@ -235,9 +252,9 @@ main() * Examine each device nvlist item */ - nameunit = nvlist_get_string(di[i], SNDSTAT_LABEL_NAMEUNIT); - devnode = nvlist_get_string(di[i], SNDSTAT_LABEL_DEVNODE); - desc = nvlist_get_string(di[i], SNDSTAT_LABEL_DESC); + nameunit = nvlist_get_string(di[i], SNDST_DSPS_NAMEUNIT); + devnode = nvlist_get_string(di[i], SNDST_DSPS_DEVNODE); + desc = nvlist_get_string(di[i], SNDST_DSPS_DESC); printf("Name unit: `%s`, Device node: `%s`, Description: `%s`\n", nameunit, devnode, desc); } diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index e89af772fe72..ea36f4ba79ba 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -89,12 +89,13 @@ struct sndstat_userdev { char *desc; unsigned int pchan; unsigned int rchan; - uint32_t pminrate; - uint32_t pmaxrate; - uint32_t rminrate; - uint32_t rmaxrate; - uint32_t pfmts; - uint32_t rfmts; + struct { + uint32_t min_rate; + uint32_t max_rate; + uint32_t formats; + uint32_t min_chn; + uint32_t max_chn; + } info_play, info_rec; nvlist_t *provider_nvl; }; @@ -326,46 +327,77 @@ sndstat_write(struct cdev *i_dev, struct uio *buf, int flag) static void sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, - uint32_t *max_rate, uint32_t *fmts) + uint32_t *max_rate, uint32_t *fmts, uint32_t *minchn, uint32_t *maxchn) { struct pcm_channel *c; + unsigned int encoding; int dir; dir = play ? PCMDIR_PLAY : PCMDIR_REC; - *min_rate = 0; - *max_rate = 0; - *fmts = 0; if (play && d->pvchancount > 0) { *min_rate = *max_rate = d->pvchanrate; - *fmts = d->pvchanformat; + *fmts = AFMT_ENCODING(d->pvchanformat); + *minchn = *maxchn = AFMT_CHANNEL(d->pvchanformat); return; } else if (!play && d->rvchancount > 0) { *min_rate = *max_rate = d->rvchanrate; - *fmts = d->rvchanformat; + *fmts = AFMT_ENCODING(d->rvchanformat); + *minchn = *maxchn = AFMT_CHANNEL(d->rvchanformat); return; } + *min_rate = UINT32_MAX; + *max_rate = 0; + *minchn = UINT32_MAX; + *maxchn = 0; + encoding = 0; CHN_FOREACH(c, d, channels.pcm) { struct pcmchan_caps *caps; + int i; if (c->direction != dir || (c->flags & CHN_F_VIRTUAL) != 0) continue; CHN_LOCK(c); caps = chn_getcaps(c); - *min_rate = caps->minspeed; - *max_rate = caps->maxspeed; - *fmts = chn_getformats(c); + *min_rate = min(caps->minspeed, *min_rate); + *max_rate = max(caps->maxspeed, *max_rate); + for (i = 0; caps->fmtlist[i]; i++) { + encoding |= AFMT_ENCODING(caps->fmtlist[i]); + *minchn = min(AFMT_CHANNEL(encoding), *minchn); + *maxchn = max(AFMT_CHANNEL(encoding), *maxchn); + } CHN_UNLOCK(c); } + if (*min_rate == UINT32_MAX) + *min_rate = 0; + if (*minchn == UINT32_MAX) + *minchn = 0; +} + +static nvlist_t * +sndstat_create_diinfo_nv(uint32_t min_rate, uint32_t max_rate, uint32_t formats, + uint32_t min_chn, uint32_t max_chn) +{ + nvlist_t *nv; + + nv = nvlist_create(0); + if (nv == NULL) + return (NULL); + nvlist_add_number(nv, SNDST_DSPS_INFO_MIN_RATE, min_rate); + nvlist_add_number(nv, SNDST_DSPS_INFO_MAX_RATE, max_rate); + nvlist_add_number(nv, SNDST_DSPS_INFO_FORMATS, formats); + nvlist_add_number(nv, SNDST_DSPS_INFO_MIN_CHN, min_chn); + nvlist_add_number(nv, SNDST_DSPS_INFO_MAX_CHN, max_chn); + return (nv); } static int sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) { - uint32_t maxrate, minrate, fmts; - nvlist_t *di = NULL, *sound4di = NULL; + uint32_t maxrate, minrate, fmts, minchn, maxchn; + nvlist_t *di = NULL, *sound4di = NULL, *diinfo = NULL; int err; di = nvlist_create(0); @@ -379,40 +411,54 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) goto done; } - nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, false); - nvlist_add_stringf(di, SNDSTAT_LABEL_NAMEUNIT, "%s", + nvlist_add_bool(di, SNDST_DSPS_FROM_USER, false); + nvlist_add_stringf(di, SNDST_DSPS_NAMEUNIT, "%s", device_get_nameunit(d->dev)); - nvlist_add_stringf(di, SNDSTAT_LABEL_DEVNODE, "dsp%d", + nvlist_add_stringf(di, SNDST_DSPS_DEVNODE, "dsp%d", device_get_unit(d->dev)); nvlist_add_string( - di, SNDSTAT_LABEL_DESC, device_get_desc(d->dev)); + di, SNDST_DSPS_DESC, device_get_desc(d->dev)); PCM_ACQUIRE_QUICK(d); - nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, d->playcount); - nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, d->reccount); + nvlist_add_number(di, SNDST_DSPS_PCHAN, d->playcount); + nvlist_add_number(di, SNDST_DSPS_RCHAN, d->reccount); if (d->playcount > 0) { - sndstat_get_caps(d, true, &minrate, &maxrate, &fmts); - nvlist_add_number(di, SNDSTAT_LABEL_PMINRATE, minrate); - nvlist_add_number(di, SNDSTAT_LABEL_PMAXRATE, maxrate); - nvlist_add_number(di, SNDSTAT_LABEL_PFMTS, fmts); + sndstat_get_caps(d, true, &minrate, &maxrate, &fmts, &minchn, + &maxchn); + nvlist_add_number(di, "pminrate", minrate); + nvlist_add_number(di, "pmaxrate", maxrate); + nvlist_add_number(di, "pfmts", fmts); + diinfo = sndstat_create_diinfo_nv(minrate, maxrate, fmts, + minchn, maxchn); + if (diinfo == NULL) + nvlist_set_error(di, ENOMEM); + else + nvlist_move_nvlist(di, SNDST_DSPS_INFO_PLAY, diinfo); } if (d->reccount > 0) { - sndstat_get_caps(d, false, &minrate, &maxrate, &fmts); - nvlist_add_number(di, SNDSTAT_LABEL_RMINRATE, minrate); - nvlist_add_number(di, SNDSTAT_LABEL_RMAXRATE, maxrate); - nvlist_add_number(di, SNDSTAT_LABEL_RFMTS, fmts); + sndstat_get_caps(d, false, &minrate, &maxrate, &fmts, &minchn, + &maxchn); + nvlist_add_number(di, "rminrate", minrate); + nvlist_add_number(di, "rmaxrate", maxrate); + nvlist_add_number(di, "rfmts", fmts); + diinfo = sndstat_create_diinfo_nv(minrate, maxrate, fmts, + minchn, maxchn); + if (diinfo == NULL) + nvlist_set_error(di, ENOMEM); + else + nvlist_move_nvlist(di, SNDST_DSPS_INFO_REC, diinfo); } - nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_UNIT, + nvlist_add_number(sound4di, SNDST_DSPS_SOUND4_UNIT, device_get_unit(d->dev)); // XXX: I want signed integer here nvlist_add_bool( - sound4di, SNDSTAT_LABEL_SOUND4_BITPERFECT, d->flags & SD_F_BITPERFECT); - nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_PVCHAN, d->pvchancount); - nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_RVCHAN, d->rvchancount); - nvlist_move_nvlist(di, SNDSTAT_LABEL_PROVIDER_INFO, sound4di); + sound4di, SNDST_DSPS_SOUND4_BITPERFECT, d->flags & SD_F_BITPERFECT); + nvlist_add_number(sound4di, SNDST_DSPS_SOUND4_PVCHAN, d->pvchancount); + nvlist_add_number(sound4di, SNDST_DSPS_SOUND4_RVCHAN, d->rvchancount); + nvlist_move_nvlist(di, SNDST_DSPS_PROVIDER_INFO, sound4di); sound4di = NULL; PCM_RELEASE_QUICK(d); - nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, SNDSTAT_LABEL_SOUND4_PROVIDER); + nvlist_add_string(di, SNDST_DSPS_PROVIDER, SNDST_DSPS_SOUND4_PROVIDER); err = nvlist_error(di); if (err) @@ -431,7 +477,7 @@ done: static int sndstat_build_userland_nvlist(struct sndstat_userdev *ud, nvlist_t **dip) { - nvlist_t *di; + nvlist_t *di, *diinfo; int err; di = nvlist_create(0); @@ -440,34 +486,48 @@ sndstat_build_userland_nvlist(struct sndstat_userdev *ud, nvlist_t **dip) goto done; } - nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, true); - nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, ud->pchan); - nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, ud->rchan); - nvlist_add_string(di, SNDSTAT_LABEL_NAMEUNIT, ud->nameunit); + nvlist_add_bool(di, SNDST_DSPS_FROM_USER, true); + nvlist_add_number(di, SNDST_DSPS_PCHAN, ud->pchan); + nvlist_add_number(di, SNDST_DSPS_RCHAN, ud->rchan); + nvlist_add_string(di, SNDST_DSPS_NAMEUNIT, ud->nameunit); nvlist_add_string( - di, SNDSTAT_LABEL_DEVNODE, ud->devnode); - nvlist_add_string(di, SNDSTAT_LABEL_DESC, ud->desc); + di, SNDST_DSPS_DEVNODE, ud->devnode); + nvlist_add_string(di, SNDST_DSPS_DESC, ud->desc); if (ud->pchan != 0) { - nvlist_add_number( - di, SNDSTAT_LABEL_PMINRATE, ud->pminrate); - nvlist_add_number( - di, SNDSTAT_LABEL_PMAXRATE, ud->pmaxrate); - nvlist_add_number( - di, SNDSTAT_LABEL_PFMTS, ud->pfmts); + nvlist_add_number(di, "pminrate", + ud->info_play.min_rate); + nvlist_add_number(di, "pmaxrate", + ud->info_play.max_rate); + nvlist_add_number(di, "pfmts", + ud->info_play.formats); + diinfo = sndstat_create_diinfo_nv(ud->info_play.min_rate, + ud->info_play.max_rate, ud->info_play.formats, + ud->info_play.min_chn, ud->info_play.max_chn); + if (diinfo == NULL) + nvlist_set_error(di, ENOMEM); + else + nvlist_move_nvlist(di, SNDST_DSPS_INFO_PLAY, diinfo); } if (ud->rchan != 0) { - nvlist_add_number( - di, SNDSTAT_LABEL_RMINRATE, ud->rminrate); - nvlist_add_number( - di, SNDSTAT_LABEL_RMAXRATE, ud->rmaxrate); - nvlist_add_number( - di, SNDSTAT_LABEL_RFMTS, ud->rfmts); + nvlist_add_number(di, "rminrate", + ud->info_rec.min_rate); + nvlist_add_number(di, "rmaxrate", + ud->info_rec.max_rate); + nvlist_add_number(di, "rfmts", + ud->info_rec.formats); + diinfo = sndstat_create_diinfo_nv(ud->info_rec.min_rate, + ud->info_rec.max_rate, ud->info_rec.formats, + ud->info_rec.min_chn, ud->info_rec.max_chn); + if (diinfo == NULL) + nvlist_set_error(di, ENOMEM); + else + nvlist_move_nvlist(di, SNDST_DSPS_INFO_REC, diinfo); } - nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, + nvlist_add_string(di, SNDST_DSPS_PROVIDER, (ud->provider != NULL) ? ud->provider : ""); if (ud->provider_nvl != NULL) nvlist_add_nvlist( - di, SNDSTAT_LABEL_PROVIDER_INFO, ud->provider_nvl); + di, SNDST_DSPS_PROVIDER_INFO, ud->provider_nvl); err = nvlist_error(di); if (err) @@ -511,7 +571,7 @@ sndstat_create_devs_nvlist(nvlist_t **nvlp) if (err) goto done; - nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_append_nvlist_array(nvl, SNDST_DSPS, di); nvlist_destroy(di); err = nvlist_error(nvl); if (err) @@ -531,7 +591,7 @@ sndstat_create_devs_nvlist(nvlist_t **nvlp) sx_xunlock(&pf->lock); goto done; } - nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_append_nvlist_array(nvl, SNDST_DSPS, di); nvlist_destroy(di); err = nvlist_error(nvl); @@ -568,7 +628,7 @@ static int sndstat_get_devs(struct sndstat_file *pf, caddr_t data) { int err; - struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + struct sndstioc_nv_arg *arg = (struct sndstioc_nv_arg *)data; SNDSTAT_LOCK(); sx_xlock(&pf->lock); @@ -654,31 +714,65 @@ sndstat_unpack_user_nvlbuf(const void *unvlbuf, size_t nbytes, nvlist_t **nvl) return (0); } +static bool +sndstat_diinfo_is_sane(const nvlist_t *diinfo) +{ + if (!(nvlist_exists_number(diinfo, SNDST_DSPS_INFO_MIN_RATE) && + nvlist_exists_number(diinfo, SNDST_DSPS_INFO_MAX_RATE) && + nvlist_exists_number(diinfo, SNDST_DSPS_INFO_FORMATS) && + nvlist_exists_number(diinfo, SNDST_DSPS_INFO_MIN_CHN) && + nvlist_exists_number(diinfo, SNDST_DSPS_INFO_MAX_CHN))) + return (false); + return (true); +} + static bool sndstat_dsp_nvlist_is_sane(const nvlist_t *nvlist) { - if (!(nvlist_exists_string(nvlist, SNDSTAT_LABEL_DEVNODE) && - nvlist_exists_string(nvlist, SNDSTAT_LABEL_DESC) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_PCHAN) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_RCHAN))) + if (!(nvlist_exists_string(nvlist, SNDST_DSPS_DEVNODE) && + nvlist_exists_string(nvlist, SNDST_DSPS_DESC) && + nvlist_exists_number(nvlist, SNDST_DSPS_PCHAN) && + nvlist_exists_number(nvlist, SNDST_DSPS_RCHAN))) return (false); - if (nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN) > 0) - if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMINRATE) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMAXRATE) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_PFMTS))) + if (nvlist_get_number(nvlist, SNDST_DSPS_PCHAN) > 0) { + if (nvlist_exists_nvlist(nvlist, SNDST_DSPS_INFO_PLAY)) { + if (!sndstat_diinfo_is_sane(nvlist_get_nvlist(nvlist, + SNDST_DSPS_INFO_PLAY))) + return (false); + } else if (!(nvlist_exists_number(nvlist, "pminrate") && + nvlist_exists_number(nvlist, "pmaxrate") && + nvlist_exists_number(nvlist, "pfmts"))) return (false); + } - if (nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN) > 0) - if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMINRATE) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMAXRATE) && - nvlist_exists_number(nvlist, SNDSTAT_LABEL_RFMTS))) + if (nvlist_get_number(nvlist, SNDST_DSPS_RCHAN) > 0) { + if (nvlist_exists_nvlist(nvlist, SNDST_DSPS_INFO_REC)) { + if (!sndstat_diinfo_is_sane(nvlist_get_nvlist(nvlist, + SNDST_DSPS_INFO_REC))) + return (false); + } else if (!(nvlist_exists_number(nvlist, "rminrate") && + nvlist_exists_number(nvlist, "rmaxrate") && + nvlist_exists_number(nvlist, "rfmts"))) return (false); + } return (true); } +static void +sndstat_get_diinfo_nv(const nvlist_t *nv, uint32_t *min_rate, + uint32_t *max_rate, uint32_t *formats, uint32_t *min_chn, + uint32_t *max_chn) +{ + *min_rate = nvlist_get_number(nv, SNDST_DSPS_INFO_MIN_RATE); + *max_rate = nvlist_get_number(nv, SNDST_DSPS_INFO_MAX_RATE); + *formats = nvlist_get_number(nv, SNDST_DSPS_INFO_FORMATS); + *min_chn = nvlist_get_number(nv, SNDST_DSPS_INFO_MIN_CHN); + *max_chn = nvlist_get_number(nv, SNDST_DSPS_INFO_MAX_CHN); +} + static int sndstat_dsp_unpack_nvlist(const nvlist_t *nvlist, struct sndstat_userdev *ud) { @@ -687,36 +781,53 @@ sndstat_dsp_unpack_nvlist(const nvlist_t *nvlist, struct sndstat_userdev *ud) uint32_t pminrate = 0, pmaxrate = 0; uint32_t rminrate = 0, rmaxrate = 0; uint32_t pfmts = 0, rfmts = 0; + uint32_t pminchn = 0, pmaxchn = 0; + uint32_t rminchn = 0, rmaxchn = 0; nvlist_t *provider_nvl = NULL; + const nvlist_t *diinfo; const char *provider; - devnode = nvlist_get_string(nvlist, SNDSTAT_LABEL_DEVNODE); - if (nvlist_exists_string(nvlist, SNDSTAT_LABEL_NAMEUNIT)) - nameunit = nvlist_get_string(nvlist, SNDSTAT_LABEL_NAMEUNIT); + devnode = nvlist_get_string(nvlist, SNDST_DSPS_DEVNODE); + if (nvlist_exists_string(nvlist, SNDST_DSPS_NAMEUNIT)) + nameunit = nvlist_get_string(nvlist, SNDST_DSPS_NAMEUNIT); else nameunit = devnode; - desc = nvlist_get_string(nvlist, SNDSTAT_LABEL_DESC); - pchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN); - rchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN); + desc = nvlist_get_string(nvlist, SNDST_DSPS_DESC); + pchan = nvlist_get_number(nvlist, SNDST_DSPS_PCHAN); + rchan = nvlist_get_number(nvlist, SNDST_DSPS_RCHAN); if (pchan != 0) { - pminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMINRATE); - pmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMAXRATE); - pfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_PFMTS); + if (nvlist_exists_nvlist(nvlist, SNDST_DSPS_INFO_PLAY)) { + diinfo = nvlist_get_nvlist(nvlist, + SNDST_DSPS_INFO_PLAY); + sndstat_get_diinfo_nv(diinfo, &pminrate, &pmaxrate, + &pfmts, &pminchn, &pmaxchn); + } else { + pminrate = nvlist_get_number(nvlist, "pminrate"); + pmaxrate = nvlist_get_number(nvlist, "pmaxrate"); + pfmts = nvlist_get_number(nvlist, "pfmts"); + } } if (rchan != 0) { - rminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMINRATE); - rmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMAXRATE); - rfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_RFMTS); + if (nvlist_exists_nvlist(nvlist, SNDST_DSPS_INFO_REC)) { + diinfo = nvlist_get_nvlist(nvlist, + SNDST_DSPS_INFO_REC); + sndstat_get_diinfo_nv(diinfo, &rminrate, &rmaxrate, + &rfmts, &rminchn, &rmaxchn); + } else { + rminrate = nvlist_get_number(nvlist, "rminrate"); + rmaxrate = nvlist_get_number(nvlist, "rmaxrate"); + rfmts = nvlist_get_number(nvlist, "rfmts"); + } } - provider = dnvlist_get_string(nvlist, SNDSTAT_LABEL_PROVIDER, ""); + provider = dnvlist_get_string(nvlist, SNDST_DSPS_PROVIDER, ""); if (provider[0] == '\0') provider = NULL; if (provider != NULL && - nvlist_exists_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)) { + nvlist_exists_nvlist(nvlist, SNDST_DSPS_PROVIDER_INFO)) { provider_nvl = nvlist_clone( - nvlist_get_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)); + nvlist_get_nvlist(nvlist, SNDST_DSPS_PROVIDER_INFO)); if (provider_nvl == NULL) return (ENOMEM); } @@ -727,12 +838,16 @@ sndstat_dsp_unpack_nvlist(const nvlist_t *nvlist, struct sndstat_userdev *ud) ud->desc = strdup(desc, M_DEVBUF); ud->pchan = pchan; ud->rchan = rchan; - ud->pminrate = pminrate; - ud->pmaxrate = pmaxrate; - ud->rminrate = rminrate; - ud->rmaxrate = rmaxrate; - ud->pfmts = pfmts; - ud->rfmts = rfmts; + ud->info_play.min_rate = pminrate; + ud->info_play.max_rate = pmaxrate; + ud->info_play.formats = pfmts; + ud->info_play.min_chn = pminchn; + ud->info_play.max_chn = pmaxchn; + ud->info_rec.min_rate = rminrate; + ud->info_rec.max_rate = rmaxrate; + ud->info_rec.formats = rfmts; + ud->info_rec.min_chn = rminchn; + ud->info_rec.max_chn = rmaxchn; ud->provider_nvl = provider_nvl; return (0); } @@ -744,7 +859,7 @@ sndstat_add_user_devs(struct sndstat_file *pf, caddr_t data) nvlist_t *nvl = NULL; const nvlist_t * const *dsps; size_t i, ndsps; - struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + struct sndstioc_nv_arg *arg = (struct sndstioc_nv_arg *)data; if ((pf->fflags & FWRITE) == 0) { err = EPERM; @@ -755,11 +870,11 @@ sndstat_add_user_devs(struct sndstat_file *pf, caddr_t data) if (err != 0) goto done; - if (!nvlist_exists_nvlist_array(nvl, SNDSTAT_LABEL_DSPS)) { + if (!nvlist_exists_nvlist_array(nvl, SNDST_DSPS)) { err = EINVAL; goto done; } - dsps = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &ndsps); + dsps = nvlist_get_nvlist_array(nvl, SNDST_DSPS, &ndsps); for (i = 0; i < ndsps; i++) { if (!sndstat_dsp_nvlist_is_sane(dsps[i])) { err = EINVAL; @@ -801,8 +916,8 @@ sndstat_flush_user_devs(struct sndstat_file *pf) static int compat_sndstat_get_devs32(struct sndstat_file *pf, caddr_t data) { - struct sndstat_nvlbuf_arg32 *arg32 = (struct sndstat_nvlbuf_arg32 *)data; - struct sndstat_nvlbuf_arg arg; + struct sndstioc_nv_arg32 *arg32 = (struct sndstioc_nv_arg32 *)data; + struct sndstioc_nv_arg arg; int err; arg.buf = (void *)(uintptr_t)arg32->buf; @@ -820,8 +935,8 @@ compat_sndstat_get_devs32(struct sndstat_file *pf, caddr_t data) static int compat_sndstat_add_user_devs32(struct sndstat_file *pf, caddr_t data) { - struct sndstat_nvlbuf_arg32 *arg32 = (struct sndstat_nvlbuf_arg32 *)data; - struct sndstat_nvlbuf_arg arg; + struct sndstioc_nv_arg32 *arg32 = (struct sndstioc_nv_arg32 *)data; + struct sndstioc_nv_arg arg; int err; arg.buf = (void *)(uintptr_t)arg32->buf; @@ -849,11 +964,11 @@ sndstat_ioctl( return (err); switch (cmd) { - case SNDSTAT_GET_DEVS: + case SNDSTIOC_GET_DEVS: err = sndstat_get_devs(pf, data); break; #ifdef COMPAT_FREEBSD32 - case SNDSTAT_GET_DEVS32: + case SNDSTIOC_GET_DEVS32: if (!SV_CURPROC_FLAG(SV_ILP32)) { err = ENODEV; break; @@ -861,11 +976,11 @@ sndstat_ioctl( err = compat_sndstat_get_devs32(pf, data); break; #endif - case SNDSTAT_ADD_USER_DEVS: + case SNDSTIOC_ADD_USER_DEVS: err = sndstat_add_user_devs(pf, data); break; #ifdef COMPAT_FREEBSD32 - case SNDSTAT_ADD_USER_DEVS32: + case SNDSTIOC_ADD_USER_DEVS32: if (!SV_CURPROC_FLAG(SV_ILP32)) { err = ENODEV; break; @@ -873,10 +988,10 @@ sndstat_ioctl( err = compat_sndstat_add_user_devs32(pf, data); break; #endif - case SNDSTAT_REFRESH_DEVS: + case SNDSTIOC_REFRESH_DEVS: err = sndstat_refresh_devs(pf); break; - case SNDSTAT_FLUSH_USER_DEVS: + case SNDSTIOC_FLUSH_USER_DEVS: err = sndstat_flush_user_devs(pf); break; default: diff --git a/sys/sys/sndstat.h b/sys/sys/sndstat.h index 995d474f8290..bd9b76e1652d 100644 --- a/sys/sys/sndstat.h +++ b/sys/sys/sndstat.h @@ -38,56 +38,65 @@ #include #endif /* !_IOWR */ -struct sndstat_nvlbuf_arg { +struct sndstioc_nv_arg { size_t nbytes; /* [IN/OUT] buffer size/number of bytes filled */ void *buf; /* [OUT] buffer holding a packed nvlist */ }; /* - * Common labels + * Common name/value pair names */ -#define SNDSTAT_LABEL_DSPS "dsps" -#define SNDSTAT_LABEL_FROM_USER "from_user" -#define SNDSTAT_LABEL_PCHAN "pchan" -#define SNDSTAT_LABEL_RCHAN "rchan" -#define SNDSTAT_LABEL_PMINRATE "pminrate" -#define SNDSTAT_LABEL_PMAXRATE "pmaxrate" -#define SNDSTAT_LABEL_RMINRATE "rminrate" -#define SNDSTAT_LABEL_RMAXRATE "rmaxrate" -#define SNDSTAT_LABEL_PFMTS "pfmts" -#define SNDSTAT_LABEL_RFMTS "rfmts" -#define SNDSTAT_LABEL_NAMEUNIT "nameunit" -#define SNDSTAT_LABEL_DEVNODE "devnode" -#define SNDSTAT_LABEL_DESC "desc" -#define SNDSTAT_LABEL_PROVIDER "provider" -#define SNDSTAT_LABEL_PROVIDER_INFO "provider_info" +#define SNDST_DSPS "dsps" +#define SNDST_DSPS_FROM_USER "from_user" +#define SNDST_DSPS_PCHAN "pchan" +#define SNDST_DSPS_RCHAN "rchan" +#define SNDST_DSPS_NAMEUNIT "nameunit" +#define SNDST_DSPS_DEVNODE "devnode" +#define SNDST_DSPS_DESC "desc" +#define SNDST_DSPS_PROVIDER "provider" +#define SNDST_DSPS_PROVIDER_INFO "provider_info" /* - * sound(4)-specific labels + * Common name/value pair names for play/rec info */ -#define SNDSTAT_LABEL_SOUND4_PROVIDER "sound(4)" -#define SNDSTAT_LABEL_SOUND4_UNIT "unit" -#define SNDSTAT_LABEL_SOUND4_BITPERFECT "bitperfect" -#define SNDSTAT_LABEL_SOUND4_PVCHAN "pvchan" -#define SNDSTAT_LABEL_SOUND4_RVCHAN "rvchan" +#define SNDST_DSPS_INFO_PLAY "info_play" +#define SNDST_DSPS_INFO_REC "info_rec" +#define SNDST_DSPS_INFO_MIN_RATE "min_rate" +#define SNDST_DSPS_INFO_MAX_RATE "max_rate" +#define SNDST_DSPS_INFO_FORMATS "formats" +#define SNDST_DSPS_INFO_MIN_CHN "min_chn" +#define SNDST_DSPS_INFO_MAX_CHN "max_chn" -#define SNDSTAT_REFRESH_DEVS _IO('D', 100) -#define SNDSTAT_GET_DEVS _IOWR('D', 101, struct sndstat_nvlbuf_arg) -#define SNDSTAT_ADD_USER_DEVS _IOWR('D', 102, struct sndstat_nvlbuf_arg) -#define SNDSTAT_FLUSH_USER_DEVS _IO('D', 103) +/* + * sound(4)-specific name/value pair names + */ +#define SNDST_DSPS_SOUND4_PROVIDER "sound(4)" +#define SNDST_DSPS_SOUND4_UNIT "unit" +#define SNDST_DSPS_SOUND4_BITPERFECT "bitperfect" +#define SNDST_DSPS_SOUND4_PVCHAN "pvchan" +#define SNDST_DSPS_SOUND4_RVCHAN "rvchan" + +#define SNDSTIOC_REFRESH_DEVS \ + _IO('D', 100) +#define SNDSTIOC_GET_DEVS \ + _IOWR('D', 101, struct sndstioc_nv_arg) +#define SNDSTIOC_ADD_USER_DEVS \ + _IOWR('D', 102, struct sndstioc_nv_arg) +#define SNDSTIOC_FLUSH_USER_DEVS \ + _IO('D', 103) #ifdef _KERNEL #ifdef COMPAT_FREEBSD32 -struct sndstat_nvlbuf_arg32 { +struct sndstioc_nv_arg32 { uint32_t nbytes; uint32_t buf; }; -#define SNDSTAT_GET_DEVS32 \ - _IOC_NEWTYPE(SNDSTAT_GET_DEVS, struct sndstat_nvlbuf_arg32) -#define SNDSTAT_ADD_USER_DEVS32 \ - _IOC_NEWTYPE(SNDSTAT_ADD_USER_DEVS, struct sndstat_nvlbuf_arg32) +#define SNDSTIOC_GET_DEVS32 \ + _IOC_NEWTYPE(SNDSTIOC_GET_DEVS, struct sndstioc_nv_arg32) +#define SNDSTIOC_ADD_USER_DEVS32 \ + _IOC_NEWTYPE(SNDSTIOC_ADD_USER_DEVS, struct sndstioc_nv_arg32) #endif #endif From owner-dev-commits-src-main@freebsd.org Wed Apr 21 08:22:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E3E35FC3A1; Wed, 21 Apr 2021 08:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQD7D2wgNz4nbf; Wed, 21 Apr 2021 08:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E35422F9D; Wed, 21 Apr 2021 08:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13L8MGOG059894; Wed, 21 Apr 2021 08:22:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L8MGVj059893; Wed, 21 Apr 2021 08:22:16 GMT (envelope-from git) Date: Wed, 21 Apr 2021 08:22:16 GMT Message-Id: <202104210822.13L8MGVj059893@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: a3a02acde100 - main - param.h: bump __FreeBSD_version for commit 4ce1ba652383 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3a02acde1009f03dc78e979e051acee9f9247c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 08:22:16 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=a3a02acde1009f03dc78e979e051acee9f9247c2 commit a3a02acde1009f03dc78e979e051acee9f9247c2 Author: Ka Ho Ng AuthorDate: 2021-04-15 09:54:54 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-21 08:21:08 +0000 param.h: bump __FreeBSD_version for commit 4ce1ba652383 Commit 4ce1ba652383 changed the sndstat(4) ioctls nvlist schema and definitions. Approved by: philip (mentor) --- 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 24c335b06a8c..fbdb0eb6ea0d 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400009 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400010 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Wed Apr 21 09:58:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 766A05FECBC; Wed, 21 Apr 2021 09:58: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 4FQGFs2tGWz4sNS; Wed, 21 Apr 2021 09:58:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55C3C24048; Wed, 21 Apr 2021 09:58: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 13L9w964079645; Wed, 21 Apr 2021 09:58:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L9w9cF079644; Wed, 21 Apr 2021 09:58:09 GMT (envelope-from git) Date: Wed, 21 Apr 2021 09:58:09 GMT Message-Id: <202104210958.13L9w9cF079644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 3bca8d2b3270 - main - Revert "contrib/flex: Drop local __dead2 patch" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bca8d2b3270c38e67c1c851b1dae9d8cb921b69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 09:58:09 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3bca8d2b3270c38e67c1c851b1dae9d8cb921b69 commit 3bca8d2b3270c38e67c1c851b1dae9d8cb921b69 Author: Alex Richardson AuthorDate: 2021-04-21 09:48:12 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:48:47 +0000 Revert "contrib/flex: Drop local __dead2 patch" I missed the review comment to commit the changes separately, will reland in multiple smaller commits. Requested By: jkim This reverts commit bbd421cdf6d8c6102e6fd3979c5bec21ace3c2e3. --- contrib/flex/src/flex.skl | 8 +- tools/build/bootstrap-m4/inittokenizer.c | 414 +++++++++++++++---------------- usr.bin/lex/initscan.c | 16 +- usr.bin/lex/initskel.c | 8 +- 4 files changed, 220 insertions(+), 226 deletions(-) diff --git a/contrib/flex/src/flex.skl b/contrib/flex/src/flex.skl index 304e664e4c62..c23b944ea473 100644 --- a/contrib/flex/src/flex.skl +++ b/contrib/flex/src/flex.skl @@ -216,6 +216,12 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], /* First, we deal with platform-specific or compiler-specific issues. */ +#if defined(__FreeBSD__) +#include +#else +#define __dead2 +#endif + /* begin standard C headers. */ %if-c-only #include @@ -647,7 +653,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG); static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG ); -static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ); +static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ) __dead2; ]]) %endif diff --git a/tools/build/bootstrap-m4/inittokenizer.c b/tools/build/bootstrap-m4/inittokenizer.c index a014012ad756..0c07f1ec2275 100644 --- a/tools/build/bootstrap-m4/inittokenizer.c +++ b/tools/build/bootstrap-m4/inittokenizer.c @@ -1,6 +1,4 @@ -#line 1 "tokenizer.c" -#line 3 "tokenizer.c" #define YY_INT_ALIGNED short int @@ -8,14 +6,24 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 37 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ +#if defined(__FreeBSD__) +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif +#include +#include +#else +#define __dead2 +#endif + /* begin standard C headers. */ #include #include @@ -85,61 +93,65 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -/* begin standard C++ headers. */ +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST -/* TODO: this is always defined, so inline it */ -#define yyconst const +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) +#ifdef YY_USE_CONST +#define yyconst const #else -#define yynoreturn +#define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * + /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START + /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) + #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -156,16 +168,15 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int yyleng; +extern yy_size_t yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -180,6 +191,7 @@ extern FILE *yyin, *yyout; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -194,12 +206,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - int yy_buf_size; + yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -222,7 +234,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -250,7 +262,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -262,6 +274,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) #define yy_current_buffer YY_CURRENT_BUFFER + /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -269,11 +282,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; +static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -282,81 +295,85 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart ( FILE *input_file ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); -void yy_delete_buffer ( YY_BUFFER_STATE b ); -void yy_flush_buffer ( YY_BUFFER_STATE b ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state ( void ); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); -static void yyensure_buffer_stack ( void ); -static void yy_load_buffer_state ( void ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer + #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } + #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define yywrap() (/*CONSTCOND*/1) +#define yywrap() 1 #define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; -FILE *yyin = NULL, *yyout = NULL; +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; + int yylineno = 1; extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif #define yytext_ptr yytext -static yy_state_type yy_get_previous_state ( void ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); -static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ) __dead2; /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; + #define YY_NUM_RULES 14 #define YY_END_OF_BUFFER 15 /* This struct is not used in this scanner, @@ -366,7 +383,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[35] = +static yyconst flex_int16_t yy_accept[35] = { 0, 0, 0, 15, 13, 1, 1, 13, 13, 13, 2, 2, 13, 13, 13, 13, 1, 9, 10, 12, 2, @@ -374,7 +391,7 @@ static const flex_int16_t yy_accept[35] = 2, 0, 3, 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -406,13 +423,13 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[19] = +static yyconst flex_int32_t yy_meta[19] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 3, 4, 4, 4, 1 } ; -static const flex_int16_t yy_base[39] = +static yyconst flex_int16_t yy_base[39] = { 0, 0, 0, 48, 49, 17, 19, 35, 41, 39, 16, 0, 14, 32, 15, 25, 27, 49, 49, 49, 27, @@ -420,7 +437,7 @@ static const flex_int16_t yy_base[39] = 0, 0, 0, 49, 39, 29, 34, 36 } ; -static const flex_int16_t yy_def[39] = +static yyconst flex_int16_t yy_def[39] = { 0, 34, 1, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, @@ -428,7 +445,7 @@ static const flex_int16_t yy_def[39] = 37, 38, 38, 0, 34, 34, 34, 34 } ; -static const flex_int16_t yy_nxt[68] = +static yyconst flex_int16_t yy_nxt[68] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 11, 4, 12, 13, 14, 4, 4, 4, 4, 15, 16, 16, @@ -439,7 +456,7 @@ static const flex_int16_t yy_nxt[68] = 34, 34, 34, 34, 34, 34, 34 } ; -static const flex_int16_t yy_chk[68] = +static yyconst flex_int16_t yy_chk[68] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, @@ -464,9 +481,7 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "tokenizer.l" #define YY_NO_INPUT 1 -#line 3 "tokenizer.l" /* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ /* * Copyright (c) 2004 Marc Espie @@ -501,8 +516,6 @@ int32_t parse_radix(void); extern int yylex(void); #define YY_DECL int yylex(void) -#line 504 "tokenizer.c" -#line 505 "tokenizer.c" #define INITIAL 0 @@ -518,36 +531,36 @@ extern int yylex(void); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals ( void ); +static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( void ); +int yylex_destroy (void ); -int yyget_debug ( void ); +int yyget_debug (void ); -void yyset_debug ( int debug_flag ); +void yyset_debug (int debug_flag ); -YY_EXTRA_TYPE yyget_extra ( void ); +YY_EXTRA_TYPE yyget_extra (void ); -void yyset_extra ( YY_EXTRA_TYPE user_defined ); +void yyset_extra (YY_EXTRA_TYPE user_defined ); -FILE *yyget_in ( void ); +FILE *yyget_in (void ); -void yyset_in ( FILE * _in_str ); +void yyset_in (FILE * in_str ); -FILE *yyget_out ( void ); +FILE *yyget_out (void ); -void yyset_out ( FILE * _out_str ); +void yyset_out (FILE * out_str ); - int yyget_leng ( void ); +yy_size_t yyget_leng (void ); -char *yyget_text ( void ); +char *yyget_text (void ); -int yyget_lineno ( void ); +int yyget_lineno (void ); -void yyset_lineno ( int _line_number ); +void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -555,41 +568,33 @@ void yyset_lineno ( int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( void ); +extern "C" int yywrap (void ); #else -extern int yywrap ( void ); -#endif +extern int yywrap (void ); #endif - -#ifndef YY_NO_UNPUT - #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int ); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * ); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput ( void ); +static int yyinput (void ); #else -static int input ( void ); +static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -597,7 +602,7 @@ static int input ( void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -608,7 +613,7 @@ static int input ( void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -621,7 +626,7 @@ static int input ( void ); else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -676,7 +681,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -690,6 +695,8 @@ YY_DECL char *yy_cp, *yy_bp; int yy_act; + + if ( !(yy_init) ) { (yy_init) = 1; @@ -710,18 +717,13 @@ YY_DECL if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } - yy_load_buffer_state( ); + yy_load_buffer_state( ); } - { -#line 48 "tokenizer.l" - -#line 722 "tokenizer.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -747,9 +749,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 49 ); @@ -779,17 +781,14 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 49 "tokenizer.l" {/* just skip it */} YY_BREAK case 2: YY_RULE_SETUP -#line 50 "tokenizer.l" { yylval = number(); return(NUMBER); } YY_BREAK case 3: YY_RULE_SETUP -#line 51 "tokenizer.l" { if (mimic_gnu) { yylval = parse_radix(); return(NUMBER); } else { @@ -799,60 +798,48 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 57 "tokenizer.l" { return(LE); } YY_BREAK case 5: YY_RULE_SETUP -#line 58 "tokenizer.l" { return(GE); } YY_BREAK case 6: YY_RULE_SETUP -#line 59 "tokenizer.l" { return(LSHIFT); } YY_BREAK case 7: YY_RULE_SETUP -#line 60 "tokenizer.l" { return(RSHIFT); } YY_BREAK case 8: YY_RULE_SETUP -#line 61 "tokenizer.l" { return(EQ); } YY_BREAK case 9: YY_RULE_SETUP -#line 62 "tokenizer.l" { return(NE); } YY_BREAK case 10: YY_RULE_SETUP -#line 63 "tokenizer.l" { return(LAND); } YY_BREAK case 11: YY_RULE_SETUP -#line 64 "tokenizer.l" { return(LOR); } YY_BREAK case 12: YY_RULE_SETUP -#line 65 "tokenizer.l" { if (mimic_gnu) { return (EXPONENT); } } YY_BREAK case 13: YY_RULE_SETUP -#line 66 "tokenizer.l" { return yytext[0]; } YY_BREAK case 14: YY_RULE_SETUP -#line 67 "tokenizer.l" ECHO; YY_BREAK -#line 855 "tokenizer.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -930,7 +917,7 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -983,7 +970,6 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1026,7 +1012,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1039,7 +1025,7 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1053,7 +1039,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1062,12 +1048,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; + b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1095,7 +1080,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else @@ -1109,15 +1094,12 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1150,9 +1132,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -1178,18 +1160,14 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 34); return yy_is_jam ? 0 : yy_current_state; } -#ifndef YY_NO_UNPUT - -#endif - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1214,7 +1192,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1231,14 +1209,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) - return 0; + if ( yywrap( ) ) + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1275,11 +1253,11 @@ static int yy_get_next_buffer (void) if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -1307,7 +1285,7 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag @@ -1335,7 +1313,7 @@ static void yy_load_buffer_state (void) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1344,13 +1322,13 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; } @@ -1369,9 +1347,9 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); + yyfree((void *) b->yy_ch_buf ); - yyfree( (void *) b ); + yyfree((void *) b ); } /* Initializes or reinitializes a buffer. @@ -1383,7 +1361,7 @@ static void yy_load_buffer_state (void) { int oerrno = errno; - yy_flush_buffer( b ); + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1426,7 +1404,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1457,7 +1435,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1476,7 +1454,7 @@ void yypop_buffer_state (void) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1494,15 +1472,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1511,7 +1489,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc @@ -1531,7 +1509,7 @@ static void yyensure_buffer_stack (void) * @param base the character buffer *** 329 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Apr 21 09:58:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C72425FECC2; Wed, 21 Apr 2021 09:58: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 4FQGFt4y23z4sW6; Wed, 21 Apr 2021 09:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F8A823FD0; Wed, 21 Apr 2021 09:58: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 13L9wAU3079675; Wed, 21 Apr 2021 09:58:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L9wACg079674; Wed, 21 Apr 2021 09:58:10 GMT (envelope-from git) Date: Wed, 21 Apr 2021 09:58:10 GMT Message-Id: <202104210958.13L9wACg079674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d37f81e35b6e - main - contrib/flex: Drop local __dead2 patch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d37f81e35b6e8f114b04315e06bab2cf0c03946c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 09:58:10 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d37f81e35b6e8f114b04315e06bab2cf0c03946c commit d37f81e35b6e8f114b04315e06bab2cf0c03946c Author: Alex Richardson AuthorDate: 2021-04-21 09:48:55 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:54:59 +0000 contrib/flex: Drop local __dead2 patch Upstream flex has added a yynoreturn macro, so this diff is no longer needed. Partially reverts r181269. Reviewed By: jkim Differential Revision: https://reviews.freebsd.org/D29679 --- contrib/flex/src/flex.skl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/contrib/flex/src/flex.skl b/contrib/flex/src/flex.skl index c23b944ea473..304e664e4c62 100644 --- a/contrib/flex/src/flex.skl +++ b/contrib/flex/src/flex.skl @@ -216,12 +216,6 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], /* First, we deal with platform-specific or compiler-specific issues. */ -#if defined(__FreeBSD__) -#include -#else -#define __dead2 -#endif - /* begin standard C headers. */ %if-c-only #include @@ -653,7 +647,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG); static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG ); -static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ) __dead2; +static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ); ]]) %endif From owner-dev-commits-src-main@freebsd.org Wed Apr 21 09:58:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 149025FEE09; Wed, 21 Apr 2021 09:58: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 4FQGFw6SJ0z4sYt; Wed, 21 Apr 2021 09:58:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA76A23DF8; Wed, 21 Apr 2021 09:58: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 13L9wCB0079719; Wed, 21 Apr 2021 09:58:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L9wC8a079718; Wed, 21 Apr 2021 09:58:12 GMT (envelope-from git) Date: Wed, 21 Apr 2021 09:58:12 GMT Message-Id: <202104210958.13L9wC8a079718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: f8e57f89f3f5 - main - tools/build/bootstrap-m4: regenerate after d37f81e35b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8e57f89f3f550501c54ce839213a08981ff9250 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 09:58:13 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=f8e57f89f3f550501c54ce839213a08981ff9250 commit f8e57f89f3f550501c54ce839213a08981ff9250 Author: Alex Richardson AuthorDate: 2021-04-21 09:53:04 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:57:51 +0000 tools/build/bootstrap-m4: regenerate after d37f81e35b Reviewed by: jkim --- tools/build/bootstrap-m4/inittokenizer.c | 414 ++++++++++++++++--------------- 1 file changed, 219 insertions(+), 195 deletions(-) diff --git a/tools/build/bootstrap-m4/inittokenizer.c b/tools/build/bootstrap-m4/inittokenizer.c index 0c07f1ec2275..a014012ad756 100644 --- a/tools/build/bootstrap-m4/inittokenizer.c +++ b/tools/build/bootstrap-m4/inittokenizer.c @@ -1,4 +1,6 @@ +#line 1 "tokenizer.c" +#line 3 "tokenizer.c" #define YY_INT_ALIGNED short int @@ -6,24 +8,14 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ -#if defined(__FreeBSD__) -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS -#endif -#include -#include -#else -#define __dead2 -#endif - /* begin standard C headers. */ #include #include @@ -93,65 +85,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -168,15 +156,16 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; +extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -191,7 +180,6 @@ extern FILE *yyin, *yyout; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -206,12 +194,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -234,7 +222,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -262,7 +250,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -274,7 +262,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) #define yy_current_buffer YY_CURRENT_BUFFER - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -282,11 +269,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -295,85 +282,81 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); #define yy_new_buffer yy_create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define yywrap() 1 +#define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; - int yylineno = 1; extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ) __dead2; +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 14 #define YY_END_OF_BUFFER 15 /* This struct is not used in this scanner, @@ -383,7 +366,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[35] = +static const flex_int16_t yy_accept[35] = { 0, 0, 0, 15, 13, 1, 1, 13, 13, 13, 2, 2, 13, 13, 13, 13, 1, 9, 10, 12, 2, @@ -391,7 +374,7 @@ static yyconst flex_int16_t yy_accept[35] = 2, 0, 3, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -423,13 +406,13 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[19] = +static const YY_CHAR yy_meta[19] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 3, 4, 4, 4, 1 } ; -static yyconst flex_int16_t yy_base[39] = +static const flex_int16_t yy_base[39] = { 0, 0, 0, 48, 49, 17, 19, 35, 41, 39, 16, 0, 14, 32, 15, 25, 27, 49, 49, 49, 27, @@ -437,7 +420,7 @@ static yyconst flex_int16_t yy_base[39] = 0, 0, 0, 49, 39, 29, 34, 36 } ; -static yyconst flex_int16_t yy_def[39] = +static const flex_int16_t yy_def[39] = { 0, 34, 1, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, @@ -445,7 +428,7 @@ static yyconst flex_int16_t yy_def[39] = 37, 38, 38, 0, 34, 34, 34, 34 } ; -static yyconst flex_int16_t yy_nxt[68] = +static const flex_int16_t yy_nxt[68] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 11, 4, 12, 13, 14, 4, 4, 4, 4, 15, 16, 16, @@ -456,7 +439,7 @@ static yyconst flex_int16_t yy_nxt[68] = 34, 34, 34, 34, 34, 34, 34 } ; -static yyconst flex_int16_t yy_chk[68] = +static const flex_int16_t yy_chk[68] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, @@ -481,7 +464,9 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; +#line 1 "tokenizer.l" #define YY_NO_INPUT 1 +#line 3 "tokenizer.l" /* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ /* * Copyright (c) 2004 Marc Espie @@ -516,6 +501,8 @@ int32_t parse_radix(void); extern int yylex(void); #define YY_DECL int yylex(void) +#line 504 "tokenizer.c" +#line 505 "tokenizer.c" #define INITIAL 0 @@ -531,36 +518,36 @@ extern int yylex(void); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (void ); +int yylex_destroy ( void ); -int yyget_debug (void ); +int yyget_debug ( void ); -void yyset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE yyget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void yyset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *yyget_in (void ); +FILE *yyget_in ( void ); -void yyset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *yyget_out (void ); +FILE *yyget_out ( void ); -void yyset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t yyget_leng (void ); + int yyget_leng ( void ); -char *yyget_text (void ); +char *yyget_text ( void ); -int yyget_lineno (void ); +int yyget_lineno ( void ); -void yyset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -568,33 +555,41 @@ void yyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int yywrap ( void ); #else -extern int yywrap (void ); +extern int yywrap ( void ); +#endif #endif + +#ifndef YY_NO_UNPUT + #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -602,7 +597,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -613,7 +608,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -626,7 +621,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -681,7 +676,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -695,8 +690,6 @@ YY_DECL char *yy_cp, *yy_bp; int yy_act; - - if ( !(yy_init) ) { (yy_init) = 1; @@ -717,13 +710,18 @@ YY_DECL if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - yy_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 48 "tokenizer.l" + +#line 722 "tokenizer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -749,9 +747,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 49 ); @@ -781,14 +779,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP +#line 49 "tokenizer.l" {/* just skip it */} YY_BREAK case 2: YY_RULE_SETUP +#line 50 "tokenizer.l" { yylval = number(); return(NUMBER); } YY_BREAK case 3: YY_RULE_SETUP +#line 51 "tokenizer.l" { if (mimic_gnu) { yylval = parse_radix(); return(NUMBER); } else { @@ -798,48 +799,60 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP +#line 57 "tokenizer.l" { return(LE); } YY_BREAK case 5: YY_RULE_SETUP +#line 58 "tokenizer.l" { return(GE); } YY_BREAK case 6: YY_RULE_SETUP +#line 59 "tokenizer.l" { return(LSHIFT); } YY_BREAK case 7: YY_RULE_SETUP +#line 60 "tokenizer.l" { return(RSHIFT); } YY_BREAK case 8: YY_RULE_SETUP +#line 61 "tokenizer.l" { return(EQ); } YY_BREAK case 9: YY_RULE_SETUP +#line 62 "tokenizer.l" { return(NE); } YY_BREAK case 10: YY_RULE_SETUP +#line 63 "tokenizer.l" { return(LAND); } YY_BREAK case 11: YY_RULE_SETUP +#line 64 "tokenizer.l" { return(LOR); } YY_BREAK case 12: YY_RULE_SETUP +#line 65 "tokenizer.l" { if (mimic_gnu) { return (EXPONENT); } } YY_BREAK case 13: YY_RULE_SETUP +#line 66 "tokenizer.l" { return yytext[0]; } YY_BREAK case 14: YY_RULE_SETUP +#line 67 "tokenizer.l" ECHO; YY_BREAK +#line 855 "tokenizer.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -917,7 +930,7 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -970,6 +983,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1012,7 +1026,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1025,7 +1039,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1039,7 +1053,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1048,11 +1062,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1080,7 +1095,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); + yyrestart( yyin ); } else @@ -1094,12 +1109,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1132,9 +1150,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1160,14 +1178,18 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 35 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 34); return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1192,7 +1214,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1209,14 +1231,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart(yyin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1253,11 +1275,11 @@ static int yy_get_next_buffer (void) if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -1285,7 +1307,7 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag @@ -1313,7 +1335,7 @@ static void yy_load_buffer_state (void) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1322,13 +1344,13 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } @@ -1347,9 +1369,9 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - yyfree((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. @@ -1361,7 +1383,7 @@ static void yy_load_buffer_state (void) { int oerrno = errno; - yy_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1404,7 +1426,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1435,7 +1457,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1454,7 +1476,7 @@ void yypop_buffer_state (void) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1472,15 +1494,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1489,7 +1511,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc @@ -1509,7 +1531,7 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { @@ -1519,23 +1541,23 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); *** 214 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Apr 21 09:58:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E55615FECC3; Wed, 21 Apr 2021 09:58: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 4FQGFv5lG3z4sWB; Wed, 21 Apr 2021 09:58:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A778923DF7; Wed, 21 Apr 2021 09:58: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 13L9wBNA079696; Wed, 21 Apr 2021 09:58:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13L9wB0h079695; Wed, 21 Apr 2021 09:58:11 GMT (envelope-from git) Date: Wed, 21 Apr 2021 09:58:11 GMT Message-Id: <202104210958.13L9wB0h079695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: c6e66cbfbbd1 - main - usr.bin/lex: regenerate bootstrap files after d37f81e35b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6e66cbfbbd1c5dec215cf91a79689037255171c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 09:58:12 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c6e66cbfbbd1c5dec215cf91a79689037255171c commit c6e66cbfbbd1c5dec215cf91a79689037255171c Author: Alex Richardson AuthorDate: 2021-04-21 09:50:33 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:56:29 +0000 usr.bin/lex: regenerate bootstrap files after d37f81e35b Reviewed by: jkim --- usr.bin/lex/initscan.c | 16 +++++----------- usr.bin/lex/initskel.c | 8 +------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index 9b6fb4ae5183..5c2701d060da 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -15,12 +15,6 @@ /* First, we deal with platform-specific or compiler-specific issues. */ -#if defined(__FreeBSD__) -#include -#else -#define __dead2 -#endif - /* begin standard C headers. */ #include #include @@ -348,7 +342,7 @@ extern char *yytext; static yy_state_type yy_get_previous_state ( void ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ) __dead2; +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. @@ -1971,9 +1965,9 @@ extern int yylval; if (!indented_code) line_directive_out(NULL, 0);\ } while (0) -#line 1974 "" +#line 1968 "" -#line 1976 "" +#line 1970 "" #define INITIAL 0 #define SECT2 1 @@ -2239,7 +2233,7 @@ YY_DECL char nmdef[MAXLINE]; -#line 2242 "" +#line 2236 "" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -4140,7 +4134,7 @@ YY_RULE_SETUP #line 1014 "scan.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 4143 "" +#line 4137 "" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SECT2): case YY_STATE_EOF(CODEBLOCK): diff --git a/usr.bin/lex/initskel.c b/usr.bin/lex/initskel.c index 53a0ae452aa8..746ad6405c2a 100644 --- a/usr.bin/lex/initskel.c +++ b/usr.bin/lex/initskel.c @@ -446,12 +446,6 @@ const char *skel[] = { "", "/* First, we deal with platform-specific or compiler-specific issues. */", "", - "#if defined(__FreeBSD__)", - "#include ", - "#else", - "#define __dead2", - "#endif", - "", "/* begin standard C headers. */", "%if-c-only", "#include ", @@ -943,7 +937,7 @@ const char *skel[] = { "static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG );", "static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG);", "static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG );", - "static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ) __dead2;", + "static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG );", "]])", "", "%endif", From owner-dev-commits-src-main@freebsd.org Wed Apr 21 10:01:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 008DB5FEFD7; Wed, 21 Apr 2021 10:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQGKS6b6Cz4sxZ; Wed, 21 Apr 2021 10:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4EA92421F; Wed, 21 Apr 2021 10:01: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 13LA1Guc092328; Wed, 21 Apr 2021 10:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LA1G7a092327; Wed, 21 Apr 2021 10:01:16 GMT (envelope-from git) Date: Wed, 21 Apr 2021 10:01:16 GMT Message-Id: <202104211001.13LA1G7a092327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 67f2f67fc8ce - main - Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67f2f67fc8ce8484066e95dabac5af892888fca1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 10:01:17 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=67f2f67fc8ce8484066e95dabac5af892888fca1 commit 67f2f67fc8ce8484066e95dabac5af892888fca1 Author: Alex Richardson AuthorDate: 2021-04-21 09:58:34 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:58:34 +0000 Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8 Two of these tests now pass. Looking at Jenkins to find the first commit where this behaviour changed indicates that 2fe5a79425c79f7b828acd91da66d97230925fc8 is the most likely cause. Reviewed By: melifaro Differential Revision: https://reviews.freebsd.org/D28886 --- tests/sys/net/routing/rtsock_config.h | 9 +++++++- tests/sys/net/routing/test_rtsock_l3.c | 38 +++++++++++++++++----------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/tests/sys/net/routing/rtsock_config.h b/tests/sys/net/routing/rtsock_config.h index 7d73f9e9a109..d9eccb6a19f6 100644 --- a/tests/sys/net/routing/rtsock_config.h +++ b/tests/sys/net/routing/rtsock_config.h @@ -126,8 +126,15 @@ config_setup(const atf_tc_t *tc, struct rtsock_config_options *co) inet_ntop(AF_INET6, &c->net6.sin6_addr, c->net6_str, INET6_ADDRSTRLEN); inet_ntop(AF_INET6, &c->addr6.sin6_addr, c->addr6_str, INET6_ADDRSTRLEN); + ATF_CHECK_ERRNO(0, true); + if (co->num_interfaces > 0) { - kldload("if_epair"); + if (kldload("if_epair") == -1) { + /* Any errno other than EEXIST is fatal. */ + ATF_REQUIRE_ERRNO(EEXIST, true); + /* Clear errno for the following tests. */ + errno = 0; + } ATF_REQUIRE_KERNEL_MODULE("if_epair"); c->ifnames = calloc(co->num_interfaces, sizeof(char *)); diff --git a/tests/sys/net/routing/test_rtsock_l3.c b/tests/sys/net/routing/test_rtsock_l3.c index 91816679400f..b377b6c51ef2 100644 --- a/tests/sys/net/routing/test_rtsock_l3.c +++ b/tests/sys/net/routing/test_rtsock_l3.c @@ -64,6 +64,7 @@ presetup_ipv6_iface(const atf_tc_t *tc) ret = iface_enable_ipv6(c->ifname); ATF_REQUIRE_MSG(ret == 0, "Unable to enable IPv6 on %s", c->ifname); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -79,6 +80,7 @@ presetup_ipv6(const atf_tc_t *tc) ret = iface_setup_addr(c->ifname, c->addr6_str, c->plen6); c->rtsock_fd = rtsock_setup_socket(); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -90,11 +92,13 @@ presetup_ipv4_iface(const atf_tc_t *tc) int ret; c = config_setup(tc, NULL); + ATF_REQUIRE(c != NULL); jump_vnet(c, tc); ret = iface_turn_up(c->ifname); ATF_REQUIRE_MSG(ret == 0, "Unable to turn up %s", c->ifname); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -112,6 +116,7 @@ presetup_ipv4(const atf_tc_t *tc) ATF_REQUIRE_MSG(ret == 0, "ifconfig failed"); c->rtsock_fd = rtsock_setup_socket(); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -365,7 +370,7 @@ ATF_TC_BODY(rtm_get_v4_empty_dst_failure, tc) (struct sockaddr *)&c->mask4, NULL); rtsock_update_rtm_len(rtm); - ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen) == -1); } ATF_TC_CLEANUP(rtm_get_v4_empty_dst_failure, tc) @@ -373,19 +378,16 @@ ATF_TC_CLEANUP(rtm_get_v4_empty_dst_failure, tc) CLEANUP_AFTER_TEST; } -ATF_TC_WITH_CLEANUP(rtm_get_v4_hostbits_failure); -ATF_TC_HEAD(rtm_get_v4_hostbits_failure, tc) +ATF_TC_WITH_CLEANUP(rtm_get_v4_hostbits_success); +ATF_TC_HEAD(rtm_get_v4_hostbits_success, tc) { DESCRIBE_ROOT_TEST("Tests RTM_GET with prefix with some hosts-bits set"); } -ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) +ATF_TC_BODY(rtm_get_v4_hostbits_success, tc) { DECLARE_TEST_VARS; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); - c = presetup_ipv4(tc); /* Q the same prefix */ @@ -393,10 +395,11 @@ ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) (struct sockaddr *)&c->mask4, NULL); rtsock_update_rtm_len(rtm); - ATF_CHECK_ERRNO(ESRCH, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_REQUIRE_ERRNO(0, true); + ATF_CHECK_ERRNO(0, write(c->rtsock_fd, rtm, rtm->rtm_msglen) > 0); } -ATF_TC_CLEANUP(rtm_get_v4_hostbits_failure, tc) +ATF_TC_CLEANUP(rtm_get_v4_hostbits_success, tc) { CLEANUP_AFTER_TEST; } @@ -443,16 +446,13 @@ ATF_TC_CLEANUP(rtm_add_v4_gw_direct_success, tc) CLEANUP_AFTER_TEST; } -RTM_DECLARE_ROOT_TEST(rtm_add_v4_no_rtf_host_failure, - "Tests failure with netmask sa and RTF_HOST inconsistency"); +RTM_DECLARE_ROOT_TEST(rtm_add_v4_no_rtf_host_success, + "Tests success with netmask sa and RTF_HOST inconsistency"); -ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) +ATF_TC_BODY(rtm_add_v4_no_rtf_host_success, tc) { DECLARE_TEST_VARS; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); - c = presetup_ipv4(tc); /* Create IPv4 subnetwork with smaller prefix */ @@ -466,8 +466,8 @@ ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) rtsock_update_rtm_len(rtm); /* RTF_HOST is NOT specified, while netmask is empty */ - - ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_REQUIRE_ERRNO(0, true); + ATF_CHECK_ERRNO(0, write(c->rtsock_fd, rtm, rtm->rtm_msglen) > 0); } ATF_TC_WITH_CLEANUP(rtm_del_v4_prefix_nogw_success); @@ -1393,9 +1393,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, rtm_get_v4_exact_success); ATF_TP_ADD_TC(tp, rtm_get_v4_lpm_success); - ATF_TP_ADD_TC(tp, rtm_get_v4_hostbits_failure); + ATF_TP_ADD_TC(tp, rtm_get_v4_hostbits_success); ATF_TP_ADD_TC(tp, rtm_get_v4_empty_dst_failure); - ATF_TP_ADD_TC(tp, rtm_add_v4_no_rtf_host_failure); + ATF_TP_ADD_TC(tp, rtm_add_v4_no_rtf_host_success); ATF_TP_ADD_TC(tp, rtm_add_v4_gw_direct_success); ATF_TP_ADD_TC(tp, rtm_del_v4_prefix_nogw_success); ATF_TP_ADD_TC(tp, rtm_add_v6_gu_gw_gu_direct_success); From owner-dev-commits-src-main@freebsd.org Wed Apr 21 10:03:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18BC05FF14C; Wed, 21 Apr 2021 10:03:43 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQGNG2Qb1z4tQW; Wed, 21 Apr 2021 10:03:41 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f49.google.com with SMTP id w23so46852923ejb.9; Wed, 21 Apr 2021 03:03:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=zwJAisHHP4+fJkN8JS5UFken42ml9/M+Nj7wfenuXBY=; b=kFVxOg7AG3TD3+A25KJQPtKq7gviUuKsD2jIkRkohy5BQ7FqjQKEcKvHfzH7XCGfs4 Fo4+/burPqCWWEum5SnxaFlYdFOdTbQluf2rN2oEjhSWJFzbcfXpyj+CRV/E3MEHOcg5 z6CqU+WSXtWz55Ti854J3W/mWuZVb4Mvz2sXW2z/v7WZ7i8+A5+LMf5N1RoZzwsUhNiB sYwueBTpdVu3OJ170QycZZyUK4kcurM7ZE5b7O4SvXSKVvIetOIIYKdnWDGUC9q1piWt QeW4aZaltrm3IzT659LSr7NrV9igEVbr1JcV/s+emWMv3Ul3xzqFvoP18LYiDfOWGZuA Na3Q== X-Gm-Message-State: AOAM531jHe3KF3J35thp0B21zHm3TkiO5LSo2cQaetqDe5uB3zGAmQYU 4StHWSR65ML5xEU3d+hKoyoN1FfDlXds0b0k X-Google-Smtp-Source: ABdhPJz2qLx87KOD9m1X1GmzNJJ/fXYb9Wku47a+BNXT2CQozGY+uRtZcSKSGNRghdVr4QfxSStsLQ== X-Received: by 2002:a17:906:430f:: with SMTP id j15mr32106150ejm.543.1618999420122; Wed, 21 Apr 2021 03:03:40 -0700 (PDT) Received: from [192.168.0.106] (ip5f5bd493.dynamic.kabel-deutschland.de. [95.91.212.147]) by smtp.gmail.com with ESMTPSA id r17sm2539812edt.70.2021.04.21.03.03.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Apr 2021 03:03:39 -0700 (PDT) Subject: Re: git: c4207d867c20 - main - fork.2: Add a simple use pattern To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104172113.13HLD6UI014137@gitrepo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: <04cb1d58-a7ca-9ea1-0d69-57251c378794@FreeBSD.org> Date: Wed, 21 Apr 2021 12:03:51 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4FQGNG2Qb1z4tQW X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SENDERSCORE_FAIL(0.00)[209.85.218.49:server fail]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RWL_MAILSPIKE_GOOD(0.00)[209.85.218.49:from]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[95.91.212.147:received]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.218.49:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; SPAMHAUS_ZRD(0.00)[209.85.218.49:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.49:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 10:03:43 -0000 On 20/04/2021 11:58, Konstantin Belousov wrote: > On Sat, Apr 17, 2021 at 09:13:06PM +0000, Mateusz Piotrowski wrote: >> URL: https://cgit.FreeBSD.org/src/commit/?id=c4207d867c201a726aa3157e09262f72166c89c4 >> >> commit c4207d867c201a726aa3157e09262f72166c89c4 >> Author: Mateusz Piotrowski <0mp@FreeBSD.org> >> AuthorDate: 2021-04-17 21:10:48 +0000 >> Commit: Mateusz Piotrowski <0mp@FreeBSD.org> >> CommitDate: 2021-04-17 21:12:06 +0000 >> >> fork.2: Add a simple use pattern >> >> It seems to be a nice idea to show how fork() is usually used in >> practice. This may act as a guide to developers who want to quickly >> recall how to use the fork() function. >> >> Reviewed by: bcr, yuripv >> MFC after: 1 week >> Differential Revision: https://reviews.freebsd.org/D27626 >> > Using printf around fork is not the best idea, and definitely should not > be provided as a guiding example in the man page. Using stdio safely around > fork() requires at least flushing buffers and ensuring that opened FILEs are > in some consistent state right at fork. > > It would work by chance in your example, mostly because you did not used > anything in stdio before fork, but any further changes would result in > very puzzling bugs (for beginners, who are the target of this example). OK, I've opened a revision on Phabricator to address those issues: https://reviews.freebsd.org/D29880 From owner-dev-commits-src-main@freebsd.org Wed Apr 21 10:42:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94FDB5E00A1; Wed, 21 Apr 2021 10:42: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 4FQHFD3j8pz4vf4; Wed, 21 Apr 2021 10:42:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71F3924C9F; Wed, 21 Apr 2021 10:42: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 13LAgekv045777; Wed, 21 Apr 2021 10:42:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LAgeeP045776; Wed, 21 Apr 2021 10:42:40 GMT (envelope-from git) Date: Wed, 21 Apr 2021 10:42:40 GMT Message-Id: <202104211042.13LAgeeP045776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Reifenberger Subject: git: b563ff5d4f81 - main - Append Keyboard Layout specified option for using VNC. Part one: supporting QEMU Extended Keyboard Event Message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b563ff5d4f812df198ade6991834782a5d35af08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 10:42:40 -0000 The branch main has been updated by mr: URL: https://cgit.FreeBSD.org/src/commit/?id=b563ff5d4f812df198ade6991834782a5d35af08 commit b563ff5d4f812df198ade6991834782a5d35af08 Author: Michael Reifenberger AuthorDate: 2021-04-21 10:38:26 +0000 Commit: Michael Reifenberger CommitDate: 2021-04-21 10:40:44 +0000 Append Keyboard Layout specified option for using VNC. Part one: supporting QEMU Extended Keyboard Event Message PR: 246121 Submitted by: koinec@yahoo.co.jp Differential Revision: https://reviews.freebsd.org/D29430 --- usr.sbin/bhyve/console.c | 4 +-- usr.sbin/bhyve/console.h | 4 +-- usr.sbin/bhyve/ps2kbd.c | 54 ++++++++++++++++++++++++++---------- usr.sbin/bhyve/rfb.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 115 insertions(+), 19 deletions(-) diff --git a/usr.sbin/bhyve/console.c b/usr.sbin/bhyve/console.c index 2567f699595c..d845df754048 100644 --- a/usr.sbin/bhyve/console.c +++ b/usr.sbin/bhyve/console.c @@ -106,10 +106,10 @@ console_ptr_register(ptr_event_func_t event_cb, void *arg, int pri) } void -console_key_event(int down, uint32_t keysym) +console_key_event(int down, uint32_t keysym, uint32_t keycode) { if (console.kbd_event_cb) - (*console.kbd_event_cb)(down, keysym, console.kbd_arg); + (*console.kbd_event_cb)(down, keysym, keycode, console.kbd_arg); } void diff --git a/usr.sbin/bhyve/console.h b/usr.sbin/bhyve/console.h index 0d0a85486625..8029c28ab8a9 100644 --- a/usr.sbin/bhyve/console.h +++ b/usr.sbin/bhyve/console.h @@ -34,7 +34,7 @@ struct bhyvegc; typedef void (*fb_render_func_t)(struct bhyvegc *gc, void *arg); -typedef void (*kbd_event_func_t)(int down, uint32_t keysym, void *arg); +typedef void (*kbd_event_func_t)(int down, uint32_t keysym, uint32_t keycode, void *arg); typedef void (*ptr_event_func_t)(uint8_t mask, int x, int y, void *arg); void console_init(int w, int h, void *fbaddr); @@ -47,7 +47,7 @@ void console_fb_register(fb_render_func_t render_cb, void *arg); void console_refresh(void); void console_kbd_register(kbd_event_func_t event_cb, void *arg, int pri); -void console_key_event(int down, uint32_t keysym); +void console_key_event(int down, uint32_t keysym, uint32_t keycode); void console_ptr_register(ptr_event_func_t event_cb, void *arg, int pri); void console_ptr_event(uint8_t button, int x, int y); diff --git a/usr.sbin/bhyve/ps2kbd.c b/usr.sbin/bhyve/ps2kbd.c index ef20fa47e0a9..012c66160ebe 100644 --- a/usr.sbin/bhyve/ps2kbd.c +++ b/usr.sbin/bhyve/ps2kbd.c @@ -181,6 +181,26 @@ static const uint8_t ascii_translations[128] = { 0x22, 0x35, 0x1a, 0x54, 0x5d, 0x5b, 0x0e, 0x00, }; +/* ScanCode set1 to set2 lookup table */ +const uint8_t keyset1to2_translations[128] = { + 0, 0x76, 0x16, 0x1E, 0x26, 0x25, 0x2e, 0x36, + 0x3d, 0x3e, 0x46, 0x45, 0x4e, 0x55, 0x66, 0x0d, + 0x15, 0x1d, 0x24, 0x2d, 0x2c, 0x35, 0x3c, 0x43, + 0x44, 0x4d, 0x54, 0x5b, 0x5a, 0x14, 0x1c, 0x1b, + 0x23, 0x2b, 0x34, 0x33, 0x3b, 0x42, 0x4b, 0x4c, + 0x52, 0x0e, 0x12, 0x5d, 0x1a, 0x22, 0x21, 0x2a, + 0x32, 0x31, 0x3a, 0x41, 0x49, 0x4a, 0x59, 0x7c, + 0x11, 0x29, 0x58, 0x05, 0x06, 0x04, 0x0c, 0x03, + 0x0b, 0x83, 0x0a, 0x01, 0x09, 0x77, 0x7e, 0x6c, + 0x75, 0x7d, 0x7b, 0x6b, 0x73, 0x74, 0x79, 0x69, + 0x72, 0x7a, 0x70, 0x71, 0x84, 0x60, 0x61, 0x78, + 0x07, 0x0f, 0x17, 0x1f, 0x27, 0x2f, 0x37, 0x3f, + 0x47, 0x4f, 0x56, 0x5e, 0x08, 0x10, 0x18, 0x20, + 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x57, 0x6f, + 0x13, 0x19, 0x39, 0x51, 0x53, 0x5c, 0x5f, 0x62, + 0x63, 0x64, 0x65, 0x67, 0x68, 0x6a, 0x6d, 0x6e, +}; + static void fifo_init(struct ps2kbd_softc *sc) { @@ -315,26 +335,32 @@ ps2kbd_write(struct ps2kbd_softc *sc, uint8_t val) */ static void ps2kbd_keysym_queue(struct ps2kbd_softc *sc, - int down, uint32_t keysym) + int down, uint32_t keysym, uint32_t keycode) { assert(pthread_mutex_isowned_np(&sc->mtx)); int e0_prefix, found; uint8_t code; const struct extended_translation *trans; - found = 0; - if (keysym < 0x80) { - code = ascii_translations[keysym]; - e0_prefix = 0; + if (keycode) { + code = keyset1to2_translations[(uint8_t)(keycode & 0x7f)]; + e0_prefix = ((keycode & 0x80) ? SCANCODE_E0_PREFIX : 0); found = 1; } else { - for (trans = &(extended_translations[0]); trans->keysym != 0; - trans++) { - if (keysym == trans->keysym) { - code = trans->scancode; - e0_prefix = trans->flags & SCANCODE_E0_PREFIX; - found = 1; - break; + found = 0; + if (keysym < 0x80) { + code = ascii_translations[keysym]; + e0_prefix = 0; + found = 1; + } else { + for (trans = &(extended_translations[0]); trans->keysym != 0; + trans++) { + if (keysym == trans->keysym) { + code = trans->scancode; + e0_prefix = trans->flags & SCANCODE_E0_PREFIX; + found = 1; + break; + } } } } @@ -352,7 +378,7 @@ ps2kbd_keysym_queue(struct ps2kbd_softc *sc, } static void -ps2kbd_event(int down, uint32_t keysym, void *arg) +ps2kbd_event(int down, uint32_t keysym, uint32_t keycode, void *arg) { struct ps2kbd_softc *sc = arg; int fifo_full; @@ -363,7 +389,7 @@ ps2kbd_event(int down, uint32_t keysym, void *arg) return; } fifo_full = sc->fifo.num == PS2KBD_FIFOSZ; - ps2kbd_keysym_queue(sc, down, keysym); + ps2kbd_keysym_queue(sc, down, keysym, keycode); pthread_mutex_unlock(&sc->mtx); if (!fifo_full) diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c index 5230ae65cd57..b5556aad45a0 100644 --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -98,6 +98,7 @@ static int rfb_debug = 0; #define CS_KEY_EVENT 4 #define CS_POINTER_EVENT 5 #define CS_CUT_TEXT 6 +#define CS_MSG_CLIENT_QEMU 255 #define SECURITY_TYPE_NONE 1 #define SECURITY_TYPE_VNC_AUTH 2 @@ -118,6 +119,9 @@ struct rfb_softc { bool enc_raw_ok; bool enc_zlib_ok; bool enc_resize_ok; + bool enc_extkeyevent_ok; + + bool enc_extkeyevent_send; z_stream zstream; uint8_t *zbuf; @@ -170,6 +174,9 @@ struct rfb_pixfmt_msg { #define RFB_ENCODING_RAW 0 #define RFB_ENCODING_ZLIB 6 #define RFB_ENCODING_RESIZE -223 +#define RFB_ENCODING_EXT_KEYEVENT -258 + +#define RFB_CLIENTMSG_EXT_KEYEVENT 0 #define RFB_MAX_WIDTH 2000 #define RFB_MAX_HEIGHT 1200 @@ -197,6 +204,19 @@ struct rfb_key_msg { uint8_t type; uint8_t down; uint16_t pad; + uint32_t sym; +}; + +struct rfb_client_msg { + uint8_t type; + uint8_t subtype; +}; + +struct rfb_extended_key_msg { + uint8_t type; + uint8_t subtype; + uint16_t down; + uint32_t sym; uint32_t code; }; @@ -276,6 +296,27 @@ rfb_send_resize_update_msg(struct rfb_softc *rc, int cfd) stream_write(cfd, &srect_hdr, sizeof(struct rfb_srvr_rect_hdr)); } +static void +rfb_send_extended_keyevent_update_msg(struct rfb_softc *rc, int cfd) +{ + struct rfb_srvr_updt_msg supdt_msg; + struct rfb_srvr_rect_hdr srect_hdr; + + /* Number of rectangles: 1 */ + supdt_msg.type = 0; + supdt_msg.pad = 0; + supdt_msg.numrects = htons(1); + stream_write(cfd, &supdt_msg, sizeof(struct rfb_srvr_updt_msg)); + + /* Rectangle header */ + srect_hdr.x = htons(0); + srect_hdr.y = htons(0); + srect_hdr.width = htons(rc->width); + srect_hdr.height = htons(rc->height); + srect_hdr.encoding = htonl(RFB_ENCODING_EXT_KEYEVENT); + stream_write(cfd, &srect_hdr, sizeof(struct rfb_srvr_rect_hdr)); +} + static void rfb_recv_set_pixfmt_msg(struct rfb_softc *rc, int cfd) { @@ -309,6 +350,9 @@ rfb_recv_set_encodings_msg(struct rfb_softc *rc, int cfd) case RFB_ENCODING_RESIZE: rc->enc_resize_ok = true; break; + case RFB_ENCODING_EXT_KEYEVENT: + rc->enc_extkeyevent_ok = true; + break; } } } @@ -686,6 +730,11 @@ rfb_recv_update_msg(struct rfb_softc *rc, int cfd) (void)stream_read(cfd, ((void *)&updt_msg) + 1 , sizeof(updt_msg) - 1); + if (rc->enc_extkeyevent_ok && (!rc->enc_extkeyevent_send)) { + rfb_send_extended_keyevent_update_msg(rc, cfd); + rc->enc_extkeyevent_send = true; + } + rc->pending = true; if (!updt_msg.incremental) rc->update_all = true; @@ -698,10 +747,25 @@ rfb_recv_key_msg(struct rfb_softc *rc, int cfd) (void)stream_read(cfd, ((void *)&key_msg) + 1, sizeof(key_msg) - 1); - console_key_event(key_msg.down, htonl(key_msg.code)); + console_key_event(key_msg.down, htonl(key_msg.sym), htonl(0)); rc->input_detected = true; } +static void +rfb_recv_client_msg(struct rfb_softc *rc, int cfd) +{ + struct rfb_client_msg client_msg; + struct rfb_extended_key_msg extkey_msg; + + (void)stream_read(cfd, ((void *)&client_msg) + 1, sizeof(client_msg) - 1); + + if (client_msg.subtype == RFB_CLIENTMSG_EXT_KEYEVENT ) { + (void)stream_read(cfd, ((void *)&extkey_msg) + 2, sizeof(extkey_msg) - 2); + console_key_event((int)extkey_msg.down, htonl(extkey_msg.sym), htonl(extkey_msg.code)); + rc->input_detected = true; + } +} + static void rfb_recv_ptr_msg(struct rfb_softc *rc, int cfd) { @@ -997,6 +1061,9 @@ report_and_done: case CS_CUT_TEXT: rfb_recv_cuttext_msg(rc, cfd); break; + case CS_MSG_CLIENT_QEMU: + rfb_recv_client_msg(rc, cfd); + break; default: WPRINTF(("rfb unknown cli-code %d!", buf[0] & 0xff)); goto done; @@ -1031,6 +1098,9 @@ rfb_thr(void *arg) rc->enc_raw_ok = false; rc->enc_zlib_ok = false; rc->enc_resize_ok = false; + rc->enc_extkeyevent_ok = false; + + rc->enc_extkeyevent_send = false; cfd = accept(rc->sfd, NULL, NULL); if (rc->conn_wait) { From owner-dev-commits-src-main@freebsd.org Wed Apr 21 11:50:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55ABA5E2141; Wed, 21 Apr 2021 11:50: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 4FQJlc231yz3Fhp; Wed, 21 Apr 2021 11:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3844F25B13; Wed, 21 Apr 2021 11:50: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 13LBoa5Q037183; Wed, 21 Apr 2021 11:50:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LBoaEi037182; Wed, 21 Apr 2021 11:50:36 GMT (envelope-from git) Date: Wed, 21 Apr 2021 11:50:36 GMT Message-Id: <202104211150.13LBoaEi037182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 4ba91fa0736b - main - loader: do not output empty menu title MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ba91fa0736bb0672d475b6b56d9e7b06e78ff69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 11:50:36 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=4ba91fa0736bb0672d475b6b56d9e7b06e78ff69 commit 4ba91fa0736bb0672d475b6b56d9e7b06e78ff69 Author: Toomas Soome AuthorDate: 2021-04-21 11:42:10 +0000 Commit: Toomas Soome CommitDate: 2021-04-21 11:50:23 +0000 loader: do not output empty menu title As we output spaces around the menu title, we should also check, if the title is actually empty string. PR: 255299 Submitted by: Jose Luis Duran Reported by: Jose Luis Duran MFC after: 1 week --- stand/forth/menu.4th | 6 +++++- stand/lua/drawer.lua | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stand/forth/menu.4th b/stand/forth/menu.4th index a336b9f9e7aa..75e75e3e3654 100644 --- a/stand/forth/menu.4th +++ b/stand/forth/menu.4th @@ -490,7 +490,11 @@ also menu-infrastructure definitions menuX @ 19 + over 2 / - menuY @ 1- then swap 1- swap - at-xy space type space + at-xy dup 0= if + 2drop ( empty loader_menu_title ) + else + space type space + then \ If $menu_init is set, evaluate it (allowing for whole menus to be \ constructed dynamically -- as this function could conceivably set diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 523735a75d06..6324c2262c11 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -286,7 +286,10 @@ local function drawbox() menu_header_x = x + (w // 2) - (#menu_header // 2) end screen.setcursor(menu_header_x - 1, y) - printc(" " .. menu_header .. " ") + if menu_header ~= "" then + printc(" " .. menu_header .. " ") + end + end local function drawbrand() From owner-dev-commits-src-main@freebsd.org Wed Apr 21 11:58:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90DC85E2789; Wed, 21 Apr 2021 11:58: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 4FQJx93kcgz3G5k; Wed, 21 Apr 2021 11:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 736F325BBC; Wed, 21 Apr 2021 11:58: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 13LBwrGQ039562; Wed, 21 Apr 2021 11:58:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LBwrBB039561; Wed, 21 Apr 2021 11:58:53 GMT (envelope-from git) Date: Wed, 21 Apr 2021 11:58:53 GMT Message-Id: <202104211158.13LBwrBB039561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 45aec46246fe - main - rc: make the 'linux' script explicitly load filesystem modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45aec46246fe61a3f45cf7da1c80850dc226f609 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 11:58:53 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=45aec46246fe61a3f45cf7da1c80850dc226f609 commit 45aec46246fe61a3f45cf7da1c80850dc226f609 Author: Edward Tomasz Napierala AuthorDate: 2021-04-21 11:54:29 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-21 11:54:37 +0000 rc: make the 'linux' script explicitly load filesystem modules This removes a minor annoyance with Linux jails, where you often want linux_mounts_enable="NO", yet you want those filesystems available for mounting in jails; normally mount(8) would result in kernel automatically loading the KLD, but this doesn't work inside jails or chroots. PR: 242955 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29725 --- libexec/rc/rc.d/linux | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 882cf4012495..23cb5acc6f99 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -46,6 +46,12 @@ linux_start() # Linux uses the pre-pts(4) tty naming scheme. load_kld pty + # Explicitly load the filesystem modules; they are usually required, + # even with linux_mounts_enable="NO". + load_kld fdescfs + load_kld linprocfs + load_kld linsysfs + # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then sysctl kern.elf64.fallback_brand=3 > /dev/null From owner-dev-commits-src-main@freebsd.org Wed Apr 21 13:51:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C48F45E5AF8; Wed, 21 Apr 2021 13:51:00 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQMQX3BPXz3MZm; Wed, 21 Apr 2021 13:51:00 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 13LDotqJ075730; Wed, 21 Apr 2021 06:50:55 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 13LDotwF075729; Wed, 21 Apr 2021 06:50:55 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202104211350.13LDotwF075729@gndrsh.dnsmgr.net> Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files In-Reply-To: <1b95e1cc-0461-f7ef-9f29-e992c5d1e6d9@FreeBSD.org> To: Jung-uk Kim Date: Wed, 21 Apr 2021 06:50:55 -0700 (PDT) CC: rgrimes@FreeBSD.org, Warner Losh , src-committers , dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FQMQX3BPXz3MZm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 13:51:00 -0000 > On 21. 4. 20., Rodney W. Grimes wrote: > >> On Tue, Apr 20, 2021 at 10:24 AM Jung-uk Kim wrote: > >> > >>> On 21. 4. 20., Rodney W. Grimes wrote: > >>>>> On 21. 4. 20., Rodney W. Grimes wrote: > >>>>>>> The branch main has been updated by jkim: > >>>>>>> > >>>>>>> URL: > >>> https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > >>>>>>> > >>>>>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d > >>>>>>> Author: Jung-uk Kim > >>>>>>> AuthorDate: 2021-04-19 18:20:51 +0000 > >>>>>>> Commit: Jung-uk Kim > >>>>>>> CommitDate: 2021-04-19 18:20:51 +0000 > >>>>>>> > >>>>>>> flex: Regen bootstrap files > >>>>>>> > >>>>>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see > >>> any > >>>>>>> point of adding SPDX tag in generated file. > >>>>>> > >>>>>> The SPDX identifies the copyright that follows it, so please put this > >>> back. > >>>>> > >>>>> It is a generated file. If you really think it is necessary, you need > >>>>> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. > >>>> > >>>> Just because it is a generated file does not change the fact that > >>>> its contents are copyrighted. Leaving the copyright out at best > >>>> defaults to Bern convention, so the fact of the mater is the contents > >>>> is copyrighted, and it is best to explicitly state that it is. > >>> > >>> Of course, it is copyrighted. My point was parse.y should have been > >>> patched, not the generated file, if necessary. > >>> > >> > >> Yes. It was a mistake to put it into the generated file. > > > > He removed the SPDX from parse.y, now says that is the right place > > to put the SPDX. You agree. So can we have this undone? > > > >>>>> However, I don't see much sense in automatically adding BSD license in > >>>>> every generated file in the first place. In fact, I think it should not > >>>>> appear on generated file at all. It may say something along the line of > >>>>> "generated by flex" instead but IANAL. > >>>> > >>>> Well, someone before you did see since in it, and hence put that SPDX in > >>> it. > >>> > >>> Let me put it in another way. Do we really want to tag contrib code? > >>> > >> > >> I tend to agree. > >> > >> I tend to agree because the SPDX tags are generally only looked at in the > >> source tree by existing tools. The generated code won't be looked at > >> typically. > >> We should work to get this upstream, imho. > > > > Is parse.y not a source file? What am I missing? > > I guess you're confused somehow. > 686cf5468c4a85c2a6385cdbab2383900876a41d did not touch parse.y. > > https://cgit.freebsd.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d Hum, I guess I am very confused by this output in that commit message: @@ -19,8 +18,6 @@ #define YYPURE 0 #line 35 "parse.y" -/* SPDX-License-Identifier: BSD-2-Clause */ - /* Copyright (c) 1990 The Regents of the University of California. */ /* All rights reserved. */ Which actually appears to be a change to initparse.c, so never mind, the diff output along with your comment lead me astray. I would like to understand why this was being emmitted before, and is not being emmitted now though. That seems to conflict with what parse.y actually contains, did you somehow hand edit initparse.c to remove this? > > parse.y never had the tag from the day 1. Hummm... Then I am still further confused by the line 35 "parse.y" delta. > > https://cgit.freebsd.org/src/log/contrib/flex/src/parse.y > > Jung-uk Kim > > >> By itself, the SPDX tag is just information. There's no legal requirement in > >> copyright law to have it. Current project policy states they are just > >> informative, > >> though there's some desire to have a good framework to allow code with > >> just a copyright and a SDPX tag into the tree, so long as that framework > >> can be used to know what the license is for any file in a clear and > >> unambiguous > >> way. > >> > >> Warner > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Wed Apr 21 14:04:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4B305E634A; Wed, 21 Apr 2021 14:04:52 +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 4FQMkX4nL1z3N8K; Wed, 21 Apr 2021 14:04:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8145F27D2A; Wed, 21 Apr 2021 14:04:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) To: rgrimes@FreeBSD.org Cc: Warner Losh , src-committers , dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104211350.13LDotwF075729@gndrsh.dnsmgr.net> From: Jung-uk Kim Organization: FreeBSD.org Subject: Re: git: 686cf5468c4a - main - flex: Regen bootstrap files Message-ID: Date: Wed, 21 Apr 2021 10:04:52 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <202104211350.13LDotwF075729@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 14:04:52 -0000 On 21. 4. 21., Rodney W. Grimes wrote: >> On 21. 4. 20., Rodney W. Grimes wrote: >>>> On Tue, Apr 20, 2021 at 10:24 AM Jung-uk Kim wrote: >>>> >>>>> On 21. 4. 20., Rodney W. Grimes wrote: >>>>>>> On 21. 4. 20., Rodney W. Grimes wrote: >>>>>>>>> The branch main has been updated by jkim: >>>>>>>>> >>>>>>>>> URL: >>>>> https://cgit.FreeBSD.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d >>>>>>>>> >>>>>>>>> commit 686cf5468c4a85c2a6385cdbab2383900876a41d >>>>>>>>> Author: Jung-uk Kim >>>>>>>>> AuthorDate: 2021-04-19 18:20:51 +0000 >>>>>>>>> Commit: Jung-uk Kim >>>>>>>>> CommitDate: 2021-04-19 18:20:51 +0000 >>>>>>>>> >>>>>>>>> flex: Regen bootstrap files >>>>>>>>> >>>>>>>>> This also partially reverts r326025 (8a16b7a18f5d). I do not see >>>>> any >>>>>>>>> point of adding SPDX tag in generated file. >>>>>>>> >>>>>>>> The SPDX identifies the copyright that follows it, so please put this >>>>> back. >>>>>>> >>>>>>> It is a generated file. If you really think it is necessary, you need >>>>>>> to patch its source, i.e., contrib/flex/src/parse.y, and regen the file. >>>>>> >>>>>> Just because it is a generated file does not change the fact that >>>>>> its contents are copyrighted. Leaving the copyright out at best >>>>>> defaults to Bern convention, so the fact of the mater is the contents >>>>>> is copyrighted, and it is best to explicitly state that it is. >>>>> >>>>> Of course, it is copyrighted. My point was parse.y should have been >>>>> patched, not the generated file, if necessary. >>>>> >>>> >>>> Yes. It was a mistake to put it into the generated file. >>> >>> He removed the SPDX from parse.y, now says that is the right place >>> to put the SPDX. You agree. So can we have this undone? >>> >>>>>>> However, I don't see much sense in automatically adding BSD license in >>>>>>> every generated file in the first place. In fact, I think it should not >>>>>>> appear on generated file at all. It may say something along the line of >>>>>>> "generated by flex" instead but IANAL. >>>>>> >>>>>> Well, someone before you did see since in it, and hence put that SPDX in >>>>> it. >>>>> >>>>> Let me put it in another way. Do we really want to tag contrib code? >>>>> >>>> >>>> I tend to agree. >>>> >>>> I tend to agree because the SPDX tags are generally only looked at in the >>>> source tree by existing tools. The generated code won't be looked at >>>> typically. >>>> We should work to get this upstream, imho. >>> >>> Is parse.y not a source file? What am I missing? >> >> I guess you're confused somehow. >> 686cf5468c4a85c2a6385cdbab2383900876a41d did not touch parse.y. >> >> https://cgit.freebsd.org/src/commit/?id=686cf5468c4a85c2a6385cdbab2383900876a41d > > Hum, I guess I am very confused by this output in that commit message: > @@ -19,8 +18,6 @@ > #define YYPURE 0 > > #line 35 "parse.y" > -/* SPDX-License-Identifier: BSD-2-Clause */ > - > /* Copyright (c) 1990 The Regents of the University of California. */ > /* All rights reserved. */ > > Which actually appears to be a change to initparse.c, so never mind, the > diff output along with your comment lead me astray. I would like to > understand why this was being emmitted before, and is not being emmitted > now though. That seems to conflict with what parse.y actually contains, > did you somehow hand edit initparse.c to remove this? It was manually added to initparse.c by the following commit: https://svnweb.freebsd.org/changeset/base/326025 https://svnweb.freebsd.org/base/head/usr.bin/lex/initparse.c?r1=326025&r2=326024&pathrev=326025&limit_changes=0&view=patch Jung-uk Kim >> parse.y never had the tag from the day 1. > > Hummm... Then I am still further confused by the line 35 "parse.y" delta. > >> >> https://cgit.freebsd.org/src/log/contrib/flex/src/parse.y >> >> Jung-uk Kim >> >>>> By itself, the SPDX tag is just information. There's no legal requirement in >>>> copyright law to have it. Current project policy states they are just >>>> informative, >>>> though there's some desire to have a good framework to allow code with >>>> just a copyright and a SDPX tag into the tree, so long as that framework >>>> can be used to know what the license is for any file in a clear and >>>> unambiguous >>>> way. >>>> >>>> Warner From owner-dev-commits-src-main@freebsd.org Wed Apr 21 15:07:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B8B95E8A3E; Wed, 21 Apr 2021 15:07: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 4FQP700lF4z3hHW; Wed, 21 Apr 2021 15:07:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B609325; Wed, 21 Apr 2021 15:07: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 13LF7dKB092373; Wed, 21 Apr 2021 15:07:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LF7dPt092372; Wed, 21 Apr 2021 15:07:39 GMT (envelope-from git) Date: Wed, 21 Apr 2021 15:07:39 GMT Message-Id: <202104211507.13LF7dPt092372@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: 54f98c4dbf9b - main - vn_open_vnode(): handle error when fp == NULL 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: 54f98c4dbf9b1203a4e3e1b13fd0738441226991 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 15:07:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=54f98c4dbf9b1203a4e3e1b13fd0738441226991 commit 54f98c4dbf9b1203a4e3e1b13fd0738441226991 Author: Konstantin Belousov AuthorDate: 2021-04-19 10:25:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-21 15:06:51 +0000 vn_open_vnode(): handle error when fp == NULL If VOP_ADD_WRITECOUNT() or adv locking failed, so VOP_CLOSE() needs to be called, we cannot use fp fo_close() when there is no fp. This occurs when e.g. kernel code directly calls vn_open() instead of the open(2) syscall. In this case, VOP_CLOSE() can be called directly, after possible lock upgrade. Reported by: nvass@gmx.com PR: 255119 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29830 --- sys/kern/vfs_vnops.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9da35721def4..f715c9828d04 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -451,16 +451,34 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, /* * Error from advlock or VOP_ADD_WRITECOUNT() still requires * calling VOP_CLOSE() to pair with earlier VOP_OPEN(). - * Arrange for that by having fdrop() to use vn_closefile(). */ if (error != 0) { - fp->f_flag |= FOPENFAILED; - fp->f_vnode = vp; - if (fp->f_ops == &badfileops) { - fp->f_type = DTYPE_VNODE; - fp->f_ops = &vnops; + if (fp != NULL) { + /* + * Arrange the call by having fdrop() to use + * vn_closefile(). This is to satisfy + * filesystems like devfs or tmpfs, which + * override fo_close(). + */ + fp->f_flag |= FOPENFAILED; + fp->f_vnode = vp; + if (fp->f_ops == &badfileops) { + fp->f_type = DTYPE_VNODE; + fp->f_ops = &vnops; + } + vref(vp); + } else { + /* + * If there is no fp, due to kernel-mode open, + * we can call VOP_CLOSE() now. + */ + if (vp->v_type != VFIFO && (fmode & FWRITE) != 0 && + !MNT_EXTENDED_SHARED(vp->v_mount) && + VOP_ISLOCKED(vp) != LK_EXCLUSIVE) + vn_lock(vp, LK_UPGRADE | LK_RETRY); + (void)VOP_CLOSE(vp, fmode & (FREAD | FWRITE | FEXEC), + cred, td); } - vref(vp); } ASSERT_VOP_LOCKED(vp, "vn_open_vnode"); From owner-dev-commits-src-main@freebsd.org Wed Apr 21 15:26:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A87D25E9064; Wed, 21 Apr 2021 15:26: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 4FQPXS4RY7z3jGR; Wed, 21 Apr 2021 15:26:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B54B7A1; Wed, 21 Apr 2021 15:26: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 13LFQG5T018777; Wed, 21 Apr 2021 15:26:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LFQGh8018776; Wed, 21 Apr 2021 15:26:16 GMT (envelope-from git) Date: Wed, 21 Apr 2021 15:26:16 GMT Message-Id: <202104211526.13LFQGh8018776@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: 9c651561a2a3 - main - zfs: damage control racing .. lookups in face of mkdir/rmdir 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: 9c651561a2a31fcb08390d37947afc27ec03d87b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 15:26:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9c651561a2a31fcb08390d37947afc27ec03d87b commit 9c651561a2a31fcb08390d37947afc27ec03d87b Author: Mateusz Guzik AuthorDate: 2021-04-15 07:54:18 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-21 15:25:32 +0000 zfs: damage control racing .. lookups in face of mkdir/rmdir Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29769 --- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 8172916c4329..a1e9c359b893 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -781,6 +781,7 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, znode_t *zdp = VTOZ(dvp); znode_t *zp; zfsvfs_t *zfsvfs = zdp->z_zfsvfs; + seqc_t dvp_seqc; int error = 0; /* @@ -806,6 +807,8 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); + dvp_seqc = vn_seqc_read_any(dvp); + *vpp = NULL; if (flags & LOOKUP_XATTR) { @@ -975,6 +978,24 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, } } + if ((cnp->cn_flags & ISDOTDOT) != 0) { + /* + * FIXME: zfs_lookup_lock relocks vnodes and does nothing to + * handle races. In particular different callers may end up + * with different vnodes and will try to add conflicting + * entries to the namecache. + * + * While finding different result may be acceptable in face + * of concurrent modification, adding conflicting entries + * trips over an assert in the namecache. + * + * Ultimately let an entry through once everything settles. + */ + if (!vn_seqc_consistent(dvp, dvp_seqc)) { + cnp->cn_flags &= ~MAKEENTRY; + } + } + /* Insert name into cache (as non-existent) if appropriate. */ if (zfsvfs->z_use_namecache && !zfsvfs->z_replay && error == ENOENT && (cnp->cn_flags & MAKEENTRY) != 0) From owner-dev-commits-src-main@freebsd.org Wed Apr 21 17:09:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EB635EBD2A; Wed, 21 Apr 2021 17:09:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQRqS0TlJz3njb; Wed, 21 Apr 2021 17:09:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 7D20728AFD; Wed, 21 Apr 2021 17:09:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 83223eb58bf7 - main - Fixup ObsoleteFiles after 76681661be28. To: Dmitry Chagin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104202110.13KLAQBd067241@gitrepo.freebsd.org> From: John Baldwin Message-ID: <2b5938be-17cd-ee04-e8f6-3689413429c3@FreeBSD.org> Date: Wed, 21 Apr 2021 10:09:15 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104202110.13KLAQBd067241@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 17:09:24 -0000 On 4/20/21 2:10 PM, Dmitry Chagin wrote: > The branch main has been updated by dchagin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=83223eb58bf79270a84b34254679ff2c2adc304e > > commit 83223eb58bf79270a84b34254679ff2c2adc304e > Author: Dmitry Chagin > AuthorDate: 2021-04-20 21:06:16 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-04-20 21:06:16 +0000 > > Fixup ObsoleteFiles after 76681661be28. My bad, thanks for fixing! -- John Baldwin From owner-dev-commits-src-main@freebsd.org Wed Apr 21 18:20:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7ED915EDD71; Wed, 21 Apr 2021 18:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQTP33D9Cz3rwX; Wed, 21 Apr 2021 18:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D9B32A7E; Wed, 21 Apr 2021 18:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13LIK7J3046434; Wed, 21 Apr 2021 18:20:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LIK7Wi046431; Wed, 21 Apr 2021 18:20:07 GMT (envelope-from git) Date: Wed, 21 Apr 2021 18:20:07 GMT Message-Id: <202104211820.13LIK7Wi046431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Reifenberger Subject: git: dcc2fb370791 - main - systat: Avoid incorrect reallocation in pigs.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcc2fb3707919c5184480d8cbde98d16f24a3945 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 18:20:07 -0000 The branch main has been updated by mr: URL: https://cgit.FreeBSD.org/src/commit/?id=dcc2fb3707919c5184480d8cbde98d16f24a3945 commit dcc2fb3707919c5184480d8cbde98d16f24a3945 Author: Michael Reifenberger AuthorDate: 2021-04-21 18:09:21 +0000 Commit: Michael Reifenberger CommitDate: 2021-04-21 18:09:21 +0000 systat: Avoid incorrect reallocation in pigs.c Stop free() even if kvm_getprocs as we can come back but set nprocs = 0. Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed. Current code can have pt with non-null after kvm_getprocs() failure. Replace to realloc for simpler operations. Submitted by: Yoshihiro Ota ota@j.email.ne.jp Reviewed by: mckusick@ Differential Revision: https://reviews.freebsd.org/D29303 --- usr.bin/systat/pigs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index d9f3f8d4ad14..0bec6aceaaa1 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -62,7 +62,7 @@ static int nproc; static struct p_times { float pt_pctcpu; struct kinfo_proc *pt_kp; -} *pt; +} *pt = NULL; static int fscale; static double lccpu; @@ -90,7 +90,7 @@ showpigs(void) const char *uname, *pname; char pidname[30]; - if (pt == NULL) + if (nproc == 0) return; qsort(pt, nproc, sizeof (struct p_times), compar); @@ -146,23 +146,20 @@ fetchpigs(void) float ftime; float *pctp; struct kinfo_proc *kpp; - static int lastnproc = 0; + static int maxnproc = 0; if ((kpp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc)) == NULL) { error("%s", kvm_geterr(kd)); - if (pt) - free(pt); + nproc = 0; return; } - if (nproc > lastnproc) { - free(pt); - if ((pt = - malloc(nproc * sizeof(struct p_times))) == NULL) { + if (nproc > maxnproc) { + if ((pt = realloc(pt, nproc * sizeof(*pt))) == NULL) { error("Out of memory"); die(0); } + maxnproc = nproc; } - lastnproc = nproc; /* * calculate %cpu for each proc */ From owner-dev-commits-src-main@freebsd.org Wed Apr 21 18:34:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 465D55EE9C1; Wed, 21 Apr 2021 18:34: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 4FQTjv1WwKz3tFK; Wed, 21 Apr 2021 18:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2309A319C; Wed, 21 Apr 2021 18:34: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 13LIYhIg069669; Wed, 21 Apr 2021 18:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LIYh0d069668; Wed, 21 Apr 2021 18:34:43 GMT (envelope-from git) Date: Wed, 21 Apr 2021 18:34:43 GMT Message-Id: <202104211834.13LIYh0d069668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Reifenberger Subject: git: 66483838039b - main - systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66483838039b21a20d748448f8916a73ec419691 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 18:34:43 -0000 The branch main has been updated by mr: URL: https://cgit.FreeBSD.org/src/commit/?id=66483838039b21a20d748448f8916a73ec419691 commit 66483838039b21a20d748448f8916a73ec419691 Author: Michael Reifenberger AuthorDate: 2021-04-21 18:31:58 +0000 Commit: Michael Reifenberger CommitDate: 2021-04-21 18:31:58 +0000 systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. Display corrupts after resizing a window. Process SIGWINCH to redraw all window. Submitted by: Yoshihiro Ota ota@j.email.ne.jp Differential Revision: https://reviews.freebsd.org/D29337 --- usr.bin/systat/devs.c | 8 +------- usr.bin/systat/devs.h | 4 +++- usr.bin/systat/main.c | 16 ++++++++++++++++ usr.bin/systat/swap.c | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index b293796c2c77..87d04f989ea3 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -426,12 +426,6 @@ dsshow2(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct s putlongdouble(device_busy, diskrow + 4, lc, 5, 0, 0); } -static void -dsshow3(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct statinfo *then) -{ - dsshow2(diskcol, diskrow, dn, lc, now, then); -} - void dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct statinfo *then) { @@ -439,5 +433,5 @@ dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct sta for (i = 0, lc = 0; i < num_devices && lc < maxdrives; i++) if (dev_select[i].selected) - dsshow3(diskcol, diskrow, i, ++lc, now, then); + dsshow2(diskcol, diskrow, i, ++lc, now, then); } diff --git a/usr.bin/systat/devs.h b/usr.bin/systat/devs.h index cbedd844290e..79a44a6c3f5e 100644 --- a/usr.bin/systat/devs.h +++ b/usr.bin/systat/devs.h @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1998 David E. O'Brien - * 2015 Yoshihiro Ota + * 2015, 2021 Yoshihiro Ota * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,8 @@ #include +#define DISKHIGHT 5 + int dsinit(int); void dsgetinfo(struct statinfo *); int dscmd(const char *, const char *, int, struct statinfo *); diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index b5a19d381ada..b84351379f41 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -135,6 +135,21 @@ parse_cmd_args (int argc, char **argv) } +static void +resize(int signo __unused) +{ + + endwin(); + refresh(); + clear(); + + CMDLINE = LINES - 1; + labels(); + display(); + status(); +} + + int main(int argc, char **argv) { @@ -191,6 +206,7 @@ main(int argc, char **argv) signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); + signal(SIGWINCH, resize); /* * Initialize display. Load average appears in a one line diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index 29b04df0157f..6052ca0d877b 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -136,7 +136,7 @@ labelswap(void) werase(wnd); - dslabel(12, 0, 18); + dslabel(12, 0, LINES - DISKHIGHT - 1); if (kvnsw <= 0) { mvwprintw(wnd, 0, 0, "(swap not configured)"); @@ -162,7 +162,7 @@ showswap(void) if (kvnsw != okvnsw) labelswap(); - dsshow(12, 0, 18, &cur_dev, &last_dev); + dsshow(12, 0, LINES - DISKHIGHT - 1, &cur_dev, &last_dev); if (kvnsw <= 0) return; From owner-dev-commits-src-main@freebsd.org Wed Apr 21 19:59:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D1155F04A1; Wed, 21 Apr 2021 19:59: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 4FQWc63tYPz4R57; Wed, 21 Apr 2021 19:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73C9940C7; Wed, 21 Apr 2021 19:59: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 13LJxoim076346; Wed, 21 Apr 2021 19:59:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LJxotQ076345; Wed, 21 Apr 2021 19:59:50 GMT (envelope-from git) Date: Wed, 21 Apr 2021 19:59:50 GMT Message-Id: <202104211959.13LJxotQ076345@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: 652908599b6f - main - Add required checks for unmapped mbufs in ipdivert and ipfw 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: 652908599b6fa7285ee60cb567b97e70b648ac29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 19:59:50 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=652908599b6fa7285ee60cb567b97e70b648ac29 commit 652908599b6fa7285ee60cb567b97e70b648ac29 Author: Mark Johnston AuthorDate: 2021-04-21 19:38:01 +0000 Commit: Mark Johnston CommitDate: 2021-04-21 19:47:05 +0000 Add required checks for unmapped mbufs in ipdivert and ipfw Also add an M_ASSERTMAPPED() macro to verify that all mbufs in the chain are mapped. Use it in ipfw_nat, which operates on a chain returned by m_megapullup(). PR: 255164 Reviewed by: ae, gallatin MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29838 --- sys/netinet/ip_divert.c | 6 ++++++ sys/netpfil/ipfw/ip_fw_nat.c | 1 + sys/netpfil/ipfw/nat64/nat64_translate.c | 10 ++++++++++ sys/sys/mbuf.h | 11 +++++++++++ 4 files changed, 28 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 70d3fbd1f230..c3f9c43b8f70 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -212,11 +212,17 @@ divert_packet(struct mbuf *m, bool incoming) /* Delayed checksums are currently not compatible with divert. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c index bcda3cff011c..d7b31c29d4ec 100644 --- a/sys/netpfil/ipfw/ip_fw_nat.c +++ b/sys/netpfil/ipfw/ip_fw_nat.c @@ -307,6 +307,7 @@ ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) args->m = NULL; return (IP_FW_DENY); } + M_ASSERTMAPPED(mcl); ip = mtod(mcl, struct ip *); /* diff --git a/sys/netpfil/ipfw/nat64/nat64_translate.c b/sys/netpfil/ipfw/nat64/nat64_translate.c index 4ed3bfa765f6..29666a7d3a9a 100644 --- a/sys/netpfil/ipfw/nat64/nat64_translate.c +++ b/sys/netpfil/ipfw/nat64/nat64_translate.c @@ -1296,6 +1296,11 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *saddr, /* Handle delayed checksums if needed. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + NAT64STAT_INC(&cfg->stats, nomem); + return (NAT64RETURN); + } in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -1673,6 +1678,11 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, uint16_t aport, /* Handle delayed checksums if needed. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + NAT64STAT_INC(&cfg->stats, nomem); + return (NAT64RETURN); + } in6_delayed_cksum(m, plen, hlen); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 52d000fea5fd..729653fa1e55 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1113,6 +1113,17 @@ m_extrefcnt(struct mbuf *m) KASSERT((((struct mbuf *)m)->m_flags & 0) == 0, \ ("%s: attempted use of a free mbuf!", __func__)) +/* Check whether any mbuf in the chain is unmapped. */ +#ifdef INVARIANTS +#define M_ASSERTMAPPED(m) do { \ + for (struct mbuf *__m = (m); __m != NULL; __m = __m->m_next) \ + KASSERT((__m->m_flags & M_EXTPG) == 0, \ + ("%s: chain %p contains an unmapped mbuf", __func__, (m)));\ +} while (0) +#else +#define M_ASSERTMAPPED(m) +#endif + /* * Return the address of the start of the buffer associated with an mbuf, * handling external storage, packet-header mbufs, and regular data mbufs. From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:01:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E9435F07AD; Wed, 21 Apr 2021 20:01: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 4FQWfN1qwVz4RKh; Wed, 21 Apr 2021 20:01:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 322974548; Wed, 21 Apr 2021 20:01: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 13LK1mDC089633; Wed, 21 Apr 2021 20:01:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LK1mpd089632; Wed, 21 Apr 2021 20:01:48 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:01:48 GMT Message-Id: <202104212001.13LK1mpd089632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 01d74fe1ffc3 - main - Path MTU discovery hooks for offloaded TCP connections. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01d74fe1ffc32dc7f42dc0fb0c4861276a6b2bd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:01:48 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=01d74fe1ffc32dc7f42dc0fb0c4861276a6b2bd2 commit 01d74fe1ffc32dc7f42dc0fb0c4861276a6b2bd2 Author: Navdeep Parhar AuthorDate: 2021-04-13 00:25:22 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-21 20:00:16 +0000 Path MTU discovery hooks for offloaded TCP connections. Notify the TOE driver when when an ICMP type 3 code 4 (Fragmentation needed and DF set) message is received for an offloaded connection. This gives the driver an opportunity to lower the path MTU for the connection and resume transmission, much like what the kernel does for the connections that it handles. Reviewed by: glebius@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29755 --- sys/netinet/tcp_offload.c | 11 +++++++ sys/netinet/tcp_offload.h | 3 ++ sys/netinet/tcp_subr.c | 80 ++++++++++++++++++++++++++++++++--------------- sys/netinet/toecore.c | 9 ++++++ sys/netinet/toecore.h | 4 +++ 5 files changed, 81 insertions(+), 26 deletions(-) diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c index ba190f0303f1..84a4bc3c31a3 100644 --- a/sys/netinet/tcp_offload.c +++ b/sys/netinet/tcp_offload.c @@ -219,3 +219,14 @@ tcp_offload_detach(struct tcpcb *tp) tod->tod_pcb_detach(tod, tp); } + +void +tcp_offload_pmtu_update(struct tcpcb *tp, tcp_seq seq, int mtu) +{ + struct toedev *tod = tp->tod; + + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); + INP_WLOCK_ASSERT(tp->t_inpcb); + + tod->tod_pmtu_update(tod, tp, seq, mtu); +} diff --git a/sys/netinet/tcp_offload.h b/sys/netinet/tcp_offload.h index 19c120ccdd7d..8f3786e9f7eb 100644 --- a/sys/netinet/tcp_offload.h +++ b/sys/netinet/tcp_offload.h @@ -36,6 +36,8 @@ #error "no user-serviceable parts inside" #endif +#include + extern int registered_toedevs; int tcp_offload_connect(struct socket *, struct sockaddr *); @@ -48,5 +50,6 @@ void tcp_offload_ctloutput(struct tcpcb *, int, int); void tcp_offload_tcp_info(struct tcpcb *, struct tcp_info *); int tcp_offload_alloc_tls_session(struct tcpcb *, struct ktls_session *, int); void tcp_offload_detach(struct tcpcb *); +void tcp_offload_pmtu_update(struct tcpcb *, tcp_seq, int); #endif diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 1ce7a5b1fcf3..b5ecdc6f2307 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2791,6 +2791,21 @@ SYSCTL_PROC(_net_inet6_tcp6, OID_AUTO, getcred, #endif /* INET6 */ #ifdef INET +/* Path MTU to try next when a fragmentation-needed message is received. */ +static inline int +tcp_next_pmtu(const struct icmp *icp, const struct ip *ip) +{ + int mtu = ntohs(icp->icmp_nextmtu); + + /* If no alternative MTU was proposed, try the next smaller one. */ + if (!mtu) + mtu = ip_next_mtu(ntohs(ip->ip_len), 1); + if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) + mtu = V_tcp_minmss + sizeof(struct tcpiphdr); + + return (mtu); +} + static void tcp_ctlinput_with_port(int cmd, struct sockaddr *sa, void *vip, uint16_t port) { @@ -2846,6 +2861,17 @@ tcp_ctlinput_with_port(int cmd, struct sockaddr *sa, void *vip, uint16_t port) !(inp->inp_flags & INP_DROPPED) && !(inp->inp_socket == NULL)) { tp = intotcpcb(inp); +#ifdef TCP_OFFLOAD + if (tp->t_flags & TF_TOE && cmd == PRC_MSGSIZE) { + /* + * MTU discovery for offloaded connections. Let + * the TOE driver verify seq# and process it. + */ + mtu = tcp_next_pmtu(icp, ip); + tcp_offload_pmtu_update(tp, icmp_tcp_seq, mtu); + goto out; + } +#endif if (tp->t_port != port) { goto out; } @@ -2853,24 +2879,11 @@ tcp_ctlinput_with_port(int cmd, struct sockaddr *sa, void *vip, uint16_t port) SEQ_LT(ntohl(icmp_tcp_seq), tp->snd_max)) { if (cmd == PRC_MSGSIZE) { /* - * MTU discovery: - * If we got a needfrag set the MTU - * in the route to the suggested new - * value (if given) and then notify. + * MTU discovery: we got a needfrag and + * will potentially try a lower MTU. */ - mtu = ntohs(icp->icmp_nextmtu); - /* - * If no alternative MTU was - * proposed, try the next smaller - * one. - */ - if (!mtu) - mtu = ip_next_mtu( - ntohs(ip->ip_len), 1); - if (mtu < V_tcp_minmss + - sizeof(struct tcpiphdr)) - mtu = V_tcp_minmss + - sizeof(struct tcpiphdr); + mtu = tcp_next_pmtu(icp, ip); + /* * Only process the offered MTU if it * is smaller than the current one. @@ -2948,6 +2961,20 @@ tcp_ctlinput_viaudp(int cmd, struct sockaddr *sa, void *vip, void *unused) #endif /* INET */ #ifdef INET6 +static inline int +tcp6_next_pmtu(const struct icmp6_hdr *icmp6) +{ + int mtu = ntohl(icmp6->icmp6_mtu); + + /* + * If no alternative MTU was proposed, or the proposed MTU was too + * small, set to the min. + */ + if (mtu < IPV6_MMTU) + mtu = IPV6_MMTU - 8; /* XXXNP: what is the adjustment for? */ + return (mtu); +} + static void tcp6_ctlinput_with_port(int cmd, struct sockaddr *sa, void *d, uint16_t port) { @@ -3039,6 +3066,14 @@ tcp6_ctlinput_with_port(int cmd, struct sockaddr *sa, void *d, uint16_t port) !(inp->inp_flags & INP_DROPPED) && !(inp->inp_socket == NULL)) { tp = intotcpcb(inp); +#ifdef TCP_OFFLOAD + if (tp->t_flags & TF_TOE && cmd == PRC_MSGSIZE) { + /* MTU discovery for offloaded connections. */ + mtu = tcp6_next_pmtu(icmp6); + tcp_offload_pmtu_update(tp, icmp_tcp_seq, mtu); + goto out; + } +#endif if (tp->t_port != port) { goto out; } @@ -3051,15 +3086,8 @@ tcp6_ctlinput_with_port(int cmd, struct sockaddr *sa, void *d, uint16_t port) * in the route to the suggested new * value (if given) and then notify. */ - mtu = ntohl(icmp6->icmp6_mtu); - /* - * If no alternative MTU was - * proposed, or the proposed - * MTU was too small, set to - * the min. - */ - if (mtu < IPV6_MMTU) - mtu = IPV6_MMTU - 8; + mtu = tcp6_next_pmtu(icmp6); + bzero(&inc, sizeof(inc)); inc.inc_fibnum = M_GETFIB(m); inc.inc_flags |= INC_ISIPV6; diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index d8d499a6fde3..5792298d2883 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -199,6 +199,14 @@ toedev_alloc_tls_session(struct toedev *tod __unused, struct tcpcb *tp __unused, return (EINVAL); } +static void +toedev_pmtu_update(struct toedev *tod __unused, struct tcpcb *tp __unused, + tcp_seq seq __unused, int mtu __unused) +{ + + return; +} + /* * Inform one or more TOE devices about a listening socket. */ @@ -290,6 +298,7 @@ init_toedev(struct toedev *tod) tod->tod_ctloutput = toedev_ctloutput; tod->tod_tcp_info = toedev_tcp_info; tod->tod_alloc_tls_session = toedev_alloc_tls_session; + tod->tod_pmtu_update = toedev_pmtu_update; } /* diff --git a/sys/netinet/toecore.h b/sys/netinet/toecore.h index 36493abf7149..ce796ab54dc5 100644 --- a/sys/netinet/toecore.h +++ b/sys/netinet/toecore.h @@ -35,6 +35,7 @@ #error "no user-serviceable parts inside" #endif +#include #include struct tcpopt; @@ -114,6 +115,9 @@ struct toedev { /* Create a TLS session */ int (*tod_alloc_tls_session)(struct toedev *, struct tcpcb *, struct ktls_session *, int); + + /* ICMP fragmentation-needed received, adjust PMTU. */ + void (*tod_pmtu_update)(struct toedev *, struct tcpcb *, tcp_seq, int); }; typedef void (*tcp_offload_listen_start_fn)(void *, struct tcpcb *); From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:35:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B090F5F0FC6; Wed, 21 Apr 2021 20:35: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 4FQXNt4dM9z4Sgp; Wed, 21 Apr 2021 20:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E11A4E03; Wed, 21 Apr 2021 20:35: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 13LKZAoX029277; Wed, 21 Apr 2021 20:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LKZAqW029276; Wed, 21 Apr 2021 20:35:10 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:35:10 GMT Message-Id: <202104212035.13LKZAqW029276@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: 50f6c1399700 - main - pmc_allocate(3): document the count argument 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: 50f6c139970084adeefec98c658645c34b72209e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:35:10 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=50f6c139970084adeefec98c658645c34b72209e commit 50f6c139970084adeefec98c658645c34b72209e Author: Mitchell Horne AuthorDate: 2021-04-21 20:27:49 +0000 Commit: Mitchell Horne CommitDate: 2021-04-21 20:35:03 +0000 pmc_allocate(3): document the count argument This was added in b2ca2e50b9aa, and serves to provide an initial value to the PMC, eliminating the need for a second syscall via pmc_set(3). Reviewed by: gnn, 0mp (manpages) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29885 --- lib/libpmc/pmc_allocate.3 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/libpmc/pmc_allocate.3 b/lib/libpmc/pmc_allocate.3 index 291ca8ac0113..515b427cf7bc 100644 --- a/lib/libpmc/pmc_allocate.3 +++ b/lib/libpmc/pmc_allocate.3 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2008 +.Dd April 21, 2021 .Dt PMC_ALLOCATE 3 .Os .Sh NAME @@ -41,6 +41,7 @@ .Fa "uint32_t flags" .Fa "int cpu" .Fa "pmc_id_t *pmcid" +.Fa "uint64_t count" .Fc .Ft int .Fn pmc_release "pmc_id_t pmc" @@ -111,6 +112,20 @@ Process scope PMC allocations should specify the constant .Dv PMC_CPU_ANY for this argument. .Pp +The +.Fa count +argument behaves identically to the +.Xr pmc_set 3 +function's +.Fa value +argument. +For counting PMCs, +.Fa count +specifies the initial value of the allocated PMC. +For sampling PMCs, +.Fa count +specifies the reload count. +.Pp Function .Fn pmc_release releases the PMC denoted by argument From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:35:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BD525F0FCD; Wed, 21 Apr 2021 20: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 4FQXNv6lzGz4SMK; Wed, 21 Apr 2021 20:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A366B4C37; Wed, 21 Apr 2021 20:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13LKZBdq029328; Wed, 21 Apr 2021 20:35:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LKZBwf029319; Wed, 21 Apr 2021 20:35:11 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:35:11 GMT Message-Id: <202104212035.13LKZBwf029319@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: edcf9e59c356 - main - pmcstat: set initial counter value to zero 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: edcf9e59c356525632dd2546d72916aeca609a2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:35:12 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=edcf9e59c356525632dd2546d72916aeca609a2b commit edcf9e59c356525632dd2546d72916aeca609a2b Author: Mitchell Horne AuthorDate: 2021-04-21 20:28:12 +0000 Commit: Mitchell Horne CommitDate: 2021-04-21 20:35:03 +0000 pmcstat: set initial counter value to zero For an infrequent event, pmcstat may report (u_long)-1 for CPUs where the counter was never incremented. Just set this to zero, instead. ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but this wasn't always the case. Reviewed by: gnn MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29887 --- usr.sbin/pmcstat/pmcstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index 688a98843652..b7f6c5e0f63e 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -675,7 +675,7 @@ main(int argc, char **argv) if (option == 'S' || option == 'P') ev->ev_count = current_sampling_count ? current_sampling_count : pmc_pmu_sample_rate_get(ev->ev_spec); else - ev->ev_count = -1; + ev->ev_count = 0; if (option == 'S' || option == 's') ev->ev_cpu = CPU_FFS(&cpumask) - 1; From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:47:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D9F85F1AA2; Wed, 21 Apr 2021 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 4FQXgT1HXCz4TKl; Wed, 21 Apr 2021 20:47:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AAE14E3A; Wed, 21 Apr 2021 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 13LKlmmH042507; Wed, 21 Apr 2021 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 13LKlmdq042506; Wed, 21 Apr 2021 20:47:48 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:47:48 GMT Message-Id: <202104212047.13LKlmdq042506@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: c4473add1d3d - main - pmcstat: fix the usage message for -t 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: c4473add1d3d588d8747cab86796d2f2d4c8847c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:47:49 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c4473add1d3d588d8747cab86796d2f2d4c8847c commit c4473add1d3d588d8747cab86796d2f2d4c8847c Author: Mitchell Horne AuthorDate: 2021-04-21 20:44:52 +0000 Commit: Mitchell Horne CommitDate: 2021-04-21 20:44:52 +0000 pmcstat: fix the usage message for -t A slight mix-up of the flags means this case isn't triggered when it should be. Now, `pmcstat -s event -t 1234` will print the correct error message. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- usr.sbin/pmcstat/pmcstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index b7f6c5e0f63e..997005cec269 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -898,7 +898,8 @@ main(int argc, char **argv) pmcstat_show_usage(); /* check for -t pid without a process PMC spec */ - if ((args.pa_required & FLAG_HAS_TARGET) && + if ((args.pa_flags & FLAG_HAS_TARGET) && + (args.pa_required & FLAG_HAS_PROCESS_PMCS) && (args.pa_flags & FLAG_HAS_PROCESS_PMCS) == 0) errx(EX_USAGE, "ERROR: option -t requires a process mode PMC to be specified." From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:57:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE5C45F1A58; Wed, 21 Apr 2021 20:57: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 4FQXtz4Qwsz4TrM; Wed, 21 Apr 2021 20:57:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 869104EC7; Wed, 21 Apr 2021 20:57: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 13LKvlmU056083; Wed, 21 Apr 2021 20:57:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LKvlYw056082; Wed, 21 Apr 2021 20:57:47 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:57:47 GMT Message-Id: <202104212057.13LKvlYw056082@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: 753bcca440a4 - main - riscv: Clear SUM in SSTATUS for supervisor mode exceptions. 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: 753bcca440a4d2c95f48536b586131b84c0bb87e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:57:47 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=753bcca440a4d2c95f48536b586131b84c0bb87e commit 753bcca440a4d2c95f48536b586131b84c0bb87e Author: John Baldwin AuthorDate: 2021-04-21 20:57:04 +0000 Commit: John Baldwin CommitDate: 2021-04-21 20:57:04 +0000 riscv: Clear SUM in SSTATUS for supervisor mode exceptions. Previously, a page fault taken during copyin/out and related functions would run the entire fault handler while permitting direct access to user addresses. This could also leak across context switches (e.g. if the page fault handler was preempted by an interrupt or slept for disk I/O). To fix, clear SUM in assembly after saving the original version of SSTATUS in the supervisor mode trapframe. Reviewed by: mhorne, jrtc27 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29763 --- sys/riscv/riscv/exception.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/riscv/riscv/exception.S b/sys/riscv/riscv/exception.S index 50134980c7af..abd1307174f1 100644 --- a/sys/riscv/riscv/exception.S +++ b/sys/riscv/riscv/exception.S @@ -104,6 +104,11 @@ __FBSDID("$FreeBSD$"); sd t0, (TF_SEPC)(sp) csrr t0, sstatus sd t0, (TF_SSTATUS)(sp) +.if \mode == 1 + /* Disable user address access for supervisor mode exceptions. */ + li t0, SSTATUS_SUM + csrc sstatus, t0 +.endif csrr t0, stval sd t0, (TF_STVAL)(sp) csrr t0, scause From owner-dev-commits-src-main@freebsd.org Wed Apr 21 20:57:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCF5F5F1F8C; Wed, 21 Apr 2021 20:57: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 4FQXv04sw5z4TXy; Wed, 21 Apr 2021 20:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98DFC5130; Wed, 21 Apr 2021 20:57: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 13LKvmrC056104; Wed, 21 Apr 2021 20:57:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LKvmQb056103; Wed, 21 Apr 2021 20:57:48 GMT (envelope-from git) Date: Wed, 21 Apr 2021 20:57:48 GMT Message-Id: <202104212057.13LKvmQb056103@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: 6a3a6fe34bf3 - main - riscv: Assert that SUM is not set in SSTATUS for exceptions. 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: 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 20:57:48 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3a6fe34bf36b6e745b3e9ad1a991de057729c7 commit 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7 Author: John Baldwin AuthorDate: 2021-04-21 20:57:20 +0000 Commit: John Baldwin CommitDate: 2021-04-21 20:57:20 +0000 riscv: Assert that SUM is not set in SSTATUS for exceptions. Reviewed by: mhorne Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29764 --- sys/riscv/riscv/trap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 599fd64b56be..0aaaf46eb629 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -274,6 +274,9 @@ do_trap_supervisor(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP, ("Came from S mode with interrupts enabled")); + KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, + ("Came from S mode with SUM enabled")); + exception = frame->tf_scause & SCAUSE_CODE; if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */ @@ -342,6 +345,9 @@ do_trap_user(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, ("Came from U mode with interrupts enabled")); + KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, + ("Came from U mode with SUM enabled")); + exception = frame->tf_scause & SCAUSE_CODE; if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */ From owner-dev-commits-src-main@freebsd.org Wed Apr 21 21:37:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3F125F2B08; Wed, 21 Apr 2021 21:37: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 4FQYms6V9tz4WHc; Wed, 21 Apr 2021 21:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1DCA5553; Wed, 21 Apr 2021 21:37: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 13LLbXde009546; Wed, 21 Apr 2021 21:37:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LLbXah009545; Wed, 21 Apr 2021 21:37:33 GMT (envelope-from git) Date: Wed, 21 Apr 2021 21:37:33 GMT Message-Id: <202104212137.13LLbXah009545@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: 1eebd6158ccc - main - newbus: Optimize/Simplify kobj_class_compile_common a little 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: 1eebd6158cccf12f3b057d6a1adf9d40ec59844c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 21:37:34 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1eebd6158cccf12f3b057d6a1adf9d40ec59844c commit 1eebd6158cccf12f3b057d6a1adf9d40ec59844c Author: Warner Losh AuthorDate: 2021-04-21 21:35:54 +0000 Commit: Warner Losh CommitDate: 2021-04-21 21:37:24 +0000 newbus: Optimize/Simplify kobj_class_compile_common a little "i" is not used in this loop at all. There's no need to initialize and increment it. Reviewed by: markj@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29898 --- sys/kern/subr_kobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c index d001450cba6f..17d23336e333 100644 --- a/sys/kern/subr_kobj.c +++ b/sys/kern/subr_kobj.c @@ -112,7 +112,7 @@ kobj_class_compile_common(kobj_class_t cls, kobj_ops_t ops) /* * First register any methods which need it. */ - for (i = 0, m = cls->methods; m->desc; i++, m++) { + for (m = cls->methods; m->desc; m++) { if (m->desc->id == 0) m->desc->id = kobj_next_id++; } From owner-dev-commits-src-main@freebsd.org Wed Apr 21 21:37:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DCE75F2A90; Wed, 21 Apr 2021 21:37: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 4FQYmv0KwCz4WNf; Wed, 21 Apr 2021 21:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0D4D59CB; Wed, 21 Apr 2021 21:37: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 13LLbYRW009574; Wed, 21 Apr 2021 21:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LLbYBj009573; Wed, 21 Apr 2021 21:37:34 GMT (envelope-from git) Date: Wed, 21 Apr 2021 21:37:34 GMT Message-Id: <202104212137.13LLbYBj009573@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: df456a1fcf73 - main - newbus: style nit (align comments) 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: df456a1fcf73fd2acdeefe4fe324836bda421ce2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 21:37:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=df456a1fcf73fd2acdeefe4fe324836bda421ce2 commit df456a1fcf73fd2acdeefe4fe324836bda421ce2 Author: Warner Losh AuthorDate: 2021-04-18 05:44:25 +0000 Commit: Warner Losh CommitDate: 2021-04-21 21:37:24 +0000 newbus: style nit (align comments) Sponsored by: Netflix --- sys/kern/subr_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 08f1cb5886d2..12399df40a5d 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -100,7 +100,7 @@ typedef TAILQ_HEAD(device_list, _device) device_list_t; struct devclass { TAILQ_ENTRY(devclass) link; devclass_t parent; /* parent in devclass hierarchy */ - driver_list_t drivers; /* bus devclasses store drivers for bus */ + driver_list_t drivers; /* bus devclasses store drivers for bus */ char *name; device_t *devices; /* array of devices indexed by unit */ int maxunit; /* size of devices array */ From owner-dev-commits-src-main@freebsd.org Thu Apr 22 07:59:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71ED75E3370; Thu, 22 Apr 2021 07:59: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 4FQqb22pngz3H9Q; Thu, 22 Apr 2021 07:59:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 533C31640C; Thu, 22 Apr 2021 07:59: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 13M7xwpa034093; Thu, 22 Apr 2021 07:59:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13M7xwCt034092; Thu, 22 Apr 2021 07:59:58 GMT (envelope-from git) Date: Thu, 22 Apr 2021 07:59:58 GMT Message-Id: <202104220759.13M7xwCt034092@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: 4044af03a4e9 - main - Fix vtnet TCP lro panic 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: 4044af03a4e95642d8d1982800c079029c2b087c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 07:59:58 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4044af03a4e95642d8d1982800c079029c2b087c commit 4044af03a4e95642d8d1982800c079029c2b087c Author: Alexander V. Chernikov AuthorDate: 2021-04-19 15:58:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-19 16:06:34 +0000 Fix vtnet TCP lro panic Differential Revision: https://reviews.freebsd.org/D29900 Reviewed by: hps, kp --- sys/dev/virtio/network/if_vtnet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 3650d19fbe0e..e65914c5184f 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2145,7 +2145,8 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) if (deq > 0) { #if defined(INET) || defined(INET6) - tcp_lro_flush_all(&rxq->vtnrx_lro); + if (vtnet_software_lro(sc)) + tcp_lro_flush_all(&rxq->vtnrx_lro); #endif virtqueue_notify(vq); } From owner-dev-commits-src-main@freebsd.org Thu Apr 22 09:37:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A140C5E7D22; Thu, 22 Apr 2021 09:37: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 4FQslH4C9Bz3P61; Thu, 22 Apr 2021 09:37:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83348176E9; Thu, 22 Apr 2021 09:37: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 13M9bFPX068040; Thu, 22 Apr 2021 09:37:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13M9bFo5068039; Thu, 22 Apr 2021 09:37:15 GMT (envelope-from git) Date: Thu, 22 Apr 2021 09:37:15 GMT Message-Id: <202104220937.13M9bFo5068039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 7c707c7c25ad - main - __FreeBSD_version: update the references to the doc tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c707c7c25ad361f911716c31d22f5722f4dffc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 09:37:15 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=7c707c7c25ad361f911716c31d22f5722f4dffc9 commit 7c707c7c25ad361f911716c31d22f5722f4dffc9 Author: Ka Ho Ng AuthorDate: 2021-04-22 09:36:22 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-22 09:36:22 +0000 __FreeBSD_version: update the references to the doc tree Update the reference of which file to update in the doc tree when bumping __FreeBSD_version. This change is to catch up with commit f8fed61b80 in the doc repository. MFC after: 3 days Approved by: lwhsu (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29920 --- 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 fbdb0eb6ea0d..e4fdb272b7fe 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -52,7 +52,7 @@ * there. * Currently this lives here in the doc/ repository: * - * documentation/content/en/books/porters-handbook/versions/chapter.adoc + * documentation/content/en/books/porters-handbook/versions/_index.adoc * * scheme is: Rxx * 'R' is in the range 0 to 4 if this is a release branch or From owner-dev-commits-src-main@freebsd.org Thu Apr 22 10:19:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CC395E9528; Thu, 22 Apr 2021 10:19:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQtgv0806z3R4h; Thu, 22 Apr 2021 10:19:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 13MAJ8qb005242 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 22 Apr 2021 13:19:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 13MAJ8qb005242 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 13MAJ7Gr005241; Thu, 22 Apr 2021 13:19:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Apr 2021 13:19:07 +0300 From: Konstantin Belousov To: myfreeweb Cc: John Baldwin , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end Message-ID: References: <202101121143.10CBh02x095972@gitrepo.freebsd.org> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> <171B7072-9BAE-46BB-82BA-4792AEBAD0EB@unrelenting.technology> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FQtgv0806z3R4h X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.70 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-0.88)[-0.880]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[6]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.19)[0.185]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 10:19:24 -0000 On Thu, Jan 14, 2021 at 04:23:31AM +0200, Konstantin Belousov wrote: > On Thu, Jan 14, 2021 at 01:36:27AM +0000, myfreeweb wrote: > > > > > > On January 13, 2021 8:58:58 PM UTC, John Baldwin wrote: > > >It doesn't store at all because threads aren't allowed to sleep in a critical > > >section, so the thread will never give up the CPU while in the FPU section. If > > >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while using > > >kernel_fpu_begin(), then NOCTX won't work and we will need something else. > > > > Hmm but with no storage at all, how would it work from a syscall? > > The manpage does mention a "usermode save area" – I was talking about that. > There is a storage for the user state, always. When NOCTX is used, FPU state > is spilled into the _current_ save area, and then kernel lives to the promise > that the new state after fpu_enter(NOCTX) does not ever need to be saved. > > > > > Linux kernel_fpu_begin starts with preempt_disable, so definitely no condvars and the like. No idea about simple time sleeps. But amdgpu doesn't seem to do even that. > > You should get enough assertions fired if something tries to context switch > while entered NOCTX region. So this went dead in the mail, and kernel still contains that awful code that corrupts both userspace and kernel FPU contexts. I suggest to remove this file at all, since things are not being sorted. From owner-dev-commits-src-main@freebsd.org Thu Apr 22 10:27:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FF85E9A93; Thu, 22 Apr 2021 10:27:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQtrs2FqMz3R6G; Thu, 22 Apr 2021 10:27:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F83918240; Thu, 22 Apr 2021 10:27: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 13MAR9dG034659; Thu, 22 Apr 2021 10:27:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MAR9dV034658; Thu, 22 Apr 2021 10:27:09 GMT (envelope-from git) Date: Thu, 22 Apr 2021 10:27:09 GMT Message-Id: <202104221027.13MAR9dV034658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d2c87140648f - main - Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver. Since then, the FreeBSD USB stack has got proper USB RNDIS support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2c87140648f61a6f139a2ecdf831e6a08cc4de2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 10:27:09 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c87140648f61a6f139a2ecdf831e6a08cc4de2 commit d2c87140648f61a6f139a2ecdf831e6a08cc4de2 Author: Hans Petter Selasky AuthorDate: 2021-04-22 10:22:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-22 10:23:36 +0000 Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver. Since then, the FreeBSD USB stack has got proper USB RNDIS support. PR: 254345 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/net/if_cdce.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 7bdb81f97b38..96df8b73f8ce 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -268,7 +268,6 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VPI(USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2501, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5500, CDCE_FLAG_ZAURUS)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5600, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, From owner-dev-commits-src-main@freebsd.org Thu Apr 22 10:37:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01BB35EA4A2; Thu, 22 Apr 2021 10:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQv4h6gPsz3hdZ; Thu, 22 Apr 2021 10:37:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD1DA18272; Thu, 22 Apr 2021 10:37: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 13MAbOjI047616; Thu, 22 Apr 2021 10:37:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MAbOHd047615; Thu, 22 Apr 2021 10:37:24 GMT (envelope-from git) Date: Thu, 22 Apr 2021 10:37:24 GMT Message-Id: <202104221037.13MAbOHd047615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 28af0c4814f5 - main - Add more USB quirks for Garmin devices. Sort the Garmin products while at it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28af0c4814f5fb8ce047d4ac0bbf26997ac5cc8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 10:37:25 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=28af0c4814f5fb8ce047d4ac0bbf26997ac5cc8f commit 28af0c4814f5fb8ce047d4ac0bbf26997ac5cc8f Author: Hans Petter Selasky AuthorDate: 2021-04-22 10:31:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-22 10:35:07 +0000 Add more USB quirks for Garmin devices. Sort the Garmin products while at it. PR: 254664 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/quirk/usb_quirk.c | 2 ++ sys/dev/usb/usbdevs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index e792523dd472..0acc341e385b 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -243,6 +243,8 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(GARMIN, DAKOTA20, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, FORERUNNER230, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, GPSMAP62S, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, EDGETOURINGPLUS, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, INSTINCTSOLAR, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 9bd95e03d41c..fcb7cd0953c1 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2255,10 +2255,12 @@ product FUJITSU AH_F401U 0x105b AH-F401U Air H device product FUJITSUSIEMENS SCR 0x0009 Fujitsu-Siemens SCR USB Reader /* Garmin products */ -product GARMIN DAKOTA20 0x23c0 Dakota 20 +product GARMIN IQUE_3600 0x0004 iQue 3600 product GARMIN FORERUNNER230 0x086d ForeRunner 230 +product GARMIN INSTINCTSOLAR 0x0d8a Instinct Solar +product GARMIN DAKOTA20 0x23c0 Dakota 20 product GARMIN GPSMAP62S 0x2459 GPSMAP 62s -product GARMIN IQUE_3600 0x0004 iQue 3600 +product GARMIN EDGETOURINGPLUS 0x26c8 Edge Touring+ /* Gemalto products */ product GEMALTO PROXPU 0x5501 Prox-PU/CU RFID Card Reader From owner-dev-commits-src-main@freebsd.org Thu Apr 22 10:42:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BEBD5EA55F; Thu, 22 Apr 2021 10:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQvB62hCdz3hwD; Thu, 22 Apr 2021 10:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F4401836C; Thu, 22 Apr 2021 10:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MAg6eM059887; Thu, 22 Apr 2021 10:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MAg650059886; Thu, 22 Apr 2021 10:42:06 GMT (envelope-from git) Date: Thu, 22 Apr 2021 10:42:06 GMT Message-Id: <202104221042.13MAg650059886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 47bc8fc9ae6b - main - Add more USB quirks for Kingston devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47bc8fc9ae6ba7aa708e0d4ee059a377ae707e5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 10:42:06 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=47bc8fc9ae6ba7aa708e0d4ee059a377ae707e5a commit 47bc8fc9ae6ba7aa708e0d4ee059a377ae707e5a Author: Hans Petter Selasky AuthorDate: 2021-04-22 10:40:17 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-22 10:40:29 +0000 Add more USB quirks for Kingston devices. PR: 253855 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/quirk/usb_quirk.c | 1 + sys/dev/usb/usbdevs | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 0acc341e385b..cab6f1b7c074 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -293,6 +293,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(KINGSTON, HYPERX3_0, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(KINGSTON, DATATRAVELER3_0, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(KYOCERA, FINECAM_L3, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(KYOCERA, FINECAM_S3X, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index fcb7cd0953c1..d92d98614b07 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2727,6 +2727,7 @@ product KEYSPAN UIA11 0x0202 UIA-11 remote control product KINGSTON XX1 0x0008 Ethernet product KINGSTON KNU101TX 0x000a KNU101TX USB Ethernet product KINGSTON HYPERX3_0 0x162b DT HyperX 3.0 +product KINGSTON DATATRAVELER3_0 0x1666 DataTraveler 3.0 /* Kawasaki products */ product KLSI DUH3E10BT 0x0008 USB Ethernet From owner-dev-commits-src-main@freebsd.org Thu Apr 22 11:22:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4442D5ED7C9; Thu, 22 Apr 2021 11:22:45 +0000 (UTC) (envelope-from greg@unrelenting.technology) Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQw510b1fz3mvq; Thu, 22 Apr 2021 11:22:44 +0000 (UTC) (envelope-from greg@unrelenting.technology) Date: Thu, 22 Apr 2021 14:22:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unrelenting.technology; s=key1; t=1619090556; 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=dUJJ+mcjrBNRFddUc175K2rTmzP2X/JonJIYyHEZRX0=; b=CeiSz/Y0evMrwFDQpX9ms8RayWwI72OBrep4AqoOi7eBQjNRpi0oHN3IEoCl/2dDdtlbK7 YUf2Z5NRCOrdbYcWJc1quoYLXc5NGcsdu3v0QqC+2BwJr703LxxpxBsCv07Z/MdXgXODMZ ++SkWvg1f59FxVF8lTNgr193ZmFSz9OJuoxfBoa8NHGgRxwpIVZ6baj6835c3Q5Zth88If MsC5g51qkqwbj6W58tYl73eXubjECRbjTtCZqP8IMxW0zit0nQrMddNFTFP4ekjJK1JqC7 YXdg75CGNYXbdMn46Et7VUC0qJE0VXBLj7D5xltriHuVHLCzKj0mOtdvxsYl0w== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Greg V Subject: Re: git: 11d62b6f31ab - main - linuxkpi: =?UTF-8?Q?add=0D=0A?= kernel_fpu_begin/kernel_fpu_end To: Konstantin Belousov Cc: John Baldwin , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-Id: In-Reply-To: References: <202101121143.10CBh02x095972@gitrepo.freebsd.org> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> <171B7072-9BAE-46BB-82BA-4792AEBAD0EB@unrelenting.technology> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: greg@unrelenting.technology X-Rspamd-Queue-Id: 4FQw510b1fz3mvq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 11:22:45 -0000 On Thu, Apr 22, 2021 at 13:19, Konstantin Belousov=20 wrote: > On Thu, Jan 14, 2021 at 04:23:31AM +0200, Konstantin Belousov wrote: >> On Thu, Jan 14, 2021 at 01:36:27AM +0000, myfreeweb wrote: >> > >> > >> > On January 13, 2021 8:58:58 PM UTC, John Baldwin=20 >> wrote: >> > >It doesn't store at all because threads aren't allowed to sleep=20 >> in a critical >> > >section, so the thread will never give up the CPU while in the=20 >> FPU section. If >> > >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while=20 >> using >> > >kernel_fpu_begin(), then NOCTX won't work and we will need=20 >> something else. >> > >> > Hmm but with no storage at all, how would it work from a syscall? >> > The manpage does mention a "usermode save area" =96 I was talking=20 >> about that. >> There is a storage for the user state, always. When NOCTX is used,=20 >> FPU state >> is spilled into the _current_ save area, and then kernel lives to=20 >> the promise >> that the new state after fpu_enter(NOCTX) does not ever need to be=20 >> saved. >>=20 >> > >> > Linux kernel_fpu_begin starts with preempt_disable, so definitely=20 >> no condvars and the like. No idea about simple time sleeps. But=20 >> amdgpu doesn't seem to do even that. >>=20 >> You should get enough assertions fired if something tries to=20 >> context switch >> while entered NOCTX region. >=20 > So this went dead in the mail, and kernel still contains that awful=20 > code > that corrupts both userspace and kernel FPU contexts. >=20 > I suggest to remove this file at all, since things are not being=20 > sorted. Okay, let's try NOCTX: https://reviews.freebsd.org/D29921 I don't understand how using a full fpu_kern_ctx can *corrupt* anything=20 though? It should only be extra overhead? From owner-dev-commits-src-main@freebsd.org Thu Apr 22 11:38:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E26C5EE974; Thu, 22 Apr 2021 11:38:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQwRW6sg2z3p02; Thu, 22 Apr 2021 11:38:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 13MBcd2A025112 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 22 Apr 2021 14:38:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 13MBcd2A025112 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 13MBcdQW025111; Thu, 22 Apr 2021 14:38:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Apr 2021 14:38:39 +0300 From: Konstantin Belousov To: Greg V Cc: John Baldwin , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 11d62b6f31ab - main - linuxkpi: add?? kernel_fpu_begin/kernel_fpu_end Message-ID: References: <202101121143.10CBh02x095972@gitrepo.freebsd.org> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> <171B7072-9BAE-46BB-82BA-4792AEBAD0EB@unrelenting.technology> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FQwRW6sg2z3p02 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 11:38:48 -0000 On Thu, Apr 22, 2021 at 02:22:27PM +0300, Greg V wrote: > > > On Thu, Apr 22, 2021 at 13:19, Konstantin Belousov > wrote: > > On Thu, Jan 14, 2021 at 04:23:31AM +0200, Konstantin Belousov wrote: > > > On Thu, Jan 14, 2021 at 01:36:27AM +0000, myfreeweb wrote: > > > > > > > > > > > > On January 13, 2021 8:58:58 PM UTC, John Baldwin > > > wrote: > > > > >It doesn't store at all because threads aren't allowed to sleep > > > in a critical > > > > >section, so the thread will never give up the CPU while in the > > > FPU section. If > > > > >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while > > > using > > > > >kernel_fpu_begin(), then NOCTX won't work and we will need > > > something else. > > > > > > > > Hmm but with no storage at all, how would it work from a syscall? > > > > The manpage does mention a "usermode save area" – I was talking > > > about that. > > > There is a storage for the user state, always. When NOCTX is used, > > > FPU state > > > is spilled into the _current_ save area, and then kernel lives to > > > the promise > > > that the new state after fpu_enter(NOCTX) does not ever need to be > > > saved. > > > > > > > > > > > Linux kernel_fpu_begin starts with preempt_disable, so definitely > > > no condvars and the like. No idea about simple time sleeps. But > > > amdgpu doesn't seem to do even that. > > > > > > You should get enough assertions fired if something tries to > > > context switch > > > while entered NOCTX region. > > > > So this went dead in the mail, and kernel still contains that awful code > > that corrupts both userspace and kernel FPU contexts. > > > > I suggest to remove this file at all, since things are not being sorted. > > Okay, let's try NOCTX: https://reviews.freebsd.org/D29921 > > I don't understand how using a full fpu_kern_ctx can *corrupt* anything > though? > It should only be extra overhead? Existing code uses global unsynchronized flag increment to conclude that there is no need to enter FPU. In other words, even ignoring races for updating the counter, if one thread entered FPU, another thread would not enter it and corrupt e.g. usermode context. From owner-dev-commits-src-main@freebsd.org Thu Apr 22 12:23:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 629295F0E50; Thu, 22 Apr 2021 12:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQxR02LN0z3rk8; Thu, 22 Apr 2021 12:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43A1219DC5; Thu, 22 Apr 2021 12:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MCNONU095271; Thu, 22 Apr 2021 12:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MCNOqa095270; Thu, 22 Apr 2021 12:23:24 GMT (envelope-from git) Date: Thu, 22 Apr 2021 12:23:24 GMT Message-Id: <202104221223.13MCNOqa095270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: fc620f9782d1 - main - ocs_fc: Fix memory leak in ocs_scsi_io_alloc() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc620f9782d1fda5a243fd51a93a0fb46bc80f64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 12:23:24 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=fc620f9782d1fda5a243fd51a93a0fb46bc80f64 commit fc620f9782d1fda5a243fd51a93a0fb46bc80f64 Author: Ram Kishore Vegesna AuthorDate: 2021-04-19 15:40:59 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-04-22 12:18:37 +0000 ocs_fc: Fix memory leak in ocs_scsi_io_alloc() PR: 254690 Approved by: mav(mentor) MFC after: 2 weeks --- sys/dev/ocs_fc/ocs_scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/ocs_fc/ocs_scsi.c b/sys/dev/ocs_fc/ocs_scsi.c index c2df898bda4b..b1d98c7c0e3d 100644 --- a/sys/dev/ocs_fc/ocs_scsi.c +++ b/sys/dev/ocs_fc/ocs_scsi.c @@ -201,6 +201,7 @@ ocs_scsi_io_alloc(ocs_node_t *node, ocs_scsi_io_role_e role) if (io->hio != NULL) { ocs_log_err(node->ocs, "assertion failed: io->hio is not NULL\n"); + ocs_io_free(ocs, io); ocs_unlock(&node->active_ios_lock); return NULL; } From owner-dev-commits-src-main@freebsd.org Thu Apr 22 13:20:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D42D65F2449; Thu, 22 Apr 2021 13:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQyhQ5gWPz3v35; Thu, 22 Apr 2021 13:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B58FD1A7AF; Thu, 22 Apr 2021 13:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MDK6hS064858; Thu, 22 Apr 2021 13:20:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MDK6VU064856; Thu, 22 Apr 2021 13:20:06 GMT (envelope-from git) Date: Thu, 22 Apr 2021 13:20:06 GMT Message-Id: <202104221320.13MDK6VU064856@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: 7ea3223c7822 - main - zfs: use vn_seqc_read_notmodify for racing .. lookups 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: 7ea3223c7822d20acfc907683fd0153d623185b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 13:20:06 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7ea3223c7822d20acfc907683fd0153d623185b3 commit 7ea3223c7822d20acfc907683fd0153d623185b3 Author: Mateusz Guzik AuthorDate: 2021-04-22 13:18:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-22 13:18:39 +0000 zfs: use vn_seqc_read_notmodify for racing .. lookups Catching an in-flight unlocked vnode is fine here. Reported by; pho --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index a1e9c359b893..50454cad2468 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -807,7 +807,7 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); - dvp_seqc = vn_seqc_read_any(dvp); + dvp_seqc = vn_seqc_read_notmodify(dvp); *vpp = NULL; From owner-dev-commits-src-main@freebsd.org Thu Apr 22 16:07:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0BC55F7BD3; Thu, 22 Apr 2021 16:07:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FR2P765Fqz4Xml; Thu, 22 Apr 2021 16:07:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C40DA1CF81; Thu, 22 Apr 2021 16:07:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MG77aM087010; Thu, 22 Apr 2021 16:07:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MG77Oe087009; Thu, 22 Apr 2021 16:07:07 GMT (envelope-from git) Date: Thu, 22 Apr 2021 16:07:07 GMT Message-Id: <202104221607.13MG77Oe087009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: 89c3c32647a5 - main - bhyve: Gracefully handle virtio-scsi with no conf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89c3c32647a5099b297af2958e5a939eff0c0ce0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 16:07:07 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=89c3c32647a5099b297af2958e5a939eff0c0ce0 commit 89c3c32647a5099b297af2958e5a939eff0c0ce0 Author: Ryan Moeller AuthorDate: 2021-04-22 16:06:08 +0000 Commit: Ryan Moeller CommitDate: 2021-04-22 16:06:08 +0000 bhyve: Gracefully handle virtio-scsi with no conf Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used by some third party software to probe bhyve for virtio-scsi support. Reviewed by: jhb MFC after: 1 day Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29926 --- usr.sbin/bhyve/pci_virtio_scsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index aed2fe2dbb23..e8124b9b3441 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -662,6 +662,9 @@ pci_vtscsi_legacy_config(nvlist_t *nvl, const char *opts) { char *cp, *devname; + if (opts == NULL) + return (0); + cp = strchr(opts, ','); if (cp == NULL) { set_config_value_node(nvl, "dev", opts); From owner-dev-commits-src-main@freebsd.org Thu Apr 22 17:24:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79E205F991D; Thu, 22 Apr 2021 17:24: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 4FR46T3148z4c4S; Thu, 22 Apr 2021 17:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A1B61DBCE; Thu, 22 Apr 2021 17:24: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 13MHOXtg093141; Thu, 22 Apr 2021 17:24:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MHOXv3093140; Thu, 22 Apr 2021 17:24:33 GMT (envelope-from git) Date: Thu, 22 Apr 2021 17:24:33 GMT Message-Id: <202104221724.13MHOXv3093140@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: 9a5a5c1576b4 - main - pvscsi: Advertise maxio of 256k. 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: 9a5a5c1576b4ce308a97e0bce887261701ae3edc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 17:24:33 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a5a5c1576b4ce308a97e0bce887261701ae3edc commit 9a5a5c1576b4ce308a97e0bce887261701ae3edc Author: Warner Losh AuthorDate: 2021-04-21 18:10:42 +0000 Commit: Warner Losh CommitDate: 2021-04-22 17:23:29 +0000 pvscsi: Advertise maxio of 256k. While the PV SCSI SG list can handle 512k of SG entries, it can only do so for I/O that's aligned to 4k or better. newfs_msdos does unaligned I/O, so triggers too long for host errors in cam when a 512k I/O is attempted. Prefer power of 2 256k to the absolute maximum 508k, though that can be revisited should the latter show to give significant performance improvement. MFC After: 3 days Tested by: darius on discord (508k version of patch) Sponsored by: Netflix --- sys/dev/vmware/pvscsi/pvscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/vmware/pvscsi/pvscsi.c b/sys/dev/vmware/pvscsi/pvscsi.c index 3ca905313897..ad32d2ab4959 100644 --- a/sys/dev/vmware/pvscsi/pvscsi.c +++ b/sys/dev/vmware/pvscsi/pvscsi.c @@ -1423,7 +1423,8 @@ finish_ccb: strlcpy(cpi->sim_vid, "VMware", SIM_IDLEN); strlcpy(cpi->hba_vid, "VMware", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); - cpi->maxio = PVSCSI_MAX_SG_ENTRIES_PER_SEGMENT * PAGE_SIZE; + /* Limit I/O to 256k since we can't do 512k unaligned I/O */ + cpi->maxio = (PVSCSI_MAX_SG_ENTRIES_PER_SEGMENT / 2) * PAGE_SIZE; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_SPC2; cpi->transport = XPORT_SAS; From owner-dev-commits-src-main@freebsd.org Thu Apr 22 17:36:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 934925F9AEB; Thu, 22 Apr 2021 17:36: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 4FR4NT3nMPz4clG; Thu, 22 Apr 2021 17:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74B0B1E199; Thu, 22 Apr 2021 17:36: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 13MHaful006548; Thu, 22 Apr 2021 17:36:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MHafaH006547; Thu, 22 Apr 2021 17:36:41 GMT (envelope-from git) Date: Thu, 22 Apr 2021 17:36:41 GMT Message-Id: <202104221736.13MHafaH006547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?RmVybmFuZG8gQXBlc3RlZ3XDrWE=?= Subject: git: 2e5929a75634 - main - stats.7: Add dwatch(1) to the list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e5929a75634504d388cc04d24e6a558840e18cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 17:36:41 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2e5929a75634504d388cc04d24e6a558840e18cb commit 2e5929a75634504d388cc04d24e6a558840e18cb Author: Fernando Apesteguía AuthorDate: 2021-04-22 13:54:45 +0000 Commit: Fernando Apesteguía CommitDate: 2021-04-22 17:33:12 +0000 stats.7: Add dwatch(1) to the list PR: 255303 Approved by: 0mp (mentor) Differential Revision: https://reviews.freebsd.org/D29924 --- share/man/man7/stats.7 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/man/man7/stats.7 b/share/man/man7/stats.7 index 949e3fd6112b..50d33a53849b 100644 --- a/share/man/man7/stats.7 +++ b/share/man/man7/stats.7 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2020 +.Dd April 22, 2021 .Dt STATS 7 .Os .Sh NAME @@ -46,6 +46,8 @@ are currently included in the base system, with more appearing periodically. Show Bluetooth socket information .It Nm ctlstat CAM Target Layer statistics utility +.It Nm dwatch +watch processes as they trigger a particular DTrace probe .It Nm fstat Identify active files .It Nm gstat @@ -89,6 +91,7 @@ Report ZFS I/O statistics .El .Sh SEE ALSO .Xr btsockstat 1 , +.Xr dwatch 1 , .Xr fstat 1 , .Xr intro 1 , .Xr lockstat 1 , From owner-dev-commits-src-main@freebsd.org Thu Apr 22 17:45:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 522075FA140; Thu, 22 Apr 2021 17:45: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 4FR4Zb1vHgz4dB5; Thu, 22 Apr 2021 17:45:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 342BF1E412; Thu, 22 Apr 2021 17:45: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 13MHjRgn020362; Thu, 22 Apr 2021 17:45:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MHjR7p020361; Thu, 22 Apr 2021 17:45:27 GMT (envelope-from git) Date: Thu, 22 Apr 2021 17:45:27 GMT Message-Id: <202104221745.13MHjR7p020361@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: 2183bfcce46b - main - newvers.sh: better regexp for the FreeBSD_version line 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: 2183bfcce46bf9fe8315de3d7997d28db0a58c18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 17:45:27 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2183bfcce46bf9fe8315de3d7997d28db0a58c18 commit 2183bfcce46bf9fe8315de3d7997d28db0a58c18 Author: Warner Losh AuthorDate: 2021-04-22 16:43:43 +0000 Commit: Warner Losh CommitDate: 2021-04-22 17:45:12 +0000 newvers.sh: better regexp for the FreeBSD_version line Tested with: cirrus-ci https://cirrus-ci.com/build/6012323274948608 Reviewed by: emaste@, rgrimes@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29869 --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 847c01186aeb..495d9c0e862e 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -65,7 +65,7 @@ if [ -z "${SYSDIR}" ]; then SYSDIR=$(dirname $0)/.. fi -RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h}) +RELDATE=$(awk '/^\#define[[:space:]]*__FreeBSD_version/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h}) if [ -r "${SYSDIR}/../COPYRIGHT" ]; then year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' ${SYSDIR}/../COPYRIGHT) From owner-dev-commits-src-main@freebsd.org Thu Apr 22 18:56:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E9A55FC0A4; Thu, 22 Apr 2021 18:56:35 +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 4FR68g3Z2tz4hZx; Thu, 22 Apr 2021 18:56:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C64835816; Thu, 22 Apr 2021 18:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 89c3c32647a5 - main - bhyve: Gracefully handle virtio-scsi with no conf To: Ryan Moeller , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104221607.13MG77Oe087009@gitrepo.freebsd.org> From: John Baldwin Message-ID: <4f92a870-a79f-25f4-66a4-a7c1dee8d549@FreeBSD.org> Date: Thu, 22 Apr 2021 11:56:33 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104221607.13MG77Oe087009@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 18:56:35 -0000 On 4/22/21 9:07 AM, Ryan Moeller wrote: > The branch main has been updated by freqlabs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=89c3c32647a5099b297af2958e5a939eff0c0ce0 > > commit 89c3c32647a5099b297af2958e5a939eff0c0ce0 > Author: Ryan Moeller > AuthorDate: 2021-04-22 16:06:08 +0000 > Commit: Ryan Moeller > CommitDate: 2021-04-22 16:06:08 +0000 > > bhyve: Gracefully handle virtio-scsi with no conf > > Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used > by some third party software to probe bhyve for virtio-scsi support. > > Reviewed by: jhb > MFC after: 1 day No need to MFC this btw, as the conf stuff isn't merged yet. It would have been nice to include a 'Fixes' tag that I could use to try to locate all the various followup fixes for the config changes for when it is eventually merged to 13 however. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Thu Apr 22 19:51:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9187D5FD020; Thu, 22 Apr 2021 19:51:05 +0000 (UTC) (envelope-from debdrup@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FR7MY3pkrz4kN8; Thu, 22 Apr 2021 19:51:05 +0000 (UTC) (envelope-from debdrup@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1619121065; 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=4nepadz+4eg+SyjkpwXPPt5GXg+s88fSQ0G96VaQilQ=; b=Udd8K4RUIG9KUXo88lCi08eaLtiFu9K9jqFosR+T/lnTmiMf1IKaTG2VMYqEVHLdBVndAz cCICe5P6v/N56w7jqDqERhJTQH3h5ZIjCclMihkeeAbtv5Vv/BXeVJ7Bw5cK7AyXWTPfEc kHZ5gR115ePwILDec1r0NstWyTeS35O9XJtr6g43hl/fdRWi2Y/tRdjfHtQzayB9Mlijbh F9XFPCml5ZqDf2KKc0nXgDUl43D7T1Gsd7lWgJOE892rQE06dE2uj73LmooimLh2ILa2nD nJ0f2jq+pOI9GYpx3TSwO8l/UPLKqH9njiZRQq+7lI7DI6rZI9MIXNEYpAoW6Q== Received: by freefall.freebsd.org (Postfix, from userid 1471) id 6E97727E88; Thu, 22 Apr 2021 19:51:05 +0000 (UTC) Date: Thu, 22 Apr 2021 21:51:03 +0200 From: Daniel Ebdrup Jensen To: dev-commits-src-main@freebsd.org, dev-commits-src-all@FreeBSD.org Subject: Re: git: 2e5929a75634 - main - stats.7: Add dwatch(1) to the list Message-ID: <20210422195103.h4uafdpwj7wwb765@nerd-thinkpad.local> Mail-Followup-To: Daniel Ebdrup Jensen , dev-commits-src-main@freebsd.org, dev-commits-src-all@FreeBSD.org References: <202104221736.13MHafaH006547@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jtzcqqublvw5xafj" Content-Disposition: inline In-Reply-To: <202104221736.13MHafaH006547@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1619121065; 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=4nepadz+4eg+SyjkpwXPPt5GXg+s88fSQ0G96VaQilQ=; b=XVtWLSXL5s8AY71HeeSKC20PpLI2ToVkf/aM/ipVHZmFI76mwaNM20sNTy+eSNn+RldteI +vEvucff1jpewNcJODgwfnNV5yzmw1Oxj7MdA2+ZVViHp1+Xy/U93lwVUZ3gwD+ssg/KsE IJ8e6nUpE3QkOfY6E+B7mXmrDNF/SyTS1Dww4E5hiWiIsnPui8eDlzEzasEAM1kvJouLru 8JQ53mrLJ33XpYZ6fwqDYbz47rsQuLXHO5bv5WsH+1iNDi78b97//uiavl9QfYHlOhD+ev LNbhAy4rZsJF2yRJTzEXFTBZdsDQLlHxYQhHdLMzhnI3gZRq5y+1D2fDZTnLzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1619121065; a=rsa-sha256; cv=none; b=gvu8QYbos5yYJk81aj+z8BLo+Vpl+GFIzpgYQUAXSusPoMnhSmV9YkKOQYaIl6WmLZTnzm UWBe0FTA2I9y0O4ZuXJ+ZkqWVkruiREKkhAklEa57nl1TMAqGJftmecK1CJqG8KKFhJ0n0 0HmxrLYjhXEGtR7GFmmzpT+pTqKZBwbySl9XYFqp/TYonVH3QcMeNvq0nAl8Ro6EKIc+B0 Qj2CUFgnIheNfMohtOAwglvPDAh+W5kZmHebmQ55ZcDEMYCr2+hCYgyBOHnrvqwO5tJula quBelhRArSVlGnvBlmpbteWvshquWdfvu9mMIPA2ydyCcM0xTRCFcwMC2V8cEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 19:51:05 -0000 --jtzcqqublvw5xafj Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 22, 2021 at 05:36:41PM +0000, Fernando Apestegu=EDa wrote: >The branch main has been updated by fernape (doc, ports committer): > >URL: https://cgit.FreeBSD.org/src/commit/?id=3D2e5929a75634504d388cc04d24e= 6a558840e18cb > >commit 2e5929a75634504d388cc04d24e6a558840e18cb >Author: Fernando Apestegu=EDa >AuthorDate: 2021-04-22 13:54:45 +0000 >Commit: Fernando Apestegu=EDa >CommitDate: 2021-04-22 17:33:12 +0000 > > stats.7: Add dwatch(1) to the list > > PR: 255303 > Approved by: 0mp (mentor) > Differential Revision: https://reviews.freebsd.org/D29924 >--- > share/man/man7/stats.7 | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > Hi Fernando, The original idea with stats(7) was to list all of the commands ending in -stat and which can be used for basic understanding of what the system is doing at any given time. In addition to this, dwatch(1) doesn't even work without loading the dtrace kernel module (as is expected, given the name of the command), but it's also intended for pretty deep inspection (the (in)famous example being that root can snoop on users passwords). I'm not saying it should be reverted, but maybe there's a better manual page for this that it could be added to instead? Yours hopefully, Daniel Ebdrup Jensen --jtzcqqublvw5xafj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEDonNJPbg/JLIMoS6Ps5hSHzN87oFAmCB06dfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDBF ODlDRDI0RjZFMEZDOTJDODMyODRCQTNFQ0U2MTQ4N0NDREYzQkEACgkQPs5hSHzN 87pQgQgAmZwSoGSY2bOcCq6iXfKTA4lGJIBkTqsYI1b7D8CZaMTK/YQIu00w0TWU ipWsY1ofS5Em4NngWQH9EukpU7idyml3MEOaL5WkkBdfTJ0ZwtCv5miPPaVnGDyn bA6QEvrQyTlbKb+GIXerBIUVavqRMLn7rSDGCo7FhDOJzwbxCyo9DBpHjxa/lX7h epeQ5Wr9Cv3k8jKaEVvQSnWuje5ZqNlLKhjhcDgOSAFxIv7I1+vOmYglOy8niJUB BymIC4FV1r64o8VotEYBGtiPdolGayoN6iF2Har7UmwBivYmHB56ZSzcdq85r8JD ZhbSR1vyHFN70lXfmWIcTTiW+HIMtg== =dNjl -----END PGP SIGNATURE----- --jtzcqqublvw5xafj-- From owner-dev-commits-src-main@freebsd.org Thu Apr 22 20:59:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58D9E5FE98F; Thu, 22 Apr 2021 20:59:33 +0000 (UTC) (envelope-from nwhitehorn@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 4FR8tY224Cz4n7Q; Thu, 22 Apr 2021 20:59:33 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (unknown [IPv6:2601:405:4a00:acd:3dd7:f96a:93a3:9836]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: nwhitehorn/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 04EA867BC; Thu, 22 Apr 2021 20:59:32 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Subject: Re: git: b31fbebeb3d5 - main - Relax rtsock message restrictions. To: "Alexander V. Chernikov" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104202135.13KLZDPM097608@gitrepo.freebsd.org> From: Nathan Whitehorn Message-ID: <8151c4a1-776e-ed67-6542-04dfbc945e52@freebsd.org> Date: Thu, 22 Apr 2021 16:59:31 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <202104202135.13KLZDPM097608@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 20:59:33 -0000 Thanks! Is this an erratum candidate for 13.0? I was pretty surprised when a production machine stopped routing after an upgrade, and I can't be the only one. -Nathan On 4/20/21 5:35 PM, Alexander V. Chernikov wrote: > The branch main has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b31fbebeb3d59af359a3417cddfbcf666b2c56c9 > > commit b31fbebeb3d59af359a3417cddfbcf666b2c56c9 > Author: Alexander V. Chernikov > AuthorDate: 2021-04-19 20:49:18 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-04-20 21:34:19 +0000 > > Relax rtsock message restrictions. > > Address multiple issues with strict rtsock message validation. > > D28668 "normalisation" approach was based on the assumption that > we always have at least "standard" sockaddr len. > It turned out to be false - certain older applications like quagga > or routed abuse sin[6]_len field and set it to the offset to the > first fully-zero bit in the mask. It is impossible to normalise > such sockaddrs without reallocation. > > With that in mind, change the approach to use a distinct memory > buffer for the altered sockaddrs. This allows supporting the older > software while maintaining the guarantee on the "standard" sockaddrs. > > PR: 255273,255089 > Differential Revision: https://reviews.freebsd.org/D29826 > MFC after: 3 days > --- > sys/net/rtsock.c | 271 ++++++++++++++++++++++++++++++++++++------------------- > 1 file changed, 177 insertions(+), 94 deletions(-) > > diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c > index 5194a2a15c1e..b7a7e5170c74 100644 > --- a/sys/net/rtsock.c > +++ b/sys/net/rtsock.c > @@ -126,6 +126,13 @@ struct ifa_msghdrl32 { > > #endif /* COMPAT_FREEBSD32 */ > > +struct linear_buffer { > + char *base; /* Base allocated memory pointer */ > + uint32_t offset; /* Currently used offset */ > + uint32_t size; /* Total buffer size */ > +}; > +#define SCRATCH_BUFFER_SIZE 1024 > + > #define RTS_PID_PRINTF(_fmt, ...) \ > printf("rtsock:%s(): PID %d: " _fmt "\n", __func__, curproc->p_pid, ## __VA_ARGS__) > > @@ -177,7 +184,7 @@ static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, > struct walkarg *w, int *plen); > static int rt_xaddrs(caddr_t cp, caddr_t cplim, > struct rt_addrinfo *rtinfo); > -static int cleanup_xaddrs(struct rt_addrinfo *info); > +static int cleanup_xaddrs(struct rt_addrinfo *info, struct linear_buffer *lb); > static int sysctl_dumpentry(struct rtentry *rt, void *vw); > static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, > uint32_t weight, struct walkarg *w); > @@ -621,7 +628,8 @@ fill_blackholeinfo(struct rt_addrinfo *info, union sockaddr_union *saun) > * Returns 0 on success. > */ > static int > -fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo *info) > +fill_addrinfo(struct rt_msghdr *rtm, int len, struct linear_buffer *lb, u_int fibnum, > + struct rt_addrinfo *info) > { > int error; > sa_family_t saf; > @@ -641,7 +649,7 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * > return (EINVAL); > > info->rti_flags = rtm->rtm_flags; > - error = cleanup_xaddrs(info); > + error = cleanup_xaddrs(info, lb); > if (error != 0) > return (error); > saf = info->rti_info[RTAX_DST]->sa_family; > @@ -878,6 +886,45 @@ export_rtaddrs(const struct rtentry *rt, struct sockaddr *dst, > #endif > } > > +static int > +update_rtm_from_info(struct rt_addrinfo *info, struct rt_msghdr **prtm, > + int alloc_len) > +{ > + struct rt_msghdr *rtm, *orig_rtm = NULL; > + struct walkarg w; > + int len; > + > + rtm = *prtm; > + /* Check if we need to realloc storage */ > + rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len); > + if (len > alloc_len) { > + struct rt_msghdr *tmp_rtm; > + > + tmp_rtm = malloc(len, M_TEMP, M_NOWAIT); > + if (tmp_rtm == NULL) > + return (ENOBUFS); > + bcopy(rtm, tmp_rtm, rtm->rtm_msglen); > + orig_rtm = rtm; > + rtm = tmp_rtm; > + alloc_len = len; > + > + /* > + * Delay freeing original rtm as info contains > + * data referencing it. > + */ > + } > + > + w.w_tmem = (caddr_t)rtm; > + w.w_tmemsize = alloc_len; > + rtsock_msg_buffer(rtm->rtm_type, info, &w, &len); > + rtm->rtm_addrs = info->rti_addrs; > + > + if (orig_rtm != NULL) > + free(orig_rtm, M_TEMP); > + *prtm = rtm; > + return (0); > +} > + > > /* > * Update sockaddrs, flags, etc in @prtm based on @rc data. > @@ -891,11 +938,10 @@ static int > update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, > int alloc_len, struct rib_cmd_info *rc, struct nhop_object *nh) > { > - struct walkarg w; > union sockaddr_union saun; > - struct rt_msghdr *rtm, *orig_rtm = NULL; > + struct rt_msghdr *rtm; > struct ifnet *ifp; > - int error, len; > + int error; > > rtm = *prtm; > union sockaddr_union sa_dst, sa_mask; > @@ -927,28 +973,8 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, > } else if (ifp != NULL) > rtm->rtm_index = ifp->if_index; > > - /* Check if we need to realloc storage */ > - rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len); > - if (len > alloc_len) { > - struct rt_msghdr *tmp_rtm; > - > - tmp_rtm = malloc(len, M_TEMP, M_NOWAIT); > - if (tmp_rtm == NULL) > - return (ENOBUFS); > - bcopy(rtm, tmp_rtm, rtm->rtm_msglen); > - orig_rtm = rtm; > - rtm = tmp_rtm; > - alloc_len = len; > - > - /* > - * Delay freeing original rtm as info contains > - * data referencing it. > - */ > - } > - > - w.w_tmem = (caddr_t)rtm; > - w.w_tmemsize = alloc_len; > - rtsock_msg_buffer(rtm->rtm_type, info, &w, &len); > + if ((error = update_rtm_from_info(info, prtm, alloc_len)) != 0) > + return (error); > > rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh); > if (rtm->rtm_flags & RTF_GWFLAG_COMPAT) > @@ -956,11 +982,6 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, > (rtm->rtm_flags & ~RTF_GWFLAG_COMPAT); > rt_getmetrics(rc->rc_rt, nh, &rtm->rtm_rmx); > rtm->rtm_rmx.rmx_weight = rc->rc_nh_weight; > - rtm->rtm_addrs = info->rti_addrs; > - > - if (orig_rtm != NULL) > - free(orig_rtm, M_TEMP); > - *prtm = rtm; > > return (0); > } > @@ -985,6 +1006,17 @@ save_add_notification(struct rib_cmd_info *rc, void *_cbdata) > } > #endif > > +static struct sockaddr * > +alloc_sockaddr_aligned(struct linear_buffer *lb, int len) > +{ > + len |= (sizeof(uint64_t) - 1); > + if (lb->offset + len > lb->size) > + return (NULL); > + struct sockaddr *sa = (struct sockaddr *)(lb->base + lb->offset); > + lb->offset += len; > + return (sa); > +} > + > /*ARGSUSED*/ > static int > route_output(struct mbuf *m, struct socket *so, ...) > @@ -1022,12 +1054,17 @@ route_output(struct mbuf *m, struct socket *so, ...) > * buffer aligned on 1k boundaty. > */ > alloc_len = roundup2(len, 1024); > - if ((rtm = malloc(alloc_len, M_TEMP, M_NOWAIT)) == NULL) > + int total_len = alloc_len + SCRATCH_BUFFER_SIZE; > + if ((rtm = malloc(total_len, M_TEMP, M_NOWAIT)) == NULL) > senderr(ENOBUFS); > > m_copydata(m, 0, len, (caddr_t)rtm); > bzero(&info, sizeof(info)); > nh = NULL; > + struct linear_buffer lb = { > + .base = (char *)rtm + alloc_len, > + .size = SCRATCH_BUFFER_SIZE, > + }; > > if (rtm->rtm_version != RTM_VERSION) { > /* Do not touch message since format is unknown */ > @@ -1042,19 +1079,19 @@ route_output(struct mbuf *m, struct socket *so, ...) > * caller PID and error value. > */ > > - if ((error = fill_addrinfo(rtm, len, fibnum, &info)) != 0) { > + if ((error = fill_addrinfo(rtm, len, &lb, fibnum, &info)) != 0) { > senderr(error); > } > + /* fill_addringo() embeds scope into IPv6 addresses */ > +#ifdef INET6 > + rti_need_deembed = 1; > +#endif > > saf = info.rti_info[RTAX_DST]->sa_family; > > /* support for new ARP code */ > if (rtm->rtm_flags & RTF_LLDATA) { > error = lla_rt_output(rtm, &info); > -#ifdef INET6 > - if (error == 0) > - rti_need_deembed = 1; > -#endif > goto flush; > } > > @@ -1067,7 +1104,6 @@ route_output(struct mbuf *m, struct socket *so, ...) > error = EINVAL; > if (error != 0) > senderr(error); > - /* TODO: rebuild rtm from scratch */ > } > > switch (rtm->rtm_type) { > @@ -1079,9 +1115,6 @@ route_output(struct mbuf *m, struct socket *so, ...) > } > error = rib_action(fibnum, rtm->rtm_type, &info, &rc); > if (error == 0) { > -#ifdef INET6 > - rti_need_deembed = 1; > -#endif > #ifdef ROUTE_MPATH > if (NH_IS_NHGRP(rc.rc_nh_new) || > (rc.rc_nh_old && NH_IS_NHGRP(rc.rc_nh_old))) { > @@ -1110,12 +1143,7 @@ route_output(struct mbuf *m, struct socket *so, ...) > } > #endif > nh = rc.rc_nh_old; > - goto report; > } > -#ifdef INET6 > - /* rt_msg2() will not be used when RTM_DELETE fails. */ > - rti_need_deembed = 1; > -#endif > break; > > case RTM_GET: > @@ -1124,13 +1152,18 @@ route_output(struct mbuf *m, struct socket *so, ...) > senderr(error); > nh = rc.rc_nh_new; > > -report: > if (!can_export_rte(curthread->td_ucred, > info.rti_info[RTAX_NETMASK] == NULL, > info.rti_info[RTAX_DST])) { > senderr(ESRCH); > } > + break; > > + default: > + senderr(EOPNOTSUPP); > + } > + > + if (error == 0) { > error = update_rtm_from_rc(&info, &rtm, alloc_len, &rc, nh); > /* > * Note that some sockaddr pointers may have changed to > @@ -1147,12 +1180,6 @@ report: > #ifdef INET6 > rti_need_deembed = 0; > #endif > - if (error != 0) > - senderr(error); > - break; > - > - default: > - senderr(EOPNOTSUPP); > } > > flush: > @@ -1174,6 +1201,10 @@ flush: > bcopy(sin6, info.rti_info[i], > sizeof(*sin6)); > } > + if (update_rtm_from_info(&info, &rtm, alloc_len) != 0) { > + if (error != 0) > + error = ENOBUFS; > + } > } > } > #endif > @@ -1350,9 +1381,10 @@ cleanup_xaddrs_lladdr(struct rt_addrinfo *info) > } > > static int > -cleanup_xaddrs_gateway(struct rt_addrinfo *info) > +cleanup_xaddrs_gateway(struct rt_addrinfo *info, struct linear_buffer *lb) > { > struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; > + struct sockaddr *sa; > > if (info->rti_flags & RTF_LLDATA) > return (cleanup_xaddrs_lladdr(info)); > @@ -1362,11 +1394,17 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) > case AF_INET: > { > struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; > - if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { > + > + /* Ensure reads do not go beyoud SA boundary */ > + if (SA_SIZE(gw) < offsetof(struct sockaddr_in, sin_zero)) { > RTS_PID_PRINTF("gateway sin_len too small: %d", gw->sa_len); > return (EINVAL); > } > - fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); > + sa = alloc_sockaddr_aligned(lb, sizeof(struct sockaddr_in)); > + if (sa == NULL) > + return (ENOBUFS); > + fill_sockaddr_inet((struct sockaddr_in *)sa, gw_sin->sin_addr); > + info->rti_info[RTAX_GATEWAY] = sa; > } > break; > #endif > @@ -1392,13 +1430,17 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) > RTS_PID_PRINTF("gateway sdl_len too small: %d", gw_sdl->sdl_len); > return (EINVAL); > } > + sa = alloc_sockaddr_aligned(lb, sizeof(struct sockaddr_dl_short)); > + if (sa == NULL) > + return (ENOBUFS); > > const struct sockaddr_dl_short sdl = { > .sdl_family = AF_LINK, > - .sdl_len = sdl_min_len, > + .sdl_len = sizeof(struct sockaddr_dl_short), > .sdl_index = gw_sdl->sdl_index, > }; > - memcpy(gw_sdl, &sdl, sdl_min_len); > + *((struct sockaddr_dl_short *)sa) = sdl; > + info->rti_info[RTAX_GATEWAY] = sa; > break; > } > } > @@ -1416,39 +1458,57 @@ remove_netmask(struct rt_addrinfo *info) > > #ifdef INET > static int > -cleanup_xaddrs_inet(struct rt_addrinfo *info) > +cleanup_xaddrs_inet(struct rt_addrinfo *info, struct linear_buffer *lb) > { > struct sockaddr_in *dst_sa, *mask_sa; > + const int sa_len = sizeof(struct sockaddr_in); > + struct in_addr dst, mask; > > /* Check & fixup dst/netmask combination first */ > dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; > mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; > > - struct in_addr mask = { > - .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, > - }; > - struct in_addr dst = { > - .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) > - }; > - > - if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { > - printf("dst sin_len too small\n"); > + /* Ensure reads do not go beyound the buffer size */ > + if (SA_SIZE(dst_sa) < offsetof(struct sockaddr_in, sin_zero)) > return (EINVAL); > - } > - if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { > - RTS_PID_PRINTF("prefix mask sin_len too small: %d", mask_sa->sin_len); > - return (EINVAL); > - } > + > + if ((mask_sa != NULL) && mask_sa->sin_len < sizeof(struct sockaddr_in)) { > + /* > + * Some older routing software encode mask length into the > + * sin_len, thus resulting in "truncated" sockaddr. > + */ > + int len = mask_sa->sin_len - offsetof(struct sockaddr_in, sin_addr); > + if (len >= 0) { > + mask.s_addr = 0; > + if (len > sizeof(struct in_addr)) > + len = sizeof(struct in_addr); > + memcpy(&mask, &mask_sa->sin_addr, len); > + } else { > + RTS_PID_PRINTF("prefix mask sin_len too small: %d", mask_sa->sin_len); > + return (EINVAL); > + } > + } else > + mask.s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST; > + > + dst.s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)); > + > + /* Construct new "clean" dst/mask sockaddresses */ > + if ((dst_sa = (struct sockaddr_in *)alloc_sockaddr_aligned(lb, sa_len)) == NULL) > + return (ENOBUFS); > fill_sockaddr_inet(dst_sa, dst); > + info->rti_info[RTAX_DST] = (struct sockaddr *)dst_sa; > > - if (mask.s_addr != INADDR_BROADCAST) > + if (mask.s_addr != INADDR_BROADCAST) { > + if ((mask_sa = (struct sockaddr_in *)alloc_sockaddr_aligned(lb, sa_len)) == NULL) > + return (ENOBUFS); > fill_sockaddr_inet(mask_sa, mask); > - else > + info->rti_info[RTAX_NETMASK] = (struct sockaddr *)mask_sa; > + } else > remove_netmask(info); > > /* Check gateway */ > if (info->rti_info[RTAX_GATEWAY] != NULL) > - return (cleanup_xaddrs_gateway(info)); > + return (cleanup_xaddrs_gateway(info, lb)); > > return (0); > } > @@ -1456,43 +1516,66 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) > > #ifdef INET6 > static int > -cleanup_xaddrs_inet6(struct rt_addrinfo *info) > +cleanup_xaddrs_inet6(struct rt_addrinfo *info, struct linear_buffer *lb) > { > + struct sockaddr *sa; > struct sockaddr_in6 *dst_sa, *mask_sa; > - struct in6_addr mask; > + struct in6_addr mask, *dst; > + const int sa_len = sizeof(struct sockaddr_in6); > > /* Check & fixup dst/netmask combination first */ > dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; > mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; > > - mask = mask_sa ? mask_sa->sin6_addr : in6mask128; > - IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); > - > if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { > RTS_PID_PRINTF("prefix dst sin6_len too small: %d", dst_sa->sin6_len); > return (EINVAL); > } > + > if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { > - RTS_PID_PRINTF("rtsock: prefix mask sin6_len too small: %d", mask_sa->sin6_len); > - return (EINVAL); > - } > - fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); > + /* > + * Some older routing software encode mask length into the > + * sin6_len, thus resulting in "truncated" sockaddr. > + */ > + int len = mask_sa->sin6_len - offsetof(struct sockaddr_in6, sin6_addr); > + if (len >= 0) { > + bzero(&mask, sizeof(mask)); > + if (len > sizeof(struct in6_addr)) > + len = sizeof(struct in6_addr); > + memcpy(&mask, &mask_sa->sin6_addr, len); > + } else { > + RTS_PID_PRINTF("rtsock: prefix mask sin6_len too small: %d", mask_sa->sin6_len); > + return (EINVAL); > + } > + } else > + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; > > - if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) > - fill_sockaddr_inet6(mask_sa, &mask, 0); > - else > + dst = &dst_sa->sin6_addr; > + IN6_MASK_ADDR(dst, &mask); > + > + if ((sa = alloc_sockaddr_aligned(lb, sa_len)) == NULL) > + return (ENOBUFS); > + fill_sockaddr_inet6((struct sockaddr_in6 *)sa, dst, 0); > + info->rti_info[RTAX_DST] = sa; > + > + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) { > + if ((sa = alloc_sockaddr_aligned(lb, sa_len)) == NULL) > + return (ENOBUFS); > + fill_sockaddr_inet6((struct sockaddr_in6 *)sa, &mask, 0); > + info->rti_info[RTAX_NETMASK] = sa; > + } else > remove_netmask(info); > > /* Check gateway */ > if (info->rti_info[RTAX_GATEWAY] != NULL) > - return (cleanup_xaddrs_gateway(info)); > + return (cleanup_xaddrs_gateway(info, lb)); > > return (0); > } > #endif > > static int > -cleanup_xaddrs(struct rt_addrinfo *info) > +cleanup_xaddrs(struct rt_addrinfo *info, struct linear_buffer *lb) > { > int error = EAFNOSUPPORT; > > @@ -1511,12 +1594,12 @@ cleanup_xaddrs(struct rt_addrinfo *info) > switch (info->rti_info[RTAX_DST]->sa_family) { > #ifdef INET > case AF_INET: > - error = cleanup_xaddrs_inet(info); > + error = cleanup_xaddrs_inet(info, lb); > break; > #endif > #ifdef INET6 > case AF_INET6: > - error = cleanup_xaddrs_inet6(info); > + error = cleanup_xaddrs_inet6(info, lb); > break; > #endif > } > From owner-dev-commits-src-main@freebsd.org Thu Apr 22 22:07:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79CB3621219; Thu, 22 Apr 2021 22:07: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 4FRBPK31HFz4rbZ; Thu, 22 Apr 2021 22:07:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5613121BD8; Thu, 22 Apr 2021 22:07: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 13MM7n1L064866; Thu, 22 Apr 2021 22:07:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MM7n48064865; Thu, 22 Apr 2021 22:07:49 GMT (envelope-from git) Date: Thu, 22 Apr 2021 22:07:49 GMT Message-Id: <202104222207.13MM7n48064865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 557c4521bbb2 - main - cxgbe/t4_tom: Implement tod_pmtu_update. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 557c4521bbb2517bd0552a15cb9429e524c3c0fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 22:07:49 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=557c4521bbb2517bd0552a15cb9429e524c3c0fd commit 557c4521bbb2517bd0552a15cb9429e524c3c0fd Author: Navdeep Parhar AuthorDate: 2021-04-13 23:31:08 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-22 21:48:57 +0000 cxgbe/t4_tom: Implement tod_pmtu_update. tod_pmtu_update was added to the kernel in 01d74fe1ffc. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/offload.h | 1 + sys/dev/cxgbe/t4_main.c | 6 ++ sys/dev/cxgbe/tom/t4_tom.c | 161 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h index e264882fb5b4..7efbd5f81f34 100644 --- a/sys/dev/cxgbe/offload.h +++ b/sys/dev/cxgbe/offload.h @@ -232,6 +232,7 @@ struct tom_tunables { int tx_zcopy; int cop_managed_offloading; int autorcvbuf_inc; + int update_hc_on_pmtu_change; }; /* iWARP driver tunables */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index ce439b94aa6c..3066d133e437 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -6844,6 +6844,12 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tt.autorcvbuf_inc, 0, "autorcvbuf increment"); + sc->tt.update_hc_on_pmtu_change = 1; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "update_hc_on_pmtu_change", CTLFLAG_RW, + &sc->tt.update_hc_on_pmtu_change, 0, + "Update hostcache entry if the PMTU changes"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timer_tick", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_tp_tick, "A", "TP timer tick (us)"); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 6a4b5e8f261e..173357404ebe 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #define TCPSTATES #include +#include #include #include #include @@ -841,6 +842,165 @@ t4_alloc_tls_session(struct toedev *tod, struct tcpcb *tp, } #endif +/* SET_TCB_FIELD sent as a ULP command looks like this */ +#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ + sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) + +static void * +mk_set_tcb_field_ulp(struct ulp_txpkt *ulpmc, uint64_t word, uint64_t mask, + uint64_t val, uint32_t tid) +{ + struct ulptx_idata *ulpsc; + struct cpl_set_tcb_field_core *req; + + ulpmc->cmd_dest = htonl(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DEST(0)); + ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); + + ulpsc = (struct ulptx_idata *)(ulpmc + 1); + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); + ulpsc->len = htobe32(sizeof(*req)); + + req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); + OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); + req->reply_ctrl = htobe16(V_NO_REPLY(1)); + req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); + req->mask = htobe64(mask); + req->val = htobe64(val); + + ulpsc = (struct ulptx_idata *)(req + 1); + if (LEN__SET_TCB_FIELD_ULP % 16) { + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); + ulpsc->len = htobe32(0); + return (ulpsc + 1); + } + return (ulpsc); +} + +static void +send_mss_flowc_wr(struct adapter *sc, struct toepcb *toep) +{ + struct wrq_cookie cookie; + struct fw_flowc_wr *flowc; + struct ofld_tx_sdesc *txsd; + const int flowclen = sizeof(*flowc) + sizeof(struct fw_flowc_mnemval); + const int flowclen16 = howmany(flowclen, 16); + + if (toep->tx_credits < flowclen16 || toep->txsd_avail == 0) { + CH_ERR(sc, "%s: tid %u out of tx credits (%d, %d).\n", __func__, + toep->tid, toep->tx_credits, toep->txsd_avail); + return; + } + + flowc = start_wrq_wr(&toep->ofld_txq->wrq, flowclen16, &cookie); + if (__predict_false(flowc == NULL)) { + CH_ERR(sc, "ENOMEM in %s for tid %u.\n", __func__, toep->tid); + return; + } + flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | + V_FW_FLOWC_WR_NPARAMS(1)); + flowc->flowid_len16 = htonl(V_FW_WR_LEN16(flowclen16) | + V_FW_WR_FLOWID(toep->tid)); + flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_MSS; + flowc->mnemval[0].val = htobe32(toep->params.emss); + + txsd = &toep->txsd[toep->txsd_pidx]; + txsd->tx_credits = flowclen16; + txsd->plen = 0; + toep->tx_credits -= txsd->tx_credits; + if (__predict_false(++toep->txsd_pidx == toep->txsd_total)) + toep->txsd_pidx = 0; + toep->txsd_avail--; + commit_wrq_wr(&toep->ofld_txq->wrq, flowc, &cookie); +} + +static void +t4_pmtu_update(struct toedev *tod, struct tcpcb *tp, tcp_seq seq, int mtu) +{ + struct work_request_hdr *wrh; + struct ulp_txpkt *ulpmc; + int idx, len; + struct wrq_cookie cookie; + struct inpcb *inp = tp->t_inpcb; + struct toepcb *toep = tp->t_toe; + struct adapter *sc = td_adapter(toep->td); + unsigned short *mtus = &sc->params.mtus[0]; + + INP_WLOCK_ASSERT(inp); + MPASS(mtu > 0); /* kernel is supposed to provide something usable. */ + + /* tp->snd_una and snd_max are in host byte order too. */ + seq = be32toh(seq); + + CTR6(KTR_CXGBE, "%s: tid %d, seq 0x%08x, mtu %u, mtu_idx %u (%d)", + __func__, toep->tid, seq, mtu, toep->params.mtu_idx, + mtus[toep->params.mtu_idx]); + + if (ulp_mode(toep) == ULP_MODE_NONE && /* XXX: Read TCB otherwise? */ + (SEQ_LT(seq, tp->snd_una) || SEQ_GEQ(seq, tp->snd_max))) { + CTR5(KTR_CXGBE, + "%s: tid %d, seq 0x%08x not in range [0x%08x, 0x%08x).", + __func__, toep->tid, seq, tp->snd_una, tp->snd_max); + return; + } + + /* Find the best mtu_idx for the suggested MTU. */ + for (idx = 0; idx < NMTUS - 1 && mtus[idx + 1] <= mtu; idx++) + continue; + if (idx >= toep->params.mtu_idx) + return; /* Never increase the PMTU (just like the kernel). */ + + /* + * We'll send a compound work request with 2 SET_TCB_FIELDs -- the first + * one updates the mtu_idx and the second one triggers a retransmit. + */ + len = sizeof(*wrh) + 2 * roundup2(LEN__SET_TCB_FIELD_ULP, 16); + wrh = start_wrq_wr(toep->ctrlq, howmany(len, 16), &cookie); + if (wrh == NULL) { + CH_ERR(sc, "failed to change mtu_idx of tid %d (%u -> %u).\n", + toep->tid, toep->params.mtu_idx, idx); + return; + } + INIT_ULPTX_WRH(wrh, len, 1, 0); /* atomic */ + ulpmc = (struct ulp_txpkt *)(wrh + 1); + ulpmc = mk_set_tcb_field_ulp(ulpmc, W_TCB_T_MAXSEG, + V_TCB_T_MAXSEG(M_TCB_T_MAXSEG), V_TCB_T_MAXSEG(idx), toep->tid); + ulpmc = mk_set_tcb_field_ulp(ulpmc, W_TCB_TIMESTAMP, + V_TCB_TIMESTAMP(0x7FFFFULL << 11), 0, toep->tid); + commit_wrq_wr(toep->ctrlq, wrh, &cookie); + + /* Update the software toepcb and tcpcb. */ + toep->params.mtu_idx = idx; + tp->t_maxseg = mtus[toep->params.mtu_idx]; + if (inp->inp_inc.inc_flags & INC_ISIPV6) + tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + else + tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr); + toep->params.emss = tp->t_maxseg; + if (tp->t_flags & TF_RCVD_TSTMP) + toep->params.emss -= TCPOLEN_TSTAMP_APPA; + + /* Update the firmware flowc. */ + send_mss_flowc_wr(sc, toep); + + /* Update the MTU in the kernel's hostcache. */ + if (sc->tt.update_hc_on_pmtu_change != 0) { + struct in_conninfo inc = {0}; + + inc.inc_fibnum = inp->inp_inc.inc_fibnum; + if (inp->inp_inc.inc_flags & INC_ISIPV6) { + inc.inc_flags |= INC_ISIPV6; + inc.inc6_faddr = inp->inp_inc.inc6_faddr; + } else { + inc.inc_faddr = inp->inp_inc.inc_faddr; + } + tcp_hc_updatemtu(&inc, mtu); + } + + CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u", + __func__, toep->tid, toep->params.mtu_idx, + mtus[toep->params.mtu_idx], tp->t_maxseg, toep->params.emss); +} + /* * The TOE driver will not receive any more CPLs for the tid associated with the * toepcb; release the hold on the inpcb. @@ -1754,6 +1914,7 @@ t4_tom_activate(struct adapter *sc) #ifdef KERN_TLS tod->tod_alloc_tls_session = t4_alloc_tls_session; #endif + tod->tod_pmtu_update = t4_pmtu_update; for_each_port(sc, i) { for_each_vi(sc->port[i], v, vi) { From owner-dev-commits-src-main@freebsd.org Thu Apr 22 22:14:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DADB36210C2; Thu, 22 Apr 2021 22:14: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 4FRBXv5rwsz4rRh; Thu, 22 Apr 2021 22:14:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBBBA21F06; Thu, 22 Apr 2021 22:14: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 13MMENNf078123; Thu, 22 Apr 2021 22:14:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MMENsI078122; Thu, 22 Apr 2021 22:14:23 GMT (envelope-from git) Date: Thu, 22 Apr 2021 22:14:23 GMT Message-Id: <202104222214.13MMENsI078122@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 55eb41bb1fb6 - main - hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55eb41bb1fb69429330ea415fb463735ae08da64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 22:14:23 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=55eb41bb1fb69429330ea415fb463735ae08da64 commit 55eb41bb1fb69429330ea415fb463735ae08da64 Author: Vladimir Kondratyev AuthorDate: 2021-04-22 22:13:25 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-22 22:13:25 +0000 hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled. Reported by: olivier MFC with: e4643aa4c4ff --- sys/dev/hyperv/input/hv_kbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/hyperv/input/hv_kbd.c b/sys/dev/hyperv/input/hv_kbd.c index 52ce621b2a89..53aacda7fbcb 100644 --- a/sys/dev/hyperv/input/hv_kbd.c +++ b/sys/dev/hyperv/input/hv_kbd.c @@ -269,9 +269,8 @@ hvkbd_read_char_locked(keyboard_t *kbd, int wait) uint32_t action; keystroke ks; hv_kbd_sc *sc = kbd->kb_data; -#ifdef EVDEV_SUPPORT int keycode; -#endif + HVKBD_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd) || !hv_kbd_prod_is_ready(sc)) From owner-dev-commits-src-main@freebsd.org Thu Apr 22 22:31:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E66EE62190E; Thu, 22 Apr 2021 22:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRBwj66zDz4sJL; Thu, 22 Apr 2021 22:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C50E021CF9; Thu, 22 Apr 2021 22:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MMVXJS002483; Thu, 22 Apr 2021 22:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MMVXEd002482; Thu, 22 Apr 2021 22:31:33 GMT (envelope-from git) Date: Thu, 22 Apr 2021 22:31:33 GMT Message-Id: <202104222231.13MMVXEd002482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 8f1bc78ef79b - main - cxgbe(4): make the logging helpers a little more robust. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f1bc78ef79bc13d88d15cdc5b1bf2f7361ded6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 22:31:34 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=8f1bc78ef79bc13d88d15cdc5b1bf2f7361ded6d commit 8f1bc78ef79bc13d88d15cdc5b1bf2f7361ded6d Author: Navdeep Parhar AuthorDate: 2021-04-22 22:28:43 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-22 22:28:43 +0000 cxgbe(4): make the logging helpers a little more robust. MFC after: 3 days Sponsored by: Chelsio Communications --- sys/dev/cxgbe/osdep.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/osdep.h b/sys/dev/cxgbe/osdep.h index 95c93d83cff8..3f41ccaf3d2c 100644 --- a/sys/dev/cxgbe/osdep.h +++ b/sys/dev/cxgbe/osdep.h @@ -43,13 +43,13 @@ #include #define CH_ERR(adap, fmt, ...) log(LOG_ERR, "%s: " fmt, \ - device_get_nameunit(adap->dev), ##__VA_ARGS__) + device_get_nameunit((adap)->dev), ##__VA_ARGS__) #define CH_WARN(adap, fmt, ...) log(LOG_WARNING, "%s: " fmt, \ - device_get_nameunit(adap->dev), ##__VA_ARGS__) + device_get_nameunit((adap)->dev), ##__VA_ARGS__) #define CH_ALERT(adap, fmt, ...) log(LOG_ALERT, "%s: " fmt, \ - device_get_nameunit(adap->dev), ##__VA_ARGS__) + device_get_nameunit((adap)->dev), ##__VA_ARGS__) #define CH_WARN_RATELIMIT(adap, fmt, ...) log(LOG_WARNING, "%s: " fmt, \ - device_get_nameunit(adap->dev), ##__VA_ARGS__) + device_get_nameunit((adap)->dev), ##__VA_ARGS__) #ifndef LINUX_TYPES_DEFINED typedef int8_t s8; From owner-dev-commits-src-main@freebsd.org Thu Apr 22 22:40:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A0A162175D; Thu, 22 Apr 2021 22:40: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 4FRC7L1h2hz4sDx; Thu, 22 Apr 2021 22:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D16322438; Thu, 22 Apr 2021 22:40: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 13MMekO1013076; Thu, 22 Apr 2021 22:40:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MMekAe013075; Thu, 22 Apr 2021 22:40:46 GMT (envelope-from git) Date: Thu, 22 Apr 2021 22:40:46 GMT Message-Id: <202104222240.13MMekAe013075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: dc77e7929644 - main - cxgbe(4): Fix minor nit in the display of MPS TCAM entries. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc77e7929644b87c0aa3f8f5e8d57fd10f49df54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 22:40:46 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=dc77e7929644b87c0aa3f8f5e8d57fd10f49df54 commit dc77e7929644b87c0aa3f8f5e8d57fd10f49df54 Author: Navdeep Parhar AuthorDate: 2021-04-22 22:36:51 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-22 22:36:51 +0000 cxgbe(4): Fix minor nit in the display of MPS TCAM entries. MFC after: 3 days --- sys/dev/cxgbe/t4_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 3066d133e437..07fd43a06edc 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -9147,7 +9147,7 @@ sysctl_mps_tcam_t6(SYSCTL_HANDLER_ARGS) if (lookup_type && lookup_type != M_DATALKPTYPE) { sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x " "%012jx %06x %06x - - %3c" - " 'I' %4x %3c %#x%4u%4d", i, addr[0], + " I %4x %3c %#x%4u%4d", i, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], (uintmax_t)mask, vniy, vnix, dip_hit ? 'Y' : 'N', port_num, cls_lo & F_T6_SRAM_VLD ? 'Y' : 'N', From owner-dev-commits-src-main@freebsd.org Thu Apr 22 23:33:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F197C62267D; Thu, 22 Apr 2021 23:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRDJH6CCxz4vYQ; Thu, 22 Apr 2021 23:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C74EF22C32; Thu, 22 Apr 2021 23:33: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 13MNXZIA083644; Thu, 22 Apr 2021 23:33:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MNXZbd083643; Thu, 22 Apr 2021 23:33:35 GMT (envelope-from git) Date: Thu, 22 Apr 2021 23:33:35 GMT Message-Id: <202104222333.13MNXZbd083643@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: 3cfd08c1c740 - main - libkiconv: address memory leak in not-found cases 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: 3cfd08c1c74058451a02bac35307bf7fa509c617 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 23:33:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3cfd08c1c74058451a02bac35307bf7fa509c617 commit 3cfd08c1c74058451a02bac35307bf7fa509c617 Author: Ed Maste AuthorDate: 2021-04-21 17:45:27 +0000 Commit: Ed Maste CommitDate: 2021-04-22 23:32:34 +0000 libkiconv: address memory leak in not-found cases Found in "Understanding and Detecting Disordered Error Handling with Precise Function Pairing" by Qiushi Wu et al. Reviewed by: imp, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29896 --- lib/libkiconv/kiconv_sysctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libkiconv/kiconv_sysctl.c b/lib/libkiconv/kiconv_sysctl.c index da68b3011f36..841a162bfd27 100644 --- a/lib/libkiconv/kiconv_sysctl.c +++ b/lib/libkiconv/kiconv_sysctl.c @@ -59,6 +59,7 @@ kiconv_lookupconv(const char *drvname) free(drivers); return (0); } + free(drivers); } return (ENOENT); } @@ -86,6 +87,7 @@ kiconv_lookupcs(const char *tocode, const char *fromcode) return (0); } } + free(csi); } return (ENOENT); } From owner-dev-commits-src-main@freebsd.org Fri Apr 23 00:47:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97C7E6235FA; Fri, 23 Apr 2021 00:47: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 4FRFxM3lbpz3DSw; Fri, 23 Apr 2021 00:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64CD923E80; Fri, 23 Apr 2021 00:47: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 13N0lJ7X075770; Fri, 23 Apr 2021 00:47:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13N0lJcP075769; Fri, 23 Apr 2021 00:47:19 GMT (envelope-from git) Date: Fri, 23 Apr 2021 00:47:19 GMT Message-Id: <202104230047.13N0lJcP075769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: b47b28e5b28a - main - cxgbe(4): Add flag to reliably stop the driver from accessing hw stats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b47b28e5b28aeaa42e87f905fe6a0fe65dbfc184 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 00:47:19 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=b47b28e5b28aeaa42e87f905fe6a0fe65dbfc184 commit b47b28e5b28aeaa42e87f905fe6a0fe65dbfc184 Author: Navdeep Parhar AuthorDate: 2021-04-23 00:45:52 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-23 00:45:52 +0000 cxgbe(4): Add flag to reliably stop the driver from accessing hw stats. There are two kinds of routines in the driver that read statistics from the hardware: the cxgbe_* variants read the per-port MPS/MAC registers and the vi_* variants read the per-VI registers. They can be called from the 1Hz callout or if_get_counter. All stats collection now takes place under the callout lock and there is a new flag to indicate that these routines should not access any hardware register. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 4 +--- sys/dev/cxgbe/t4_main.c | 59 +++++++++++++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index c46f9626b95b..7bdad292c752 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -175,6 +175,7 @@ enum { VI_INIT_DONE = (1 << 1), VI_SYSCTL_CTX = (1 << 2), TX_USES_VM_WR = (1 << 3), + VI_SKIP_STATS = (1 << 4), /* adapter debug_flags */ DF_DUMP_MBOX = (1 << 0), /* Log all mbox cmd/rpl. */ @@ -311,7 +312,6 @@ struct port_info { struct link_config link_cfg; struct ifmedia media; - struct timeval last_refreshed; struct port_stats stats; u_int tnl_cong_drops; u_int tx_parse_error; @@ -1213,11 +1213,9 @@ void end_synchronized_op(struct adapter *, int); int update_mac_settings(struct ifnet *, int); int adapter_full_init(struct adapter *); int adapter_full_uninit(struct adapter *); -uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); int vi_full_init(struct vi_info *); int vi_full_uninit(struct vi_info *); void vi_sysctls(struct vi_info *); -void vi_tick(void *); int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); int alloc_atid(struct adapter *, void *); void *lookup_atid(struct adapter *, int); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 07fd43a06edc..6774e1bbb833 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -735,9 +735,10 @@ static int t4_free_irq(struct adapter *, struct irq *); static void t4_init_atid_table(struct adapter *); static void t4_free_atid_table(struct adapter *); static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); -static void vi_refresh_stats(struct adapter *, struct vi_info *); -static void cxgbe_refresh_stats(struct adapter *, struct port_info *); +static void vi_refresh_stats(struct vi_info *); +static void cxgbe_refresh_stats(struct vi_info *); static void cxgbe_tick(void *); +static void vi_tick(void *); static void cxgbe_sysctls(struct port_info *); static int sysctl_int_array(SYSCTL_HANDLER_ARGS); static int sysctl_bitfield_8b(SYSCTL_HANDLER_ARGS); @@ -820,6 +821,8 @@ static int ktls_capability(struct adapter *, bool); #endif static int mod_event(module_t, int, void *); static int notify_siblings(device_t, int); +static uint64_t vi_get_counter(struct ifnet *, ift_counter); +static uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); struct { uint16_t device; @@ -1818,7 +1821,10 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_ioctl = cxgbe_ioctl; ifp->if_transmit = cxgbe_transmit; ifp->if_qflush = cxgbe_qflush; - ifp->if_get_counter = cxgbe_get_counter; + if (vi->pi->nvi > 1 || sc->flags & IS_VF) + ifp->if_get_counter = vi_get_counter; + else + ifp->if_get_counter = cxgbe_get_counter; #if defined(KERN_TLS) || defined(RATELIMIT) ifp->if_snd_tag_alloc = cxgbe_snd_tag_alloc; ifp->if_snd_tag_modify = cxgbe_snd_tag_modify; @@ -2336,7 +2342,9 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) struct vi_info *vi = ifp->if_softc; struct fw_vi_stats_vf *s = &vi->stats; - vi_refresh_stats(vi->adapter, vi); + mtx_lock(&vi->tick_mtx); + vi_refresh_stats(vi); + mtx_unlock(&vi->tick_mtx); switch (c) { case IFCOUNTER_IPACKETS: @@ -2380,18 +2388,16 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) } } -uint64_t +static uint64_t cxgbe_get_counter(struct ifnet *ifp, ift_counter c) { struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct adapter *sc = pi->adapter; struct port_stats *s = &pi->stats; - if (pi->nvi > 1 || sc->flags & IS_VF) - return (vi_get_counter(ifp, c)); - - cxgbe_refresh_stats(sc, pi); + mtx_lock(&vi->tick_mtx); + cxgbe_refresh_stats(vi); + mtx_unlock(&vi->tick_mtx); switch (c) { case IFCOUNTER_IPACKETS: @@ -5586,7 +5592,7 @@ cxgbe_init_synchronized(struct vi_info *vi) PORT_UNLOCK(pi); mtx_lock(&vi->tick_mtx); - if (pi->nvi > 1 || sc->flags & IS_VF) + if (ifp->if_get_counter == vi_get_counter) callout_reset(&vi->tick, hz, vi_tick, vi); else callout_reset(&vi->tick, hz, cxgbe_tick, vi); @@ -6334,12 +6340,14 @@ t4_clr_vi_stats(struct adapter *sc, u_int vin) } static void -vi_refresh_stats(struct adapter *sc, struct vi_info *vi) +vi_refresh_stats(struct vi_info *vi) { struct timeval tv; const struct timeval interval = {0, 250000}; /* 250ms */ - if (!(vi->flags & VI_INIT_DONE)) + mtx_assert(&vi->tick_mtx, MA_OWNED); + + if (!(vi->flags & VI_INIT_DONE) || vi->flags & VI_SKIP_STATS) return; getmicrotime(&tv); @@ -6347,22 +6355,31 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *vi) if (timevalcmp(&tv, &vi->last_refreshed, <)) return; - t4_get_vi_stats(sc, vi->vin, &vi->stats); + t4_get_vi_stats(vi->adapter, vi->vin, &vi->stats); getmicrotime(&vi->last_refreshed); } static void -cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) +cxgbe_refresh_stats(struct vi_info *vi) { u_int i, v, tnl_cong_drops, chan_map; struct timeval tv; const struct timeval interval = {0, 250000}; /* 250ms */ + struct port_info *pi; + struct adapter *sc; + + mtx_assert(&vi->tick_mtx, MA_OWNED); + + if (vi->flags & VI_SKIP_STATS) + return; getmicrotime(&tv); timevalsub(&tv, &interval); - if (timevalcmp(&tv, &pi->last_refreshed, <)) + if (timevalcmp(&tv, &vi->last_refreshed, <)) return; + pi = vi->pi; + sc = vi->adapter; tnl_cong_drops = 0; t4_get_port_stats(sc, pi->tx_chan, &pi->stats); chan_map = pi->rx_e_chan_map; @@ -6376,31 +6393,29 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) chan_map &= ~(1 << i); } pi->tnl_cong_drops = tnl_cong_drops; - getmicrotime(&pi->last_refreshed); + getmicrotime(&vi->last_refreshed); } static void cxgbe_tick(void *arg) { struct vi_info *vi = arg; - struct adapter *sc = vi->adapter; MPASS(IS_MAIN_VI(vi)); mtx_assert(&vi->tick_mtx, MA_OWNED); - cxgbe_refresh_stats(sc, vi->pi); + cxgbe_refresh_stats(vi); callout_schedule(&vi->tick, hz); } -void +static void vi_tick(void *arg) { struct vi_info *vi = arg; - struct adapter *sc = vi->adapter; mtx_assert(&vi->tick_mtx, MA_OWNED); - vi_refresh_stats(sc, vi); + vi_refresh_stats(vi); callout_schedule(&vi->tick, hz); } From owner-dev-commits-src-main@freebsd.org Fri Apr 23 07:28:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16B945E2A51; Fri, 23 Apr 2021 07:28:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRQqz0BSpz3lgL; Fri, 23 Apr 2021 07:28:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED4B7DC5; Fri, 23 Apr 2021 07:28: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 13N7SEid004766; Fri, 23 Apr 2021 07:28:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13N7SEs0004765; Fri, 23 Apr 2021 07:28:14 GMT (envelope-from git) Date: Fri, 23 Apr 2021 07:28:14 GMT Message-Id: <202104230728.13N7SEs0004765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 5f00292fe3b7 - main - cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f00292fe3b76aba9115f3b2dfc887acb647eb91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 07:28:15 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=5f00292fe3b76aba9115f3b2dfc887acb647eb91 commit 5f00292fe3b76aba9115f3b2dfc887acb647eb91 Author: Navdeep Parhar AuthorDate: 2021-04-23 07:26:47 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-23 07:26:47 +0000 cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function. It can be called to (re)apply the settings in the driver softc to the hardware. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 58 ++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 6774e1bbb833..6e5d263c7649 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -823,6 +823,7 @@ static int mod_event(module_t, int, void *); static int notify_siblings(device_t, int); static uint64_t vi_get_counter(struct ifnet *, ift_counter); static uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); +static void enable_vxlan_rx(struct adapter *); struct { uint16_t device; @@ -11671,12 +11672,38 @@ struct vxlan_evargs { }; static void -t4_vxlan_start(struct adapter *sc, void *arg) +enable_vxlan_rx(struct adapter *sc) { - struct vxlan_evargs *v = arg; + int i, rc; struct port_info *pi; uint8_t match_all_mac[ETHER_ADDR_LEN] = {0}; - int i, rc; + + ASSERT_SYNCHRONIZED_OP(sc); + + t4_write_reg(sc, A_MPS_RX_VXLAN_TYPE, V_VXLAN(sc->vxlan_port) | + F_VXLAN_EN); + for_each_port(sc, i) { + pi = sc->port[i]; + if (pi->vxlan_tcam_entry == true) + continue; + rc = t4_alloc_raw_mac_filt(sc, pi->vi[0].viid, match_all_mac, + match_all_mac, sc->rawf_base + pi->port_id, 1, pi->port_id, + true); + if (rc < 0) { + rc = -rc; + CH_ERR(&pi->vi[0], + "failed to add VXLAN TCAM entry: %d.\n", rc); + } else { + MPASS(rc == sc->rawf_base + pi->port_id); + pi->vxlan_tcam_entry = true; + } + } +} + +static void +t4_vxlan_start(struct adapter *sc, void *arg) +{ + struct vxlan_evargs *v = arg; if (sc->nrawf == 0 || chip_id(sc) <= CHELSIO_T5) return; @@ -11686,32 +11713,13 @@ t4_vxlan_start(struct adapter *sc, void *arg) if (sc->vxlan_refcount == 0) { sc->vxlan_port = v->port; sc->vxlan_refcount = 1; - t4_write_reg(sc, A_MPS_RX_VXLAN_TYPE, - V_VXLAN(v->port) | F_VXLAN_EN); - for_each_port(sc, i) { - pi = sc->port[i]; - if (pi->vxlan_tcam_entry == true) - continue; - rc = t4_alloc_raw_mac_filt(sc, pi->vi[0].viid, - match_all_mac, match_all_mac, - sc->rawf_base + pi->port_id, 1, pi->port_id, true); - if (rc < 0) { - rc = -rc; - log(LOG_ERR, - "%s: failed to add VXLAN TCAM entry: %d.\n", - device_get_name(pi->vi[0].dev), rc); - } else { - MPASS(rc == sc->rawf_base + pi->port_id); - rc = 0; - pi->vxlan_tcam_entry = true; - } - } + enable_vxlan_rx(sc); } else if (sc->vxlan_port == v->port) { sc->vxlan_refcount++; } else { - log(LOG_ERR, "%s: VXLAN already configured on port %d; " + CH_ERR(sc, "VXLAN already configured on port %d; " "ignoring attempt to configure it on port %d\n", - device_get_nameunit(sc->dev), sc->vxlan_port, v->port); + sc->vxlan_port, v->port); } end_synchronized_op(sc, 0); } From owner-dev-commits-src-main@freebsd.org Fri Apr 23 08:26:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3E555E8910 for ; Fri, 23 Apr 2021 08:26:59 +0000 (UTC) (envelope-from bounces+17430347-76af-dev-commits-src-main=freebsd.org@em4937.fdc-k.co.ke) Received: from o50316379.outbound-mail.sendgrid.net (o50316379.outbound-mail.sendgrid.net [50.31.63.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRS7l1BMtz3sNt for ; Fri, 23 Apr 2021 08:26:59 +0000 (UTC) (envelope-from bounces+17430347-76af-dev-commits-src-main=freebsd.org@em4937.fdc-k.co.ke) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fdc-k.co.ke; h=content-transfer-encoding:content-type:from:mime-version:to:subject:list-unsubscribe; s=s1; bh=1uvGjNjCagITIuxW+RoCU5kO8x7AQ65OjfvvyQAhcpA=; b=C48+BJk Xu1mEBLZwIRS66/fpAawIuHenjYwqQMtRGLDpj7dYkH+LVZ/Co4xeAu6TmUuhKE0 7R2EIdh/SwdSueYueN2RLdZz6fcJPVglApa5srgXnlBpx7mjOWnbQK7Cpoy5k+5m QDO46N6Nd+5mBIUkenktUKqqa0Ze3Fyl4VNI= Received: by filter2238p1las1.sendgrid.net with SMTP id filter2238p1las1-27928-608284C5-2B 2021-04-23 08:26:45.927475667 +0000 UTC m=+21801.642247078 Received: from MTc0MzAzNDc (unknown) by geopod-ismtpd-4-0 (SG) with HTTP id kDwKprKrRbKf_BZcc3dQNg Fri, 23 Apr 2021 08:26:45.778 +0000 (UTC) Date: Fri, 23 Apr 2021 08:26:58 +0000 (UTC) From: "Jackson From FDC-K Africa" To: dev-commits-src-main@freebsd.org Message-ID: Subject: Invitation to Research Design, ODK mobile data collection, GIS data mapping, Data analysis using NVIVO and R Workshop X-SG-EID: tEzs+hGm85Gb96SmeoEyTpKypbcWhnV/7vfTO5S6uENfy7ieoO6rJcR6yrdC8FQn/A6erRq3zEVGao y7Zdt4vOMkU2BSVyarJ/1Np/txD0WZ7iTmH45A71GdUWDjz5oF3AoE04zbE1hkI9hxAXvO09ZEZf1N q8m5U1J0ZKXvRgR4FVqGFkGe/E7kd8Y5CPs/yfovhNU4hMYz05eIB8VFhaLWOtvDMzbkDIaavoiPPU 05UmBjmzxfuNy5M0ZxhEgS0ZjEGj2FIc5j7n76pTbWbw== X-Entity-ID: lgZohGoWIjvYsKzlUpYsxA== X-Rspamd-Queue-Id: 4FRS7l1BMtz3sNt X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=fdc-k.co.ke header.s=s1 header.b=C48+BJk ; dmarc=pass (policy=none) header.from=fdc-k.co.ke; spf=pass (mx1.freebsd.org: domain of bounces@em4937.fdc-k.co.ke designates 50.31.63.79 as permitted sender) smtp.mailfrom=bounces@em4937.fdc-k.co.ke X-Spamd-Result: default: False [-2.41 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:50.31.32.0/19:c]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[fdc-k.co.ke:+]; DMARC_POLICY_ALLOW(-0.50)[fdc-k.co.ke,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[Jackson@fdc-k.co.ke,bounces@em4937.fdc-k.co.ke]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[50.31.63.79:from]; ASN(0.00)[asn:11377, ipnet:50.31.48.0/20, country:US]; MIME_TRACE(0.00)[0:~]; TAGGED_FROM(0.00)[17430347-76af-dev-commits-src-main=freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[fdc-k.co.ke:s=s1]; FROM_NEQ_ENVFROM(0.00)[Jackson@fdc-k.co.ke,bounces@em4937.fdc-k.co.ke]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[50.31.63.79:from:127.0.2.255]; MIME_HTML_ONLY(0.20)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[50.31.63.79:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 08:26:59 -0000 From owner-dev-commits-src-main@freebsd.org Fri Apr 23 09:58:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B41A95EBD1B; Fri, 23 Apr 2021 09:58: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 4FRV8r4krxz4SDd; Fri, 23 Apr 2021 09:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94CCB2D6D; Fri, 23 Apr 2021 09:58: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 13N9w4bx005048; Fri, 23 Apr 2021 09:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13N9w4Jf005047; Fri, 23 Apr 2021 09:58:04 GMT (envelope-from git) Date: Fri, 23 Apr 2021 09:58:04 GMT Message-Id: <202104230958.13N9w4Jf005047@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: 3183d0b68072 - main - iflib: initialize LRO unconditionally 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: 3183d0b68072dda0e80bb6e03c970625f2823e97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 09:58:04 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=3183d0b68072dda0e80bb6e03c970625f2823e97 commit 3183d0b68072dda0e80bb6e03c970625f2823e97 Author: Andrew Gallatin AuthorDate: 2021-04-23 09:51:22 +0000 Commit: Andrew Gallatin CommitDate: 2021-04-23 09:55:20 +0000 iflib: initialize LRO unconditionally Changes to the LRO code have exposed a bug in iflib where devices which are not capable of doing LRO are still calling tcp_lro_flush_all(), even when they have not initialized the LRO context. This used to be mostly harmless, but the LRO code now sets the VNET based on the ifp in the lro context and will try to access it through a NULL ifp resulting in a panic at boot. To fix this, we unconditionally initializes LRO so that we have a valid LRO context when calling tcp_lro_flush_all(). One alternative is to check the device capabilities before calling tcp_lro_flush_all() or adding a new state flag in the ctx. However, it seems unwise to add an extra, mostly useless test for higher performance devices when we can just initialize LRO for all devices. Reviewed by: erj, hselasky, markj, olivier Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29928 --- sys/net/iflib.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 6dbaff556a15..fc0814d0fc19 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5891,15 +5891,13 @@ iflib_rx_structures_setup(if_ctx_t ctx) for (q = 0; q < ctx->ifc_softc_ctx.isc_nrxqsets; q++, rxq++) { #if defined(INET6) || defined(INET) - if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) { - err = tcp_lro_init_args(&rxq->ifr_lc, ctx->ifc_ifp, - TCP_LRO_ENTRIES, min(1024, - ctx->ifc_softc_ctx.isc_nrxd[rxq->ifr_fl_offset])); - if (err != 0) { - device_printf(ctx->ifc_dev, - "LRO Initialization failed!\n"); - goto fail; - } + err = tcp_lro_init_args(&rxq->ifr_lc, ctx->ifc_ifp, + TCP_LRO_ENTRIES, min(1024, + ctx->ifc_softc_ctx.isc_nrxd[rxq->ifr_fl_offset])); + if (err != 0) { + device_printf(ctx->ifc_dev, + "LRO Initialization failed!\n"); + goto fail; } #endif IFDI_RXQ_SETUP(ctx, rxq->ifr_id); @@ -5914,8 +5912,7 @@ fail: */ rxq = ctx->ifc_rxqs; for (i = 0; i < q; ++i, rxq++) { - if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) - tcp_lro_free(&rxq->ifr_lc); + tcp_lro_free(&rxq->ifr_lc); } return (err); #endif @@ -5938,8 +5935,7 @@ iflib_rx_structures_free(if_ctx_t ctx) iflib_dma_free(&rxq->ifr_ifdi[j]); iflib_rx_sds_free(rxq); #if defined(INET6) || defined(INET) - if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) - tcp_lro_free(&rxq->ifr_lc); + tcp_lro_free(&rxq->ifr_lc); #endif } free(ctx->ifc_rxqs, M_IFLIB); From owner-dev-commits-src-main@freebsd.org Fri Apr 23 10:49:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46D35ED279; Fri, 23 Apr 2021 10:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRWJ54lD7z4VdR; Fri, 23 Apr 2021 10:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 918133AC1; Fri, 23 Apr 2021 10:49: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 13NAnPfa071973; Fri, 23 Apr 2021 10:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NAnPe5071972; Fri, 23 Apr 2021 10:49:25 GMT (envelope-from git) Date: Fri, 23 Apr 2021 10:49:25 GMT Message-Id: <202104231049.13NAnPe5071972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 694407528fb5 - main - Correctly skip rtsock_l3 test when if_epair is not available MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 694407528fb506755f1e1f0fa2d343b7e2c3177e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 10:49:25 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=694407528fb506755f1e1f0fa2d343b7e2c3177e commit 694407528fb506755f1e1f0fa2d343b7e2c3177e Author: Alex Richardson AuthorDate: 2021-04-23 10:21:28 +0000 Commit: Alex Richardson CommitDate: 2021-04-23 10:28:26 +0000 Correctly skip rtsock_l3 test when if_epair is not available This logic was accidentally changed in 67f2f67fc8ce8484066e95dabac5af892888fca1 Reported By: olivier X-MFC-With: 67f2f67fc8ce8484066e95dabac5af892888fca1 Tested By: kp Reviewed By: kp, melifaro Fixes: 67f2f67fc8ce ("Update rtsock_l3 test after 2fe5a79425c7") Differential Revision: https://reviews.freebsd.org/D29944 --- tests/sys/net/routing/rtsock_config.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/sys/net/routing/rtsock_config.h b/tests/sys/net/routing/rtsock_config.h index d9eccb6a19f6..ff89814a61da 100644 --- a/tests/sys/net/routing/rtsock_config.h +++ b/tests/sys/net/routing/rtsock_config.h @@ -129,13 +129,11 @@ config_setup(const atf_tc_t *tc, struct rtsock_config_options *co) ATF_CHECK_ERRNO(0, true); if (co->num_interfaces > 0) { - if (kldload("if_epair") == -1) { - /* Any errno other than EEXIST is fatal. */ - ATF_REQUIRE_ERRNO(EEXIST, true); - /* Clear errno for the following tests. */ - errno = 0; - } + /* Try loading if_epair and if that fails skip the test. */ + kldload("if_epair"); ATF_REQUIRE_KERNEL_MODULE("if_epair"); + /* Clear errno for the following tests. */ + errno = 0; c->ifnames = calloc(co->num_interfaces, sizeof(char *)); for (int i = 0; i < co->num_interfaces; i++) From owner-dev-commits-src-main@freebsd.org Fri Apr 23 13:29:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEEDA5F365C; Fri, 23 Apr 2021 13:29: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 4FRZs1510yz4gYD; Fri, 23 Apr 2021 13:29:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A4945EFA; Fri, 23 Apr 2021 13:29: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 13NDTfBI088079; Fri, 23 Apr 2021 13:29:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NDTfbB088078; Fri, 23 Apr 2021 13:29:41 GMT (envelope-from git) Date: Fri, 23 Apr 2021 13:29:41 GMT Message-Id: <202104231329.13NDTfbB088078@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: 8e8f1cc9bb94 - main - Re-enable network ioctls in capability mode 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: 8e8f1cc9bb945ffaa4b49231e1ebcead1baa62ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 13:29:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8e8f1cc9bb945ffaa4b49231e1ebcead1baa62ce commit 8e8f1cc9bb945ffaa4b49231e1ebcead1baa62ce Author: Mark Johnston AuthorDate: 2021-04-23 13:14:42 +0000 Commit: Mark Johnston CommitDate: 2021-04-23 13:22:49 +0000 Re-enable network ioctls in capability mode This reverts a portion of 274579831b61 ("capsicum: Limit socket operations in capability mode") as at least rtsol and dhcpcd rely on being able to configure network interfaces while in capability mode. Reported by: bapt, Greg V Sponsored by: The FreeBSD Foundation --- contrib/capsicum-test/capmode.cc | 5 +++++ sys/kern/sys_socket.c | 2 +- sys/net/if.c | 9 --------- sys/net/route.c | 5 +---- sys/net/route.h | 4 +--- sys/netinet/in.c | 4 ---- sys/netinet6/in6.c | 4 ---- 7 files changed, 8 insertions(+), 25 deletions(-) diff --git a/contrib/capsicum-test/capmode.cc b/contrib/capsicum-test/capmode.cc index ba2de19879a0..f32d9e038744 100644 --- a/contrib/capsicum-test/capmode.cc +++ b/contrib/capsicum-test/capmode.cc @@ -227,6 +227,10 @@ FORK_TEST_F(WithFiles, AllowedSocketSyscallsIfRoot) { // Interface configuration ioctls are not permitted in capability // mode. + // + // This test is disabled for now as the corresponding kernel change was + // disabled. +#if 0 #ifdef __FreeBSD__ struct if_clonereq req; @@ -238,6 +242,7 @@ FORK_TEST_F(WithFiles, AllowedSocketSyscallsIfRoot) { free(req.ifcr_buffer); #endif +#endif } #ifdef HAVE_SEND_RECV_MMSG diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 52f4b6cdf7f9..e53b0367960b 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -271,7 +271,7 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred, error = ifioctl(so, cmd, data, td); else if (IOCGROUP(cmd) == 'r') { CURVNET_SET(so->so_vnet); - error = rtioctl_fib(cmd, data, so->so_fibnum, td); + error = rtioctl_fib(cmd, data, so->so_fibnum); CURVNET_RESTORE(); } else { CURVNET_SET(so->so_vnet); diff --git a/sys/net/if.c b/sys/net/if.c index 5bf44d014db3..1e410142747f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2968,15 +2968,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) bool shutdown; #endif - /* - * Interface ioctls access a global namespace. There is currently no - * capability-based representation for interfaces, so the configuration - * interface is simply unaccessible from capability mode. If necessary, - * select ioctls may be permitted here. - */ - if (IN_CAPABILITY_MODE(td)) - return (ECAPMODE); - CURVNET_SET(so->so_vnet); #ifdef VIMAGE /* Make sure the VNET is stable. */ diff --git a/sys/net/route.c b/sys/net/route.c index f093a71b7585..2416aa9a983f 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -246,10 +245,8 @@ rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, * Routing table ioctl interface. */ int -rtioctl_fib(u_long req, caddr_t data, u_int fibnum, struct thread *td) +rtioctl_fib(u_long req, caddr_t data, u_int fibnum) { - if (IN_CAPABILITY_MODE(td)) - return (ECAPMODE); /* * If more ioctl commands are added here, make sure the proper diff --git a/sys/net/route.h b/sys/net/route.h index 64e89965f9cd..67217f237e0b 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -431,13 +431,11 @@ void rt_updatemtu(struct ifnet *); void rt_flushifroutes(struct ifnet *ifp); -struct thread; - /* XXX MRT NEW VERSIONS THAT USE FIBs * For now the protocol indepedent versions are the same as the AF_INET ones * but this will change.. */ -int rtioctl_fib(u_long, caddr_t, u_int, struct thread *); +int rtioctl_fib(u_long, caddr_t, u_int); int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t, struct rt_addrinfo *); void rib_free_info(struct rt_addrinfo *info); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 5f70dd1ec824..bcf071a81e0e 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -238,9 +237,6 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, if (ifp == NULL) return (EADDRNOTAVAIL); - if (td != NULL && IN_CAPABILITY_MODE(td)) - return (ECAPMODE); - /* * Filter out 4 ioctls we implement directly. Forward the rest * to specific functions and ifp->if_ioctl(). diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index de3db6dc7d33..02cb9df7da3a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include -#include #include #include #include @@ -255,9 +254,6 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, int error; u_long ocmd = cmd; - if (td != NULL && IN_CAPABILITY_MODE(td)) - return (ECAPMODE); - /* * Compat to make pre-10.x ifconfig(8) operable. */ From owner-dev-commits-src-main@freebsd.org Fri Apr 23 14:28:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD2655F49D3; Fri, 23 Apr 2021 14:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRc8h5zqqz4jvW; Fri, 23 Apr 2021 14:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C05D769EC; Fri, 23 Apr 2021 14:28: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 13NESKD7066986; Fri, 23 Apr 2021 14:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NESKqC066985; Fri, 23 Apr 2021 14:28:20 GMT (envelope-from git) Date: Fri, 23 Apr 2021 14:28:20 GMT Message-Id: <202104231428.13NESKqC066985@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: d500a85e640d - main - dtrace tests: Fix tst.system.d after ping/ping6 unification 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: d500a85e640d1cd270747c12e17c511b53864436 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 14:28:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d500a85e640d1cd270747c12e17c511b53864436 commit d500a85e640d1cd270747c12e17c511b53864436 Author: Mark Johnston AuthorDate: 2021-04-23 14:28:09 +0000 Commit: Mark Johnston CommitDate: 2021-04-23 14:28:09 +0000 dtrace tests: Fix tst.system.d after ping/ping6 unification MFC after: 1 week Sponsored by: The FreeBSD Foundation --- .../opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d index 63a850133b3f..4d5cced71c79 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d @@ -35,11 +35,11 @@ BEGIN this->b = -2; system("echo %s %d %d", "foo", this->a, this->b); - system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '"); + system("ping -q -c 1 127.0.0.1 2>/dev/null | grep -v '^round-trip '"); system("echo %d", ++this->a); - system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '"); + system("ping -4 -q -c 1 127.0.0.1 2>/dev/null | grep -v '^round-trip '"); system("echo %d", ++this->a); - system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '"); + system("ping -4 -q -c 1 127.0.0.1 2>/dev/null | grep -v '^round-trip '"); system("echo %d", ++this->a); exit(0); } From owner-dev-commits-src-main@freebsd.org Fri Apr 23 16:45:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53E495F8E62; Fri, 23 Apr 2021 16:45: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 4FRgBS1zWHz4rBJ; Fri, 23 Apr 2021 16:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3700510AD6; Fri, 23 Apr 2021 16:45: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 13NGj4Qb056228; Fri, 23 Apr 2021 16:45:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NGj414056227; Fri, 23 Apr 2021 16:45:04 GMT (envelope-from git) Date: Fri, 23 Apr 2021 16:45:04 GMT Message-Id: <202104231645.13NGj414056227@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: b0df36580d5b - main - etcupdate: Remove the old pre-world tree when rotating for -p. 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: b0df36580d5b0df67a0f58ded8f6356b268f7f71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 16:45:04 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b0df36580d5b0df67a0f58ded8f6356b268f7f71 commit b0df36580d5b0df67a0f58ded8f6356b268f7f71 Author: John Baldwin AuthorDate: 2021-04-23 16:40:04 +0000 Commit: John Baldwin CommitDate: 2021-04-23 16:44:18 +0000 etcupdate: Remove the old pre-world tree when rotating for -p. This fixes a bug in an earlier change to move tree rotation to the end of the update where the step to make room for the new preworld tree was deleting the old "current" tree instead of the old "preworld" tree. Reported by: olivier, dhw Fixes: 0611aec3cf3a373e6a06f103699dbc91c3d6d472 MFC after: 2 weeks --- usr.sbin/etcupdate/etcupdate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index bb9eb00bc646..254a72abae08 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -1644,7 +1644,7 @@ EOF if [ -z "$preworld" ]; then panic "New tree should be rotated to old" fi - if ! remove_tree $old; then + if ! remove_tree $new; then echo "Unable to remove previous pre-world tree." exit 1 fi From owner-dev-commits-src-main@freebsd.org Fri Apr 23 19:28:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F87D5FD435; Fri, 23 Apr 2021 19:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRkqK0lbsz3GTQ; Fri, 23 Apr 2021 19:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0838812FAB; Fri, 23 Apr 2021 19:28: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 13NJSiI6069708; Fri, 23 Apr 2021 19:28:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NJSiAE069707; Fri, 23 Apr 2021 19:28:44 GMT (envelope-from git) Date: Fri, 23 Apr 2021 19:28:44 GMT Message-Id: <202104231928.13NJSiAE069707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 50f5d13eeb88 - main - cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50f5d13eeb8835fe8250d65f033334d7d956d703 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 19:28:45 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=50f5d13eeb8835fe8250d65f033334d7d956d703 commit 50f5d13eeb8835fe8250d65f033334d7d956d703 Author: Navdeep Parhar AuthorDate: 2021-04-23 19:17:54 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-23 19:17:54 +0000 cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 6e5d263c7649..1650e15d16a0 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -593,7 +593,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, pcie_relaxed_ordering, CTLFLAG_RDTUN, "PCIe Relaxed Ordering: 0 = disable, 1 = enable, 2 = leave alone"); static int t4_panic_on_fatal_err = 0; -SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RDTUN, +SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RWTUN, &t4_panic_on_fatal_err, 0, "panic on fatal errors"); static int t4_tx_vm_wr = 0; From owner-dev-commits-src-main@freebsd.org Fri Apr 23 19:37:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE8F25FD6E0; Fri, 23 Apr 2021 19:37: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 4FRl1X4bbdz3H5T; Fri, 23 Apr 2021 19:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9007412FCA; Fri, 23 Apr 2021 19:37: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 13NJbao5082564; Fri, 23 Apr 2021 19:37:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NJba3m082563; Fri, 23 Apr 2021 19:37:36 GMT (envelope-from git) Date: Fri, 23 Apr 2021 19:37:36 GMT Message-Id: <202104231937.13NJba3m082563@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: 576b477ba41c - main - openssh: add a note about pushing vendor updates 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: 576b477ba41c9916fae3a83e6b4dd98c682a0c2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 19:37:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=576b477ba41c9916fae3a83e6b4dd98c682a0c2f commit 576b477ba41c9916fae3a83e6b4dd98c682a0c2f Author: Ed Maste AuthorDate: 2021-04-23 19:35:40 +0000 Commit: Ed Maste CommitDate: 2021-04-23 19:36:42 +0000 openssh: add a note about pushing vendor updates Sponsored by: The FreeBSD Foundation --- crypto/openssh/FREEBSD-upgrade | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crypto/openssh/FREEBSD-upgrade b/crypto/openssh/FREEBSD-upgrade index bde003a1d183..397b68dee96f 100644 --- a/crypto/openssh/FREEBSD-upgrade +++ b/crypto/openssh/FREEBSD-upgrade @@ -39,6 +39,13 @@ $ git tag -a -m "Tag OpenSSH X.YpZ" vendor/openssh/X.YpZ + At this point the vendor branch can be pushed to the FreeBSD repo via: + + $ git push freebsd vendor/openssh + + (It could also be pushed later on, along with the merge to main, but + pushing now allows others to collaborate.) + 08) Check out head and run the pre-merge script, which strips our RCS tags from files that have them: From owner-dev-commits-src-main@freebsd.org Fri Apr 23 22:28:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFDF55E0DE7; Fri, 23 Apr 2021 22:28: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 4FRpq74T5fz3PYQ; Fri, 23 Apr 2021 22:28:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D4EF15233; Fri, 23 Apr 2021 22:28: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 13NMSpbC007604; Fri, 23 Apr 2021 22:28:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13NMSpI6007603; Fri, 23 Apr 2021 22:28:51 GMT (envelope-from git) Date: Fri, 23 Apr 2021 22:28:51 GMT Message-Id: <202104232228.13NMSpI6007603@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: 4281bfec3628 - main - nfsd: fix session slot handling for failed callbacks 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: 4281bfec36285e2212f41568459c077bf4dbd91c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 22:28:51 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4281bfec36285e2212f41568459c077bf4dbd91c commit 4281bfec36285e2212f41568459c077bf4dbd91c Author: Rick Macklem AuthorDate: 2021-04-23 22:24:47 +0000 Commit: Rick Macklem CommitDate: 2021-04-23 22:24:47 +0000 nfsd: fix session slot handling for failed callbacks When the NFSv4.1/4.2 server does a callback to a client on the back channel, it will use a session slot in the back channel session. If the back channel has failed, the callback will fail and, without this patch, the session slot will not be released. As more callbacks are attempted, all session slots can become busy and then the nfsd thread gets stuck waiting for a back channel session slot. This patch frees the session slot upon callback failure to avoid this problem. Without this patch, the problem can be avoided by leaving delegations disabled in the NFS server. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdstate.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 60647ab288d8..430f09844b83 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -166,7 +166,8 @@ static int nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp, struct nfsvattr *nap, nfsattrbit_t *attrbitp, int laytype, NFSPROC_T *p); static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, - uint32_t callback, int op, const char *optag, struct nfsdsession **sepp); + uint32_t callback, int op, const char *optag, struct nfsdsession **sepp, + int *slotposp); static u_int32_t nfsrv_nextclientindex(void); static u_int32_t nfsrv_nextstateindex(struct nfsclient *clp); static void nfsrv_markstable(struct nfsclient *clp); @@ -201,7 +202,7 @@ static void nfsrv_unlocklf(struct nfslockfile *lfp); static struct nfsdsession *nfsrv_findsession(uint8_t *sessionid); static int nfsrv_freesession(struct nfsdsession *sep, uint8_t *sessionid); static int nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, - int dont_replycache, struct nfsdsession **sepp); + int dont_replycache, struct nfsdsession **sepp, int *slotposp); static int nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp); static int nfsrv_addlayout(struct nfsrv_descript *nd, struct nfslayout **lypp, nfsv4stateid_t *stateidp, char *layp, int *layoutlenp, NFSPROC_T *p); @@ -4434,7 +4435,7 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, u_int32_t *tl; struct nfsrv_descript *nd; struct ucred *cred; - int error = 0; + int error = 0, slotpos; u_int32_t callback; struct nfsdsession *sep = NULL; uint64_t tval; @@ -4492,7 +4493,7 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, if (procnum == NFSV4OP_CBGETATTR) { nd->nd_procnum = NFSV4PROC_CBCOMPOUND; error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBGETATTR, - "CB Getattr", &sep); + "CB Getattr", &sep, &slotpos); if (error != 0) { m_freem(nd->nd_mreq); goto errout; @@ -4502,7 +4503,7 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, } else if (procnum == NFSV4OP_CBRECALL) { nd->nd_procnum = NFSV4PROC_CBCOMPOUND; error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBRECALL, - "CB Recall", &sep); + "CB Recall", &sep, &slotpos); if (error != 0) { m_freem(nd->nd_mreq); goto errout; @@ -4521,7 +4522,7 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, NFSD_DEBUG(4, "docallback layout recall\n"); nd->nd_procnum = NFSV4PROC_CBCOMPOUND; error = nfsrv_cbcallargs(nd, clp, callback, - NFSV4OP_CBLAYOUTRECALL, "CB Reclayout", &sep); + NFSV4OP_CBLAYOUTRECALL, "CB Reclayout", &sep, &slotpos); NFSD_DEBUG(4, "aft cbcallargs=%d\n", error); if (error != 0) { m_freem(nd->nd_mreq); @@ -4570,6 +4571,8 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, if (clp->lc_req.nr_client == NULL) { if ((clp->lc_flags & LCL_NFSV41) != 0) { error = ECONNREFUSED; + if (procnum != NFSV4PROC_CBNULL) + nfsv4_freeslot(&sep->sess_cbsess, slotpos); nfsrv_freesession(sep, NULL); } else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, @@ -4601,6 +4604,8 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, error = ECONNREFUSED; } NFSD_DEBUG(4, "aft newnfs_request=%d\n", error); + if (error != 0 && procnum != NFSV4PROC_CBNULL) + nfsv4_freeslot(&sep->sess_cbsess, slotpos); nfsrv_freesession(sep, NULL); } else error = newnfs_request(nd, NULL, clp, &clp->lc_req, @@ -4663,7 +4668,8 @@ errout: */ static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, - uint32_t callback, int op, const char *optag, struct nfsdsession **sepp) + uint32_t callback, int op, const char *optag, struct nfsdsession **sepp, + int *slotposp) { uint32_t *tl; int error, len; @@ -4679,7 +4685,7 @@ nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, *tl++ = txdr_unsigned(callback); *tl++ = txdr_unsigned(2); *tl = txdr_unsigned(NFSV4OP_CBSEQUENCE); - error = nfsv4_setcbsequence(nd, clp, 1, sepp); + error = nfsv4_setcbsequence(nd, clp, 1, sepp, slotposp); if (error != 0) return (error); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); @@ -6599,11 +6605,11 @@ nfsrv_teststateid(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp, */ static int nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, - int dont_replycache, struct nfsdsession **sepp) + int dont_replycache, struct nfsdsession **sepp, int *slotposp) { struct nfsdsession *sep; uint32_t *tl, slotseq = 0; - int maxslot, slotpos; + int maxslot; uint8_t sessionid[NFSX_V4SESSIONID]; int error; @@ -6611,7 +6617,7 @@ nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, if (error != 0) return (error); sep = *sepp; - (void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, &slotpos, &maxslot, + (void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, slotposp, &maxslot, &slotseq, sessionid); KASSERT(maxslot >= 0, ("nfsv4_setcbsequence neg maxslot")); @@ -6621,7 +6627,7 @@ nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(*slotposp); *tl++ = txdr_unsigned(maxslot); if (dont_replycache == 0) *tl++ = newnfs_true; From owner-dev-commits-src-main@freebsd.org Sat Apr 24 03:31:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D83EB5EF76E; Sat, 24 Apr 2021 03:31: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 4FRxXZ5rNbz4RpG; Sat, 24 Apr 2021 03:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB4A1199C8; Sat, 24 Apr 2021 03:31: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 13O3VgII016428; Sat, 24 Apr 2021 03:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13O3VgLZ016427; Sat, 24 Apr 2021 03:31:42 GMT (envelope-from git) Date: Sat, 24 Apr 2021 03:31:42 GMT Message-Id: <202104240331.13O3VgLZ016427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tai-hwa Liang Subject: git: 2acbe67787d2 - main - sound(4): fixing panic for INVARIANTS kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2acbe67787d2ba08b62713ccc3abcef01e7ced09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 03:31:42 -0000 The branch main has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=2acbe67787d2ba08b62713ccc3abcef01e7ced09 commit 2acbe67787d2ba08b62713ccc3abcef01e7ced09 Author: Tai-hwa Liang AuthorDate: 2021-04-22 12:45:18 +0000 Commit: Tai-hwa Liang CommitDate: 2021-04-24 03:27:43 +0000 sound(4): fixing panic for INVARIANTS kernel 3e7bae08210e0 turns the BUS_READ_IVAR() failure from a warning into a KASSERT. For certain PCI audio devices such like snd_csa(4) and snd_emu10kx(4), the ac97_create() keeps the device handler generated by device_add_child(pci_dev, "pcm"), which is not really a PCI device handler. This in turn causes the subsequent pci_get_subdevice() inside ac97_initmixer() triggering a panic. This patch tries to put a bandaid for the aforementioned pcm device children such that they can use the correct PCI handler(from parent) to avoid a KASSERT panic in the INVARIANTS kernel. Tested with: snd_csa(4), snd_ich(4), snd_emu10kx(4) Reviewed by: imp MFC after: 1 month --- sys/dev/sound/pcm/ac97.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 960176329b3e..3dc614083660 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -602,6 +602,7 @@ ac97_initmixer(struct ac97_info *codec) ac97_patch codec_patch; const char *cname, *vname; char desc[80]; + device_t pdev; u_int8_t model, step; unsigned i, j, k, bit, old; u_int32_t id; @@ -641,9 +642,14 @@ ac97_initmixer(struct ac97_info *codec) return ENODEV; } + pdev = codec->dev; + while (strcmp(device_get_name(device_get_parent(pdev)), "pci") != 0) { + /* find the top-level PCI device handler */ + pdev = device_get_parent(pdev); + } codec->id = id; - codec->subvendor = (u_int32_t)pci_get_subdevice(codec->dev) << 16; - codec->subvendor |= (u_int32_t)pci_get_subvendor(codec->dev) & + codec->subvendor = (u_int32_t)pci_get_subdevice(pdev) << 16; + codec->subvendor |= (u_int32_t)pci_get_subvendor(pdev) & 0x0000ffff; codec->noext = 0; codec_patch = NULL; From owner-dev-commits-src-main@freebsd.org Sat Apr 24 03:36:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37A7A5EF957; Sat, 24 Apr 2021 03:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRxfb13qTz4S03; Sat, 24 Apr 2021 03:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17B3A1976E; Sat, 24 Apr 2021 03: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 13O3asgb017014; Sat, 24 Apr 2021 03: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 13O3asVc017013; Sat, 24 Apr 2021 03:36:54 GMT (envelope-from git) Date: Sat, 24 Apr 2021 03:36:54 GMT Message-Id: <202104240336.13O3asVc017013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: b99419aee49e - main - mpr/mps(4): Make device mapping some more robust. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b99419aee49e2cc53747730be4d0ec4f9b330eb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 03:36:55 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b99419aee49e2cc53747730be4d0ec4f9b330eb2 commit b99419aee49e2cc53747730be4d0ec4f9b330eb2 Author: Alexander Motin AuthorDate: 2021-04-24 03:18:01 +0000 Commit: Alexander Motin CommitDate: 2021-04-24 03:36:51 +0000 mpr/mps(4): Make device mapping some more robust. Allow new enclosure to replace previously existing one if there is no completely unused table entry, same as it is done for devices. If we can not process DPM due to corruption -- wipe it and restart from scratch. Otherwise I don't see a way to recover persistence if something go wrong and there is no BIOS to recover it for us. Together this solves a problem that appeared when 9300-8i firmware update to 16.00.10.00 somehow switched its mapping mode from Device Persistence to Enclosure/Slot without wiping the DPM table. It made HBA completely unusable, since overflowed and conflicting mapping table was unable to map any of enclosures and so devices. Also while there make some enclosure mapping errors more informative. MFC after: 1 month Sponsored by: iXsystems, Inc. --- sys/dev/mpr/mpr_mapping.c | 71 ++++++++++++++++++++++++++++++----------------- sys/dev/mps/mps_mapping.c | 39 +++++++++++++++++--------- 2 files changed, 71 insertions(+), 39 deletions(-) diff --git a/sys/dev/mpr/mpr_mapping.c b/sys/dev/mpr/mpr_mapping.c index ef97080fb175..6c191672c24e 100644 --- a/sys/dev/mpr/mpr_mapping.c +++ b/sys/dev/mpr/mpr_mapping.c @@ -1213,9 +1213,10 @@ _mapping_get_dev_info(struct mpr_softc *sc, phy_change->is_processed = 1; mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - phy_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + phy_change->dev_handle, + topo_change->enc_handle); continue; } if (!((phy_change->device_info & @@ -1368,9 +1369,10 @@ _mapping_get_pcie_dev_info(struct mpr_softc *sc, port_change->is_processed = 1; mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - port_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + port_change->dev_handle, + topo_change->enc_handle); continue; } if (!(port_change->device_info & @@ -1609,9 +1611,10 @@ _mapping_add_new_device(struct mpr_softc *sc, phy_change->is_processed = 1; mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - phy_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + phy_change->dev_handle, + topo_change->enc_handle); continue; } @@ -1865,9 +1868,10 @@ _mapping_add_new_pcie_device(struct mpr_softc *sc, port_change->is_processed = 1; mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - port_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + port_change->dev_handle, + topo_change->enc_handle); continue; } @@ -2205,7 +2209,7 @@ mpr_mapping_free_memory(struct mpr_softc *sc) free(sc->dpm_pg0, M_MPR); } -static bool +static void _mapping_process_dpm_pg0(struct mpr_softc *sc) { u8 missing_cnt, enc_idx; @@ -2331,8 +2335,8 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) MPR_DPM_BAD_IDX) { mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: Conflict in mapping table for " - " enclosure %d\n", __func__, - enc_idx); + "enclosure %d device %d\n", + __func__, enc_idx, map_idx); goto fail; } physical_id = @@ -2371,20 +2375,26 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) mt_entry->device_info = MPR_DEV_RESERVED; } } /*close the loop for DPM table */ - return (true); + return; fail: + mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " + "Wiping DPM to start from scratch\n", __func__); + dpm_entry = (Mpi2DriverMap0Entry_t *) ((uint8_t *) sc->dpm_pg0 + + sizeof(MPI2_CONFIG_EXTENDED_PAGE_HEADER)); + bzero(dpm_entry, sizeof(Mpi2DriverMap0Entry_t) * sc->max_dpm_entries); for (entry_num = 0; entry_num < sc->max_dpm_entries; entry_num++) { + sc->dpm_flush_entry[entry_num] = 1; sc->dpm_entry_used[entry_num] = 0; /* * for IR firmware, it may be necessary to wipe out * sc->mapping_table volumes tooi */ } + _mapping_flush_dpm_pages(sc); for (enc_idx = 0; enc_idx < sc->num_enc_table_entries; enc_idx++) _mapping_clear_enc_entry(sc->enclosure_table + enc_idx); sc->num_enc_table_entries = 0; - return (false); } /* @@ -2624,10 +2634,8 @@ retry_read_dpm: } } - if (sc->is_dpm_enable) { - if (!_mapping_process_dpm_pg0(sc)) - sc->is_dpm_enable = 0; - } + if (sc->is_dpm_enable) + _mapping_process_dpm_pg0(sc); if (! sc->is_dpm_enable) { mpr_dprint(sc, MPR_MAPPING, "%s: DPM processing is disabled. " "Device mappings will not persist across reboots or " @@ -2823,14 +2831,24 @@ mpr_mapping_enclosure_dev_status_change_event(struct mpr_softc *sc, * and the enclosure has enough space in the Mapping * Table to map its devices. */ - enc_idx = sc->num_enc_table_entries; - if (enc_idx >= sc->max_enclosures) { + if (sc->num_enc_table_entries < sc->max_enclosures) { + enc_idx = sc->num_enc_table_entries; + sc->num_enc_table_entries++; + } else { + enc_idx = _mapping_get_high_missing_et_idx(sc); + if (enc_idx != MPR_ENCTABLE_BAD_IDX) { + et_entry = &sc->enclosure_table[enc_idx]; + _mapping_add_to_removal_table(sc, + et_entry->dpm_entry_num); + _mapping_clear_enc_entry(et_entry); + } + } + if (enc_idx == MPR_ENCTABLE_BAD_IDX) { mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "Enclosure cannot be added to mapping " "table because it's full.\n", __func__); goto out; } - sc->num_enc_table_entries++; et_entry = &sc->enclosure_table[enc_idx]; et_entry->enc_handle = le16toh(event_data-> EnclosureHandle); @@ -2857,8 +2875,9 @@ mpr_mapping_enclosure_dev_status_change_event(struct mpr_softc *sc, le16toh(event_data->EnclosureHandle)); if (enc_idx == MPR_ENCTABLE_BAD_IDX) { mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: Cannot " - "unmap enclosure %d because it has already been " - "deleted.\n", __func__, enc_idx); + "unmap enclosure with handle 0x%04x because it " + "has already been deleted.\n", __func__, + le16toh(event_data->EnclosureHandle)); goto out; } et_entry = &sc->enclosure_table[enc_idx]; diff --git a/sys/dev/mps/mps_mapping.c b/sys/dev/mps/mps_mapping.c index 71cdb399c271..9e1e0726c574 100644 --- a/sys/dev/mps/mps_mapping.c +++ b/sys/dev/mps/mps_mapping.c @@ -1175,9 +1175,10 @@ _mapping_get_dev_info(struct mps_softc *sc, phy_change->is_processed = 1; mps_dprint(sc, MPS_ERROR | MPS_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - phy_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + phy_change->dev_handle, + topo_change->enc_handle); continue; } if (!((phy_change->device_info & @@ -1420,9 +1421,10 @@ _mapping_add_new_device(struct mps_softc *sc, phy_change->is_processed = 1; mps_dprint(sc, MPS_ERROR | MPS_MAPPING, "%s: " "failed to add the device with handle " - "0x%04x because the enclosure is not in " - "the mapping table\n", __func__, - phy_change->dev_handle); + "0x%04x because enclosure handle 0x%04x " + "is not in the mapping table\n", __func__, + phy_change->dev_handle, + topo_change->enc_handle); continue; } @@ -1884,8 +1886,8 @@ _mapping_process_dpm_pg0(struct mps_softc *sc) MPS_DPM_BAD_IDX) { mps_dprint(sc, MPS_ERROR | MPS_MAPPING, "%s: Conflict in mapping table for " - " enclosure %d\n", __func__, - enc_idx); + "enclosure %d device %d\n", + __func__, enc_idx, map_idx); break; } physical_id = @@ -2359,14 +2361,24 @@ mps_mapping_enclosure_dev_status_change_event(struct mps_softc *sc, * and the enclosure has enough space in the Mapping * Table to map its devices. */ - enc_idx = sc->num_enc_table_entries; - if (enc_idx >= sc->max_enclosures) { + if (sc->num_enc_table_entries < sc->max_enclosures) { + enc_idx = sc->num_enc_table_entries; + sc->num_enc_table_entries++; + } else { + enc_idx = _mapping_get_high_missing_et_idx(sc); + if (enc_idx != MPS_ENCTABLE_BAD_IDX) { + et_entry = &sc->enclosure_table[enc_idx]; + _mapping_add_to_removal_table(sc, + et_entry->dpm_entry_num); + _mapping_clear_enc_entry(et_entry); + } + } + if (enc_idx == MPS_ENCTABLE_BAD_IDX) { mps_dprint(sc, MPS_ERROR | MPS_MAPPING, "%s: " "Enclosure cannot be added to mapping " "table because it's full.\n", __func__); goto out; } - sc->num_enc_table_entries++; et_entry = &sc->enclosure_table[enc_idx]; et_entry->enc_handle = le16toh(event_data-> EnclosureHandle); @@ -2393,8 +2405,9 @@ mps_mapping_enclosure_dev_status_change_event(struct mps_softc *sc, le16toh(event_data->EnclosureHandle)); if (enc_idx == MPS_ENCTABLE_BAD_IDX) { mps_dprint(sc, MPS_ERROR | MPS_MAPPING, "%s: Cannot " - "unmap enclosure %d because it has already been " - "deleted.\n", __func__, enc_idx); + "unmap enclosure with handle 0x%04x because it " + "has already been deleted.\n", __func__, + le16toh(event_data->EnclosureHandle)); goto out; } et_entry = &sc->enclosure_table[enc_idx]; From owner-dev-commits-src-main@freebsd.org Sat Apr 24 10:27:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A8FD5FA125; Sat, 24 Apr 2021 10: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 4FS6m62zMrz4mGC; Sat, 24 Apr 2021 10:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 594BA1EFF1; Sat, 24 Apr 2021 10: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 13OARICt061645; Sat, 24 Apr 2021 10:27:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OARIVn061644; Sat, 24 Apr 2021 10:27:18 GMT (envelope-from git) Date: Sat, 24 Apr 2021 10:27:18 GMT Message-Id: <202104241027.13OARIVn061644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: a9b66dbd9169 - main - Allow the tcp_lro_flush_all() function to be called when the control structure is zeroed, by setting the VNET after checking the mbuf count for zero. It appears there are some cases with early interrupts on some network devices which still trigger page-faults on accessing a NULL "ifp" pointer before the TCP LRO control structure has been initialized. This basically preserves the old behaviour, prior to 9ca874cf740ee68c5742df8b5f9e20910085c011 . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9b66dbd9169f102dea92ad369a09c0d20cdb41f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 10:27:18 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a9b66dbd9169f102dea92ad369a09c0d20cdb41f commit a9b66dbd9169f102dea92ad369a09c0d20cdb41f Author: Hans Petter Selasky AuthorDate: 2021-04-24 10:20:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-24 10:23:42 +0000 Allow the tcp_lro_flush_all() function to be called when the control structure is zeroed, by setting the VNET after checking the mbuf count for zero. It appears there are some cases with early interrupts on some network devices which still trigger page-faults on accessing a NULL "ifp" pointer before the TCP LRO control structure has been initialized. This basically preserves the old behaviour, prior to 9ca874cf740ee68c5742df8b5f9e20910085c011 . No functional change. Reported by: rscheff@ Differential Revision: https://reviews.freebsd.org/D29564 MFC after: 2 weeks Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/netinet/tcp_lro.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 61c6f218e513..09fc024c3d73 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1439,12 +1439,12 @@ tcp_lro_flush_all(struct lro_ctrl *lc) uint64_t nseq; unsigned x; - CURVNET_SET(lc->ifp->if_vnet); - /* check if no mbufs to flush */ if (lc->lro_mbuf_count == 0) goto done; + CURVNET_SET(lc->ifp->if_vnet); + /* get current time */ lc->lro_last_queue_time = getsbinuptime(); @@ -1478,13 +1478,12 @@ tcp_lro_flush_all(struct lro_ctrl *lc) lc->lro_flushed++; } } + CURVNET_RESTORE(); done: /* flush active streams */ tcp_lro_rx_done(lc); lc->lro_mbuf_count = 0; - - CURVNET_RESTORE(); } #ifdef TCPHPTS From owner-dev-commits-src-main@freebsd.org Sat Apr 24 10:52:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D5595FB484; Sat, 24 Apr 2021 10:52: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 4FS7KH70mNz4nxR; Sat, 24 Apr 2021 10:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2C0C1F7AA; Sat, 24 Apr 2021 10:52: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 13OAqZjn001183; Sat, 24 Apr 2021 10:52:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OAqZtb001182; Sat, 24 Apr 2021 10:52:35 GMT (envelope-from git) Date: Sat, 24 Apr 2021 10:52:35 GMT Message-Id: <202104241052.13OAqZtb001182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 77651151f3ca - main - linux: make ptrace(2) return EIO when trying to peek invalid address MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77651151f3caec7d2440404f8c0f1819757d1d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 10:52:36 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=77651151f3caec7d2440404f8c0f1819757d1d5d commit 77651151f3caec7d2440404f8c0f1819757d1d5d Author: Edward Tomasz Napierala AuthorDate: 2021-04-24 10:37:06 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-24 10:37:50 +0000 linux: make ptrace(2) return EIO when trying to peek invalid address Previously we've returned the error from native ptrace(2), ENOMEM. This confused Linux strace(2). Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29925 --- sys/amd64/linux/linux_ptrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 89fda7979359..76ad9b1e25c4 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -313,6 +313,8 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data) error = kern_ptrace(td, PT_READ_I, pid, addr, 0); if (error == 0) error = copyout(td->td_retval, data, sizeof(l_int)); + else if (error == ENOMEM) + error = EIO; td->td_retval[0] = error; return (error); From owner-dev-commits-src-main@freebsd.org Sat Apr 24 12:12:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF62F5FE312; Sat, 24 Apr 2021 12:12:58 +0000 (UTC) (envelope-from flo@smeets.xyz) Received: from mail-out.smeets.xyz (mail-out.smeets.xyz [88.99.165.53]) (using TLSv1.3 with cipher TLS_AES_256_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 4FS96171rqz4sBW; Sat, 24 Apr 2021 12:12:57 +0000 (UTC) (envelope-from flo@smeets.xyz) Received: from mail.smeets.xyz (mail.smeets.xyz [IPv6:2a01:4f8:10a:3543::25:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail-out.smeets.xyz (Postfix) with ESMTPS id 54FBB82788; Sat, 24 Apr 2021 14:12:50 +0200 (CEST) Received: from amavis.smeets.xyz (amavis.smeets.xyz [IPv6:2a01:4f8:10a:3543::aa:4]) by mail.smeets.xyz (Postfix) with ESMTP id 4A608B05C7; Sat, 24 Apr 2021 14:12:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at smeets.xyz Received: from mail.smeets.xyz ([IPv6:2a01:4f8:10a:3543::25:3]) by amavis.smeets.xyz (amavis.smeets.xyz [IPv6:2a01:4f8:10a:3543::aa:4]) (amavisd-new, port 10025) with ESMTP id KFO0SPRNoDgd; Sat, 24 Apr 2021 14:12:50 +0200 (CEST) Received: from nibbler.home.lan (p2003000633c28c5344b638d1b5fb5e31.dip0.t-ipconnect.de [IPv6:2003:6:33c2:8c53:44b6:38d1:b5fb:5e31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.smeets.xyz (Postfix) with ESMTPSA id B196CB05BF; Sat, 24 Apr 2021 14:12:47 +0200 (CEST) To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> From: Florian Smeets Subject: Re: git: 5c11c5a36558 - main - pfctl: Move to DIOCADDRULENV Message-ID: <0f7e86c0-3592-0391-7e52-4e6d14bc1eb0@smeets.xyz> Date: Sat, 24 Apr 2021 14:12:46 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EM4iyuFHz25fd1hNjENIlvrZ7QW9LPekL" X-Rspamd-Queue-Id: 4FS96171rqz4sBW X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.10 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; HAS_ATTACHMENT(0.00)[]; DKIM_TRACE(0.00)[smeets.xyz:+]; DMARC_POLICY_ALLOW(-0.50)[smeets.xyz,reject]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[88.99.165.53:from]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:+,5:~]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_COUNT_FIVE(0.00)[5]; FREEFALL_USER(0.00)[flo]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,application/pgp-keys]; NEURAL_SPAM_SHORT(1.00)[1.000]; R_DKIM_ALLOW(-0.20)[smeets.xyz:s=dkim]; SPAMHAUS_ZRD(0.00)[88.99.165.53:from:127.0.2.255]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 12:12:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EM4iyuFHz25fd1hNjENIlvrZ7QW9LPekL Content-Type: multipart/mixed; boundary="w5rPKyeBzVGkAUFeGPoHy5uz8zY3eaduK"; protected-headers="v1" From: Florian Smeets To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <0f7e86c0-3592-0391-7e52-4e6d14bc1eb0@smeets.xyz> Subject: Re: git: 5c11c5a36558 - main - pfctl: Move to DIOCADDRULENV References: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> In-Reply-To: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> --w5rPKyeBzVGkAUFeGPoHy5uz8zY3eaduK Content-Type: multipart/mixed; boundary="------------C633B0317775A1E663539072" Content-Language: en-US This is a multi-part message in MIME format. --------------C633B0317775A1E663539072 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 10.04.21 11:16, Kristof Provost wrote: > The branch main has been updated by kp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5c11c5a3655842a176124ef2= 334fcdf830422c8a >=20 > commit 5c11c5a3655842a176124ef2334fcdf830422c8a > Author: Kristof Provost > AuthorDate: 2021-03-12 17:03:14 +0000 > Commit: Kristof Provost > CommitDate: 2021-04-10 09:16:01 +0000 >=20 > pfctl: Move to DIOCADDRULENV > =20 > Start using the new nvlist based ioctl to add rules. > =20 > MFC after: 4 weeks > Sponsored by: Rubicon Communications, LLC ("Netgate") > Differential Revision: https://reviews.freebsd.org/D29558 Hi Kristof, this commit breaks my previously working rule set. Using a pfctl from=20 before this commit works with a kernel from yesterdays sources. This is the smallest rule set I could come up with. It doesn't matter=20 whether I use macros in the list or not. The int_if stuff is only there=20 to not lock myself out of the system. It looks like lists with more than 5 IPv6 host or 6 v4 hosts don't work. int_if=3D"em0" set skip on $int_if # not working with pfctl after 5c11c5a3655842a176124ef2334fcdf830422c8a # each one of the rules below causes "pfctl: DIOCADDRULENV: Invalid=20 argument" on its own pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5,=20 fd01::6 } port ssh pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4,=20 192.168.0.4, 192.168.0.5, 192.168.0.6, 192.168.0.7 } port ssh # working fine with pfctl after 5c11c5a3655842a176124ef2334fcdf830422c8a pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5 }=20 port ssh pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4,=20 192.168.0.4, 192.168.0.5, 192.168.0.6 } port ssh Another interesting point is the following rules work with -o none, but=20 not with -o basic, which I guess points to list or maybe table handling? pass in proto tcp to 192.168.0.1 port ssh pass in proto tcp to 192.168.0.2 port ssh pass in proto tcp to 192.168.0.3 port ssh pass in proto tcp to 192.168.0.4 port ssh pass in proto tcp to 192.168.0.5 port ssh pass in proto tcp to 192.168.0.6 port ssh pass in proto tcp to 192.168.0.7 port ssh I think you should be able to reproduce this easily, if you need=20 anything else, please let me know. Thanks, Florian --------------C633B0317775A1E663539072-- --w5rPKyeBzVGkAUFeGPoHy5uz8zY3eaduK-- --EM4iyuFHz25fd1hNjENIlvrZ7QW9LPekL Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEE7LNouHkIv7aRTXJp71uk3NWp88AFAmCECz4FAwAAAAAACgkQ71uk3NWp88Bg wg/8DRpgTbVDu717PtvQfcLOr2StGyZakheznJ7SsUD9TVSSpL+IKtnhWxKZI9hMJRAPtsu4Rd/8 3efpFKpEb/Xuiug8Wvkn9F6c99Gvt6C8TcByBQrx06AUE0ByarhcABzd1hEp6doyaKapdJTIF5Y5 qR2SsSaPnGU0EP0FYUbbq5hc10QI0SfH/P9jubyPukPiulrvN2nCc0wnlNKxcsa6ynHxHNYbUB6t 3SL0SPuM57JCE238ee0ZFK1FCuDpFDnhqtD3TXKCWmuDeMVRF/6KWv1b3nT7MgToVDd/esBWYcLW PWAGRhymQF+0JA8c9ipbTn68REgun0SRyaryM3nmfWjZ2NTZojVmKT9sKmFkzdKHGuSiumhdlXiP 4D4C3ZwD5rHlh5Db3g2bIsAlO3KWtZ7wKBJfmqiapzlrPqQ+OR4U+wDHi9ZQ37J1PV4sxmRZO80C Qs+MmXLGBnhfRnMqOQP64/8mz9e7p1IIM7N3iFSr+5+tSIbHOTemOZc12L+Gotrwcu1NovBkvrL8 kFz4TisLj5UtLIZjvIi2cI/lVGV272AANHOGCakEBlOmzTpGe2oz+eCabDpYGWnrD/3kUwbf8KEs N8XgIqGU5qkTj0h8Ke64DCFcXxpAP9fIoMh4yL9eGZNhIhy/fYtQJGI3IQbSPJxc53QeN1HjO1Xv hgo= =deOG -----END PGP SIGNATURE----- --EM4iyuFHz25fd1hNjENIlvrZ7QW9LPekL-- From owner-dev-commits-src-main@freebsd.org Sat Apr 24 13:18:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36C685FF8F5; Sat, 24 Apr 2021 13:18:50 +0000 (UTC) (envelope-from kp@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 4FSBZ216zGz3Bs1; Sat, 24 Apr 2021 13:18:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id F298D29A4B; Sat, 24 Apr 2021 13:18:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id C16FF411BC; Sat, 24 Apr 2021 15:18:47 +0200 (CEST) From: "Kristof Provost" To: "Florian Smeets" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5c11c5a36558 - main - pfctl: Move to DIOCADDRULENV Date: Sat, 24 Apr 2021 15:18:47 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <1B2EBD56-08CE-4854-BB3D-F20314247E1C@FreeBSD.org> In-Reply-To: <0f7e86c0-3592-0391-7e52-4e6d14bc1eb0@smeets.xyz> References: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> <0f7e86c0-3592-0391-7e52-4e6d14bc1eb0@smeets.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 13:18:50 -0000 On 24 Apr 2021, at 14:12, Florian Smeets wrote: > On 10.04.21 11:16, Kristof Provost wrote: >> The branch main has been updated by kp: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3D5c11c5a3655842a176124ef2334f= cdf830422c8a >> >> commit 5c11c5a3655842a176124ef2334fcdf830422c8a >> Author: Kristof Provost >> AuthorDate: 2021-03-12 17:03:14 +0000 >> Commit: Kristof Provost >> CommitDate: 2021-04-10 09:16:01 +0000 >> >> pfctl: Move to DIOCADDRULENV >> Start using the new nvlist based ioctl to add rules. >> MFC after: 4 weeks >> Sponsored by: Rubicon Communications, LLC ("Netgate") >> Differential Revision: https://reviews.freebsd.org/D29558 > > Hi Kristof, > > this commit breaks my previously working rule set. Using a pfctl from = > before this commit works with a kernel from yesterdays sources. > > This is the smallest rule set I could come up with. It doesn't matter = > whether I use macros in the list or not. The int_if stuff is only = > there to not lock myself out of the system. > > It looks like lists with more than 5 IPv6 host or 6 v4 hosts don't = > work. > > int_if=3D"em0" > set skip on $int_if > > # not working with pfctl after = > 5c11c5a3655842a176124ef2334fcdf830422c8a > # each one of the rules below causes "pfctl: DIOCADDRULENV: Invalid = > argument" on its own > pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5, = > fd01::6 } port ssh > pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4, = > 192.168.0.4, 192.168.0.5, 192.168.0.6, 192.168.0.7 } port ssh > > # working fine with pfctl after = > 5c11c5a3655842a176124ef2334fcdf830422c8a > pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5 } = > port ssh > pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4, = > 192.168.0.4, 192.168.0.5, 192.168.0.6 } port ssh > > Another interesting point is the following rules work with -o none, = > but not with -o basic, which I guess points to list or maybe table = > handling? > > pass in proto tcp to 192.168.0.1 port ssh > pass in proto tcp to 192.168.0.2 port ssh > pass in proto tcp to 192.168.0.3 port ssh > pass in proto tcp to 192.168.0.4 port ssh > pass in proto tcp to 192.168.0.5 port ssh > pass in proto tcp to 192.168.0.6 port ssh > pass in proto tcp to 192.168.0.7 port ssh > > I think you should be able to reproduce this easily, if you need = > anything else, please let me know. > Yeah, I see what=E2=80=99s happening here. The optimiser creates an autom= atic = table, and the table name is longer than IFNAMSIZ. That=E2=80=99s fine, = because it=E2=80=99s stored in a union that has tblname, which I sufficie= ntly = long for that name. The problem is that the nvlist code unconditionally = reads the ifname as well, and the automatic name is longer than = IFNAMSIZ. It=E2=80=99s a simple matter of (a) cursing the old pf data structures fo= r = being awful and (b) only reading ifname (or tblname) for the appropriate = addr type. I=E2=80=99m testing a patch now. Best regards, Kristof From owner-dev-commits-src-main@freebsd.org Sat Apr 24 14:01:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F06D62180A; Sat, 24 Apr 2021 14:01:10 +0000 (UTC) (envelope-from kp@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 4FSCVt0SRWz3D4k; Sat, 24 Apr 2021 14:01:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id DB4D329DC6; Sat, 24 Apr 2021 14:01:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 610D33EDDD; Sat, 24 Apr 2021 16:01:08 +0200 (CEST) From: "Kristof Provost" To: "Florian Smeets" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5c11c5a36558 - main - pfctl: Move to DIOCADDRULENV Date: Sat, 24 Apr 2021 16:01:07 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <23A87E17-BB7C-4DB4-9C60-6F2106204E95@FreeBSD.org> In-Reply-To: <1B2EBD56-08CE-4854-BB3D-F20314247E1C@FreeBSD.org> References: <202104100916.13A9GJpP068955@gitrepo.freebsd.org> <0f7e86c0-3592-0391-7e52-4e6d14bc1eb0@smeets.xyz> <1B2EBD56-08CE-4854-BB3D-F20314247E1C@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 14:01:10 -0000 On 24 Apr 2021, at 15:18, Kristof Provost wrote: > On 24 Apr 2021, at 14:12, Florian Smeets wrote: >> On 10.04.21 11:16, Kristof Provost wrote: >>> The branch main has been updated by kp: >>> >>> URL: = >>> https://cgit.FreeBSD.org/src/commit/?id=3D5c11c5a3655842a176124ef2334= fcdf830422c8a >>> >>> commit 5c11c5a3655842a176124ef2334fcdf830422c8a >>> Author: Kristof Provost >>> AuthorDate: 2021-03-12 17:03:14 +0000 >>> Commit: Kristof Provost >>> CommitDate: 2021-04-10 09:16:01 +0000 >>> >>> pfctl: Move to DIOCADDRULENV >>> Start using the new nvlist based ioctl to add rules. >>> MFC after: 4 weeks >>> Sponsored by: Rubicon Communications, LLC ("Netgate") >>> Differential Revision: https://reviews.freebsd.org/D29558 >> >> Hi Kristof, >> >> this commit breaks my previously working rule set. Using a pfctl from = >> before this commit works with a kernel from yesterdays sources. >> >> This is the smallest rule set I could come up with. It doesn't matter = >> whether I use macros in the list or not. The int_if stuff is only = >> there to not lock myself out of the system. >> >> It looks like lists with more than 5 IPv6 host or 6 v4 hosts don't = >> work. >> >> int_if=3D"em0" >> set skip on $int_if >> >> # not working with pfctl after = >> 5c11c5a3655842a176124ef2334fcdf830422c8a >> # each one of the rules below causes "pfctl: DIOCADDRULENV: Invalid = >> argument" on its own >> pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5, = >> fd01::6 } port ssh >> pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4, = >> 192.168.0.4, 192.168.0.5, 192.168.0.6, 192.168.0.7 } port ssh >> >> # working fine with pfctl after = >> 5c11c5a3655842a176124ef2334fcdf830422c8a >> pass in proto tcp to { fd01::1, fd01::2, fd01::3, fd01::4, fd01::5 } = >> port ssh >> pass in proto tcp to { 192.168.0.1, 192.168.0.2, 192.168.0.4, = >> 192.168.0.4, 192.168.0.5, 192.168.0.6 } port ssh >> >> Another interesting point is the following rules work with -o none, = >> but not with -o basic, which I guess points to list or maybe table = >> handling? >> >> pass in proto tcp to 192.168.0.1 port ssh >> pass in proto tcp to 192.168.0.2 port ssh >> pass in proto tcp to 192.168.0.3 port ssh >> pass in proto tcp to 192.168.0.4 port ssh >> pass in proto tcp to 192.168.0.5 port ssh >> pass in proto tcp to 192.168.0.6 port ssh >> pass in proto tcp to 192.168.0.7 port ssh >> >> I think you should be able to reproduce this easily, if you need = >> anything else, please let me know. >> > Yeah, I see what=E2=80=99s happening here. The optimiser creates an = > automatic table, and the table name is longer than IFNAMSIZ. That=E2=80= =99s = > fine, because it=E2=80=99s stored in a union that has tblname, which I = > sufficiently long for that name. The problem is that the nvlist code = > unconditionally reads the ifname as well, and the automatic name is = > longer than IFNAMSIZ. > It=E2=80=99s a simple matter of (a) cursing the old pf data structures = for = > being awful and (b) only reading ifname (or tblname) for the = > appropriate addr type. > > I=E2=80=99m testing a patch now. > https://reviews.freebsd.org/D29962 Best regards, Kristof From owner-dev-commits-src-main@freebsd.org Sat Apr 24 19:02:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E1F562729E; Sat, 24 Apr 2021 19:02: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 4FSLC21nMvz3hdk; Sat, 24 Apr 2021 19:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 302AC25A6D; Sat, 24 Apr 2021 19:02: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 13OJ2stO048001; Sat, 24 Apr 2021 19:02:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OJ2sA2048000; Sat, 24 Apr 2021 19:02:54 GMT (envelope-from git) Date: Sat, 24 Apr 2021 19:02:54 GMT Message-Id: <202104241902.13OJ2sA2048000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: e68d76c054d2 - main - hkbd: Fix typo which disables keyboard input in kdb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e68d76c054d25490195a99a25329ddca1467244b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 19:02:54 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e68d76c054d25490195a99a25329ddca1467244b commit e68d76c054d25490195a99a25329ddca1467244b Author: Vladimir Kondratyev AuthorDate: 2021-04-24 18:49:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-24 19:01:14 +0000 hkbd: Fix typo which disables keyboard input in kdb Reported by: Greg V MFC after: 1 week --- sys/dev/hid/hkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 775ad677f4de..55eba6d321ea 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -917,7 +917,7 @@ hkbd_attach(device_t dev) /* interrupt handler will be called with hkbd mutex taken */ hidbus_set_lock(dev, &sc->sc_mtx); /* interrupt handler can be called during panic */ - hidbus_set_flags(dev, hidbus_get_flags(dev) & HIDBUS_FLAG_CAN_POLL); + hidbus_set_flags(dev, hidbus_get_flags(dev) | HIDBUS_FLAG_CAN_POLL); /* setup default keyboard maps */ From owner-dev-commits-src-main@freebsd.org Sat Apr 24 19:05:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B7CB627312; Sat, 24 Apr 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FSLFb0hQ8z3hfx; Sat, 24 Apr 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0646125A6E; Sat, 24 Apr 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13OJ56xO048259; Sat, 24 Apr 2021 19:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OJ56Pi048258; Sat, 24 Apr 2021 19:05:06 GMT (envelope-from git) Date: Sat, 24 Apr 2021 19:05:06 GMT Message-Id: <202104241905.13OJ56Pi048258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Watson Subject: git: af14713d49fd - main - Support run-time configuration of the PIPE_MINDIRECT threshold. PIPE_MINDIRECT determines at what (blocking) write size one-copy optimizations are applied in pipe(2) I/O. That threshold hasn't been tuned since the 1990s when this code was originally committed, and allowing run-time reconfiguration will make it easier to assess whether contemporary microarchitectures would prefer a different threshold. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rwatson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af14713d49fdb30c84969588f6e5cb66d65dc4c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 19:05:07 -0000 The branch main has been updated by rwatson: URL: https://cgit.FreeBSD.org/src/commit/?id=af14713d49fdb30c84969588f6e5cb66d65dc4c4 commit af14713d49fdb30c84969588f6e5cb66d65dc4c4 Author: Robert Watson AuthorDate: 2021-01-02 16:42:28 +0000 Commit: Robert Watson CommitDate: 2021-04-24 19:04:28 +0000 Support run-time configuration of the PIPE_MINDIRECT threshold. PIPE_MINDIRECT determines at what (blocking) write size one-copy optimizations are applied in pipe(2) I/O. That threshold hasn't been tuned since the 1990s when this code was originally committed, and allowing run-time reconfiguration will make it easier to assess whether contemporary microarchitectures would prefer a different threshold. (On our local RPi4 baords, the 8k default would ideally be at least 32k, but it's not clear how generalizable that observation is.) MFC after: 3 weeks Reviewers: jrtc27, arichardson Differential Revision: https://reviews.freebsd.org/D29819 --- sys/kern/sys_pipe.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 558337794950..fee9d95e179c 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -209,6 +209,7 @@ static int pipefragretry; static int pipeallocfail; static int piperesizefail; static int piperesizeallowed = 1; +static long pipe_mindirect = PIPE_MINDIRECT; SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &maxpipekva, 0, "Pipe KVA limit"); @@ -263,6 +264,29 @@ pipeinit(void *dummy __unused) KASSERT(pipedev_ino > 0, ("pipe dev inode not initialized")); } +static int +sysctl_handle_pipe_mindirect(SYSCTL_HANDLER_ARGS) +{ + int error = 0; + long tmp_pipe_mindirect = pipe_mindirect; + + error = sysctl_handle_long(oidp, &tmp_pipe_mindirect, arg2, req); + if (error != 0 || req->newptr == NULL) + return (error); + + /* + * Don't allow pipe_mindirect to be set so low that we violate + * atomicity requirements. + */ + if (tmp_pipe_mindirect <= PIPE_BUF) + return (EINVAL); + pipe_mindirect = tmp_pipe_mindirect; + return (0); +} +SYSCTL_OID(_kern_ipc, OID_AUTO, pipe_mindirect, CTLTYPE_LONG | CTLFLAG_RW, + &pipe_mindirect, 0, sysctl_handle_pipe_mindirect, "L", + "Minimum write size triggering VM optimization"); + static int pipe_zone_ctor(void *mem, int size, void *arg, int flags) { @@ -1140,8 +1164,8 @@ pipe_write(struct file *fp, struct uio *uio, struct ucred *active_cred, * away on us. */ if (uio->uio_segflg == UIO_USERSPACE && - uio->uio_iov->iov_len >= PIPE_MINDIRECT && - wpipe->pipe_buffer.size >= PIPE_MINDIRECT && + uio->uio_iov->iov_len >= pipe_mindirect && + wpipe->pipe_buffer.size >= pipe_mindirect && (fp->f_flag & FNONBLOCK) == 0) { error = pipe_direct_write(wpipe, uio); if (error != 0) From owner-dev-commits-src-main@freebsd.org Sat Apr 24 20:40:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D0005E066C; Sat, 24 Apr 2021 20:40: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 4FSNMz2FKwz3mLT; Sat, 24 Apr 2021 20:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FF6127014; Sat, 24 Apr 2021 20:40: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 13OKelHh076184; Sat, 24 Apr 2021 20:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OKel5J076183; Sat, 24 Apr 2021 20:40:47 GMT (envelope-from git) Date: Sat, 24 Apr 2021 20:40:47 GMT Message-Id: <202104242040.13OKel5J076183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 6096814d3134 - main - tcp: fix man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6096814d3134234d48936f557d431a793e35d8b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 20:40:47 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6096814d3134234d48936f557d431a793e35d8b3 commit 6096814d3134234d48936f557d431a793e35d8b3 Author: Michael Tuexen AuthorDate: 2021-04-24 20:31:36 +0000 Commit: Michael Tuexen CommitDate: 2021-04-24 20:40:34 +0000 tcp: fix man page Reviewed by: gbe, rscheff MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D29963 --- share/man/man4/tcp.4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 873cfe4b822a..d06630aa8d44 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 18, 2021 +.Dd April 24, 2021 .Dt TCP 4 .Os .Sh NAME @@ -690,6 +690,7 @@ for the connection for some defined period of time. Disable the host cache. .It 1 Enable the host cache. (default) +.El .It Va hostcache.purgenow Immediately purge all entries once set to any value. Setting this to 2 will also reseed the hash salt. @@ -704,6 +705,7 @@ Do not purge all entries when pruning the host cache. (default) Purge all entries when doing the next pruning. .It 2 Purge all entries, and also reseed the hash salt. +.El .It Va hostcache.prune Time in seconds between pruning expired host cache entries. Defaults to 300 (5 minutes). From owner-dev-commits-src-main@freebsd.org Sat Apr 24 23:03:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 186345E373B; Sat, 24 Apr 2021 23:03: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 4FSRY971wKz3sHf; Sat, 24 Apr 2021 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3AE4E32; Sat, 24 Apr 2021 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13ON3vH1066287; Sat, 24 Apr 2021 23:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ON3vJK066286; Sat, 24 Apr 2021 23:03:57 GMT (envelope-from git) Date: Sat, 24 Apr 2021 23:03:57 GMT Message-Id: <202104242303.13ON3vJK066286@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: bddae5c8a64d - main - Improve debugging output on routing tests failure. 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: bddae5c8a64dc6b292198945cbe676bb2158d438 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 23:03:58 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=bddae5c8a64dc6b292198945cbe676bb2158d438 commit bddae5c8a64dc6b292198945cbe676bb2158d438 Author: Alexander V. Chernikov AuthorDate: 2021-04-23 21:28:38 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-24 22:41:27 +0000 Improve debugging output on routing tests failure. Most of the routing tests create per-test VNET, making it harder to repeat the failure with CLI tools. Provide an additional route/nexthop data on failure. Differential Revision: https://reviews.freebsd.org/D29957 Reviewed by: kp MFC after: 2 weeks --- tests/sys/net/routing/rtsock_print.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/sys/net/routing/rtsock_print.h b/tests/sys/net/routing/rtsock_print.h index b44fcca25053..20bb1c51bc33 100644 --- a/tests/sys/net/routing/rtsock_print.h +++ b/tests/sys/net/routing/rtsock_print.h @@ -40,7 +40,10 @@ #define RTSOCK_ATF_REQUIRE_MSG(_rtm, _cond, _fmt, ...) do { \ if (!(_cond)) { \ printf("-- CONDITION FAILED, rtm dump --\n\n");\ - rtsock_print_message(_rtm); \ + rtsock_print_message(_rtm); \ + rtsock_print_table(AF_INET); \ + rtsock_print_table(AF_INET6); \ + printf("===================================\n");\ } \ ATF_REQUIRE_MSG(_cond, _fmt, ##__VA_ARGS__); \ } while (0); @@ -381,4 +384,31 @@ rtsock_print_message(struct rt_msghdr *rtm) } } +static void +print_command(char *cmd) +{ + char line[1024]; + + FILE *fp = popen(cmd, "r"); + if (fp != NULL) { + while (fgets(line, sizeof(line), fp) != NULL) + printf("%s", line); + pclose(fp); + } +} + +void +rtsock_print_table(int family) +{ + char cmdbuf[128]; + char *key = (family == AF_INET) ? "4" : "6"; + + snprintf(cmdbuf, sizeof(cmdbuf), "/usr/bin/netstat -%srnW", key); + printf("==== %s ===\n", cmdbuf); + print_command(cmdbuf); + snprintf(cmdbuf, sizeof(cmdbuf), "/usr/bin/netstat -%sonW", key); + printf("==== %s ===\n", cmdbuf); + print_command(cmdbuf); +} + #endif From owner-dev-commits-src-main@freebsd.org Sat Apr 24 23:03:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57B175E3C3A; Sat, 24 Apr 2021 23:03: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 4FSRYC1bDNz3sbh; Sat, 24 Apr 2021 23:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C0451105; Sat, 24 Apr 2021 23:03: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 13ON3xIU066308; Sat, 24 Apr 2021 23:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ON3w5l066307; Sat, 24 Apr 2021 23:03:58 GMT (envelope-from git) Date: Sat, 24 Apr 2021 23:03:58 GMT Message-Id: <202104242303.13ON3w5l066307@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: 5d1403a79a3e - main - [rtsock] Enforce netmask/RTF_HOST consistency. 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: 5d1403a79a3e56403fb63c062252a23fce81e5f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 23:03:59 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1403a79a3e56403fb63c062252a23fce81e5f1 commit 5d1403a79a3e56403fb63c062252a23fce81e5f1 Author: Alexander V. Chernikov AuthorDate: 2021-04-23 21:53:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-24 22:41:27 +0000 [rtsock] Enforce netmask/RTF_HOST consistency. Traditionally we had 2 sources of information whether the added/delete route request targets network or a host route: netmask (RTA_NETMASK) and RTF_HOST flag. The former one is tricky: netmask can be empty or can explicitly specify the host netmask. Parsing netmask sockaddr requires per-family parsing and that's what rtsock code traditionally avoided. As a result, consistency was not enforced and it was possible to specify network with the RTF_HOST flag and vice versa. Continue normalization efforts from D29826 and D29826 and ensure that RTF_HOST flag always reflects host/network data from netmask field. Differential Revision: https://reviews.freebsd.org/D29958 MFC after: 2 days --- sys/net/rtsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index b7a7e5170c74..fae15fdf4be6 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1503,6 +1503,7 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet(mask_sa, mask); info->rti_info[RTAX_NETMASK] = (struct sockaddr *)mask_sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info); @@ -1563,6 +1564,7 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet6((struct sockaddr_in6 *)sa, &mask, 0); info->rti_info[RTAX_NETMASK] = sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info); From owner-dev-commits-src-main@freebsd.org Sat Apr 24 23:25:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43D385E402B; Sat, 24 Apr 2021 23:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FSS1x1ScJz3tGf; Sat, 24 Apr 2021 23:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24EF814CA; Sat, 24 Apr 2021 23:25: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 13ONPPZL092061; Sat, 24 Apr 2021 23:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ONPPAn092060; Sat, 24 Apr 2021 23:25:25 GMT (envelope-from git) Date: Sat, 24 Apr 2021 23:25:25 GMT Message-Id: <202104242325.13ONPPAn092060@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: 6993187a8c30 - main - Add FIB_ALGO to GENERIC on amd64/arm64. 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: 6993187a8c30e83a408aad631a8d8629d8273c9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 23:25:25 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=6993187a8c30e83a408aad631a8d8629d8273c9d commit 6993187a8c30e83a408aad631a8d8629d8273c9d Author: Alexander V. Chernikov AuthorDate: 2021-04-24 23:05:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-24 23:22:58 +0000 Add FIB_ALGO to GENERIC on amd64/arm64. Option `FIB_ALGO` gates new modular fib lookup functionality, enabling more performant routing table lookups and improving control plane convergence under the load. Detailed feature description is available in D27401. Reviewed By: olivier, gnn Differential Revision: https://reviews.freebsd.org/D28434 --- sys/amd64/conf/GENERIC | 1 + sys/arm64/conf/GENERIC | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index f5f4bdf49c5f..bb7299a60382 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -32,6 +32,7 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options ROUTE_MPATH # Multipath routing support +options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging options TCP_HHOOK # hhook(9) framework for TCP diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index cf137417fbc5..430ba8a4a45f 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -32,6 +32,7 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options ROUTE_MPATH # Multipath routing support +options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_HHOOK # hhook(9) framework for TCP options TCP_RFC7413 # TCP Fast Open From owner-dev-commits-src-main@freebsd.org Sun Apr 25 06:45:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB36C5F7687; Sun, 25 Apr 2021 06:45: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 4FSdpF3Trhz4mJt; Sun, 25 Apr 2021 06:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A4B674F1; Sun, 25 Apr 2021 06:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13P6jvQ7074300; Sun, 25 Apr 2021 06:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13P6jvNG074299; Sun, 25 Apr 2021 06:45:57 GMT (envelope-from git) Date: Sun, 25 Apr 2021 06:45:57 GMT Message-Id: <202104250645.13P6jvNG074299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 8ea901351249 - main - Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ea9013512494c9f035afa1ffa1e199b44c7904f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 06:45:58 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea9013512494c9f035afa1ffa1e199b44c7904f commit 8ea9013512494c9f035afa1ffa1e199b44c7904f Merge: 6993187a8c30 bd136720030e Author: Stefan Eßer AuthorDate: 2021-04-25 06:42:31 +0000 Commit: Stefan Eßer CommitDate: 2021-04-25 06:42:31 +0000 Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94' usr.bin/bc: update to version 4.0.1 This update adds a flush() of the output buffer to the bc print command. contrib/bc/.gitattributes | 3 +++ contrib/bc/.gitignore | 4 ++++ contrib/bc/NEWS.md | 5 +++++ contrib/bc/README.md | 4 ++++ contrib/bc/include/version.h | 2 +- contrib/bc/src/program.c | 1 + 6 files changed, 18 insertions(+), 1 deletion(-) diff --cc contrib/bc/.gitattributes index 000000000000,000000000000..22d6e60bce68 new file mode 100644 --- /dev/null +++ b/contrib/bc/.gitattributes @@@ -1,0 -1,0 +1,3 @@@ ++*.vcxproj eol=crlf ++*.vcxproj.filters eol=crlf ++*.sln eol= crlf diff --cc contrib/bc/.gitignore index 5c2bbae866c0,000000000000..b131d5813764 mode 100644,000000..100644 --- a/contrib/bc/.gitignore +++ b/contrib/bc/.gitignore @@@ -1,70 -1,0 +1,74 @@@ +*.config +*.creator +*.files +*.includes +*.creator.user* +*.cflags +*.cxxflags +bin/*bc +bin/*bc.exe +bin/*dc +bin/*dc.exe +bin/bcl +bc.old +*.o +*.a +.log_*.txt +.test.txt +.math.txt +.results.txt +.ops.txt +manuals/bc.1 +manuals/bc.1.ronn +manuals/bc.1.md +manuals/dc.1 +manuals/dc.1.ronn +manuals/dc.1.md +gen/strgen +lib.c +lib2.c +lib3.c +bc_help.c +dc_help.c +config.mak +timeconst.bc +Makefile + +tests/fuzzing/bc_outputs1/* +tests/fuzzing/bc_outputs2/* +tests/fuzzing/bc_outputs3/* +tests/fuzzing/dc_outputs/* +tests/bc_outputs/* +tests/dc_outputs/* + +.gdb_history + +# Ignore the generated test files +parse.txt +parse_results.txt +print.txt +print_results.txt +bessel.txt +bessel_results.txt +prime.txt +stream.txt +tests/bc/scripts/add.txt +tests/bc/scripts/divide.txt +tests/bc/scripts/multiply.txt +tests/bc/scripts/subtract.txt +perf.data +perf.data.old +*.gcda +*.gcno +*.gcov +*.html +*.profraw + +core.* + +cscope*.out +tags ++ ++*.vcxproj.user ++Debug/* ++Release/* diff --cc contrib/bc/README.md index 852c8956a73d,000000000000..f0dcecf15bde mode 100644,000000..100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@@ -1,407 -1,0 +1,411 @@@ +# `bc` + +[![Coverity Scan Build Status][17]][18] + +***WARNING: This project has moved to [https://git.yzena.com/][20] for [these +reasons][21], though GitHub will remain a mirror.*** + +This is an implementation of the [POSIX `bc` calculator][12] that implements +[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD +flavor of `bc`. + +For more information, see this `bc`'s full manual. + +This `bc` also includes an implementation of `dc` in the same binary, accessible +via a symbolic link, which implements all FreeBSD and GNU extensions. (If a +standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The +`!` command is omitted; I believe this poses security concerns and that such +functionality is unnecessary. + +For more information, see the `dc`'s full manual. + ++This `bc` also provides `bc`'s math as a library with C bindings, called `bcl`. ++ ++For more information, see the full manual for `bcl`. ++ +This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD +2-clause License. Full license text may be found in the [`LICENSE.md`][4] file. + +## Prerequisites + +This `bc` only requires either: + +1. Windows 10 or later, or +2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with + the XSI (X/Open System Interfaces) option group. + +Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any +POSIX and XSI-compatible system will have everything needed. + +POSIX-compatible systems that are known to work: + +* Linux +* FreeBSD +* OpenBSD +* NetBSD +* Mac OSX +* Solaris* (as long as the Solaris version supports POSIX 2008) +* AIX +* HP-UX* (except for history) + +In addition, there is compatibility code to make this `bc` work on Windows. + +Please submit bug reports if this `bc` does not build out of the box on any +system. + +## Build + +### Windows + +There is no guarantee that this `bc` will work on any version of Windows earlier +than Windows 10 (I cannot test on earlier versions), but it is guaranteed to +work on Windows 10 at least. + +Also, if building with MSBuild, the MSBuild bundled with Visual Studio is +required. + +**Note**: Unlike the POSIX-compatible platforms, only one build configuration is +supported on Windows: extra math and prompt enabled, history and NLS (locale +support) disabled, with both calculators built. + +#### `bc` + +To build `bc`, you can open the `bc.sln` file in Visual Studio, select the +configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bc.sln +``` + +where `` is either one of `Debug` or `Release`. + +#### `bcl` (Library) + +To build the library, you can open the `bcl.sln` file in Visual Studio, select +the configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bcl.sln +``` + +where `` is either one of `Debug` or `Release`. + +### POSIX-Compatible Systems + +This `bc` should build unmodified on any POSIX-compliant system or on Windows +starting with Windows 10 (though earlier versions may work). + +For more complex build requirements than the ones below, see the +[build manual][5]. + +On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as +`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and +`Release/bc/dc.exe`. + +**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked. +Patches are welcome for a way to do that. + +#### Default + +For the default build with optimization, use the following commands in the root +directory: + +``` +./configure.sh -O3 +make +``` + +#### One Calculator + +To only build `bc`, use the following commands: + +``` +./configure.sh --disable-dc +make +``` + +To only build `dc`, use the following commands: + +``` +./configure.sh --disable-bc +make +``` + +#### Debug + +For debug builds, use the following commands in the root directory: + +``` +./configure.sh -g +make +``` + +#### Install + +To install, use the following command: + +``` +make install +``` + +By default, `bc` and `dc` will be installed in `/usr/local`. For installing in +other locations, use the `PREFIX` environment variable when running +`configure.sh` or pass the `--prefix=` option to `configure.sh`. See the +[build manual][5], or run `./configure.sh --help`, for more details. + +#### Library + +This `bc` does provide a way to build a math library with C bindings. This is +done by the `-a` or `--library` options to `configure.sh`: + +``` +./configure.sh -a +``` + +When building the library, the executables are not built. For more information, +see the [build manual][5]. + +The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the +library is installed. + +The library is built as `bin/libbcl.a` on POSIX-compatible systems or as +`Release/bcl/bcl.lib` on Windows. + +#### Package and Distro Maintainers + +##### Recommended Compiler + +When I ran benchmarks with my `bc` compiled under `clang`, it performed much +better than when compiled under `gcc`. I recommend compiling this `bc` with +`clang`. + +I also recommend building this `bc` with C11 if you can because `bc` will detect +a C11 compiler and add `_Noreturn` to any relevant function(s). + +##### Recommended Optimizations + +I wrote this `bc` with Separation of Concerns, which means that there are many +small functions that could be inlined. However, they are often called across +file boundaries, and the default optimizer can only look at the current file, +which means that they are not inlined. + +Thus, because of the way this `bc` is built, it will automatically be slower +than other `bc` implementations when running scripts with no math. (My `bc`'s +math is *much* faster, so any non-trivial script should run faster in my `bc`.) + +Some, or all, of the difference can be made up with the right optimizations. The +optimizations I recommend are: + +1. `-O3` +2. `-flto` (link-time optimization) + +in that order. + +Link-time optimization, in particular, speeds up the `bc` a lot. This is because +when link-time optimization is turned on, the optimizer can look across files +and inline *much* more heavily. + +However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this +`bc`'s performance, at least when building with link-time optimization. See the +[benchmarks][19] for more details. + +##### Stripping Binaries + +By default, non-debug binaries are stripped, but stripping can be disabled with +the `-T` option to `configure.sh`. + +##### Using This `bc` as an Alternative + +If this `bc` is packaged as an alternative to an already existing `bc` package, +it is possible to rename it in the build to prevent name collision. To prepend +to the name, just run the following: + +``` +EXECPREFIX= ./configure.sh +``` + +To append to the name, just run the following: + +``` +EXECSUFFIX= ./configure.sh +``` + +If a package maintainer wishes to add both a prefix and a suffix, that is +allowed. + +**Note**: The suggested name (and package name) when `bc` is not available is +`bc-gh`. + +##### Karatsuba Number + +Package and distro maintainers have one tool at their disposal to build this +`bc` in the optimal configuration: `karatsuba.py`. + +This script is not a compile-time or runtime prerequisite; it is for package and +distro maintainers to run once when a package is being created. It finds the +optimal Karatsuba number (see the [algorithms manual][7] for more information) +for the machine that it is running on. + +The easiest way to run this script is with `make karatsuba`. + +If desired, maintainers can also skip running this script because there is a +sane default for the Karatsuba number. + +## Status + +This `bc` is robust. + +It is well-tested, fuzzed, and fully standards-compliant (though not certified) +with POSIX `bc`. The math has been tested with 40+ million random problems, so +it is as correct as I can make it. + +This `bc` can be used as a drop-in replacement for any existing `bc`. This `bc` +is also compatible with MinGW toolchains, though history is not supported on +Windows. + +In addition, this `bc` is considered complete; i.e., there will be no more +releases with additional features. However, it *is* actively maintained, so if +any bugs are found, they will be fixed in new releases. Also, additional +translations will also be added as they are provided. + +## Comparison to GNU `bc` + +This `bc` compares favorably to GNU `bc`. + +* This `bc` builds natively on Windows. +* It has more extensions, which make this `bc` more useful for scripting. +* This `bc` is a bit more POSIX compliant. +* It has a much less buggy parser. The GNU `bc` will give parse errors for what + is actually valid `bc` code, or should be. For example, putting an `else` on + a new line after a brace can cause GNU `bc` to give a parse error. +* This `bc` has fewer crashes. +* GNU `bc` calculates the wrong number of significant digits for `length(x)`. +* GNU `bc` will sometimes print numbers incorrectly. For example, when running + it on the file `tests/bc/power.txt` in this repo, GNU `bc` gets all the right + answers, but it fails to wrap the numbers at the proper place when outputting + to a file. +* This `bc` is faster. (See [Performance](#performance).) + +### Performance + +Because this `bc` packs more than `1` decimal digit per hardware integer, this +`bc` is faster than GNU `bc` and can be *much* faster. Full benchmarks can be +found at [manuals/benchmarks.md][19]. + +There is one instance where this `bc` is slower: if scripts are light on math. +This is because this `bc`'s intepreter is slightly slower than GNU `bc`, but +that is because it is more robust. See the [benchmarks][19]. + +## Algorithms + +To see what algorithms this `bc` uses, see the [algorithms manual][7]. + +## Locales + +Currently, there is no locale support on Windows. + +Additionally, this `bc` only has support for English (and US English), French, +German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. +Patches are welcome for translations; use the existing `*.msg` files in +`locales/` as a starting point. + +In addition, patches for improvements are welcome; the last two messages in +Portuguese were made with Google Translate, and the Dutch, Polish, Russian, +Japanese, and Chinese locales were all generated with [DeepL][22]. + +The message files provided assume that locales apply to all regions where a +language is used, but this might not be true for, e.g., `fr_CA` and `fr_CH`. +Any corrections or a confirmation that the current texts are acceptable for +those regions would be appreciated, too. + +## Other Projects + +Other projects based on this bc are: + +* [busybox `bc`][8]. The busybox maintainers have made their own changes, so any + bugs in the busybox `bc` should be reported to them. + +* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the + toybox `bc` should be reported there. + +* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better + to [report bugs there][24], as well as [submit patches][25], and the + maintainers of the package will contact me if necessary. + +## Language + +This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows +compatibility code. + +## Commit Messages + +This `bc` uses the commit message guidelines laid out in [this blog post][10]. + +## Semantic Versioning + +This `bc` uses [semantic versioning][11]. + +## Contents + +Items labeled with `(maintainer use only)` are not included in release source +tarballs. + +Files: + + .gitignore The git ignore file (maintainer use only). + .gitattributes The git attributes file (maintainer use only). + bc.sln The Visual Studio solution file for bc. + bc.vcxproj The Visual Studio project file for bc. + bc.vcxproj.filters The Visual Studio filters file for bc. + bcl.sln The Visual Studio solution file for bcl. + bcl.vcxproj The Visual Studio project file for bcl. + bcl.vcxproj.filters The Visual Studio filters file for bcl. + configure A symlink to configure.sh to make packaging easier. + configure.sh The configure script. + functions.sh A script with functions used by other scripts. + install.sh Install script. + karatsuba.py Script to find the optimal Karatsuba number. + LICENSE.md A Markdown form of the BSD 2-clause License. + link.sh A script to link dc to bc. + locale_install.sh A script to install locales, if desired. + locale_uninstall.sh A script to uninstall locales. + Makefile.in The Makefile template. + manpage.sh Script to generate man pages from markdown files + (maintainer use only). + NOTICE.md List of contributors and copyright owners. + RELEASE.md A checklist for making a release (maintainer use only). + release.sh A script to test for release (maintainer use only). + safe-install.sh Safe install script from musl libc. + +Folders: + + gen The bc math library, help texts, and code to generate C source. + include All header files. + locales Locale files, in .msg format. Patches welcome for translations. + manuals Manuals for both programs. + src All source code. + tests All tests. + +[1]: https://www.gnu.org/software/bc/ +[4]: ./LICENSE.md +[5]: ./manuals/build.md +[7]: ./manuals/algorithms.md +[8]: https://git.busybox.net/busybox/tree/miscutils/bc.c +[9]: https://github.com/landley/toybox/blob/master/toys/pending/bc.c +[10]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[11]: http://semver.org/ +[12]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html +[17]: https://img.shields.io/coverity/scan/16609.svg +[18]: https://scan.coverity.com/projects/gavinhoward-bc +[19]: ./manuals/benchmarks.md +[20]: https://git.yzena.com/gavin/bc +[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ +[22]: https://www.deepl.com/translator +[23]: https://cgit.freebsd.org/src/tree/contrib/bc +[24]: https://bugs.freebsd.org/ +[25]: https://reviews.freebsd.org/ +[26]: ./manuals/bcl.3.md From owner-dev-commits-src-main@freebsd.org Sun Apr 25 08:19:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8416D5F9CC9; Sun, 25 Apr 2021 08:19: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 4FSgsf3KzMz4rBf; Sun, 25 Apr 2021 08:19:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6525610DA1; Sun, 25 Apr 2021 08:19: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 13P8J2HG096165; Sun, 25 Apr 2021 08:19:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13P8J2xU096164; Sun, 25 Apr 2021 08:19:02 GMT (envelope-from git) Date: Sun, 25 Apr 2021 08:19:02 GMT Message-Id: <202104250819.13P8J2xU096164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 6409e594272f - main - Fix build with gcc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6409e594272f66ce3896706ac705bbd465ce233e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 08:19:02 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=6409e594272f66ce3896706ac705bbd465ce233e commit 6409e594272f66ce3896706ac705bbd465ce233e Author: Stefan Eßer AuthorDate: 2021-04-25 08:15:17 +0000 Commit: Stefan Eßer CommitDate: 2021-04-25 08:15:17 +0000 Fix build with gcc Correctly declare function without arguments as f(void) instead of f(). --- sys/net/route/fib_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 91565d727a9c..cd7abd282728 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -365,7 +365,7 @@ fib_error_clear_flm(struct fib_lookup_module *flm) * Clears all errors in current VNET. */ static void -fib_error_clear() +fib_error_clear(void) { struct fib_error *fe, *fe_tmp; From owner-dev-commits-src-main@freebsd.org Sun Apr 25 08:45:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C74325FA2FF; Sun, 25 Apr 2021 08:45: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 4FShSB5GzKz4sgv; Sun, 25 Apr 2021 08:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A85A01115D; Sun, 25 Apr 2021 08:45: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 13P8jUgo035509; Sun, 25 Apr 2021 08:45:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13P8jUtM035508; Sun, 25 Apr 2021 08:45:30 GMT (envelope-from git) Date: Sun, 25 Apr 2021 08:45:30 GMT Message-Id: <202104250845.13P8jUtM035508@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: a81e2e7890c2 - main - Make gcc happy by initializing error in rib_handle_ifaddr_info(). 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: a81e2e7890c2fce2a74dbb859e6855e0414a6ea1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 08:45:30 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a81e2e7890c2fce2a74dbb859e6855e0414a6ea1 commit a81e2e7890c2fce2a74dbb859e6855e0414a6ea1 Author: Alexander V. Chernikov AuthorDate: 2021-04-25 08:44:20 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-25 08:44:59 +0000 Make gcc happy by initializing error in rib_handle_ifaddr_info(). --- sys/net/route/route_ifaddrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/route_ifaddrs.c b/sys/net/route/route_ifaddrs.c index e6d97f3c74f0..15ee13201059 100644 --- a/sys/net/route/route_ifaddrs.c +++ b/sys/net/route/route_ifaddrs.c @@ -100,7 +100,7 @@ rib_handle_ifaddr_one(uint32_t fibnum, int cmd, struct rt_addrinfo *info) int rib_handle_ifaddr_info(uint32_t fibnum, int cmd, struct rt_addrinfo *info) { - int error, last_error = 0; + int error = 0, last_error = 0; bool didwork = false; if (V_rt_add_addr_allfibs == 0) { From owner-dev-commits-src-main@freebsd.org Sun Apr 25 08:58:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5BCA5FAD5C; Sun, 25 Apr 2021 08:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FShl55cWgz4smf; Sun, 25 Apr 2021 08:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B38371144E; Sun, 25 Apr 2021 08:58: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 13P8wPZJ048659; Sun, 25 Apr 2021 08:58:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13P8wPl6048658; Sun, 25 Apr 2021 08:58:25 GMT (envelope-from git) Date: Sun, 25 Apr 2021 08:58:25 GMT Message-Id: <202104250858.13P8wPl6048658@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: c23385612da5 - main - [fib algo] Do not print algo attach/detach message on boot 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: c23385612da5dd3195a9b73bfb22bd969dbd26c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 08:58:25 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c23385612da5dd3195a9b73bfb22bd969dbd26c2 commit c23385612da5dd3195a9b73bfb22bd969dbd26c2 Author: Alexander V. Chernikov AuthorDate: 2021-04-25 08:51:57 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-25 08:58:06 +0000 [fib algo] Do not print algo attach/detach message on boot MFC after: 1 day --- sys/net/route/fib_algo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index cd7abd282728..43db482d73da 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -239,7 +239,9 @@ SYSCTL_INT(_net_route_algo, OID_AUTO, debug_level, CTLFLAG_RW | CTLFLAG_RWTUN, #endif #define _PASS_MSG(_l) (flm_debug_level >= (_l)) -#define ALGO_PRINTF(_fmt, ...) printf("[fib_algo] %s: " _fmt "\n", __func__, ##__VA_ARGS__) +#define ALGO_PRINTF(_l, _fmt, ...) if (_PASS_MSG(_l)) { \ + printf("[fib_algo] %s: " _fmt "\n", __func__, ##__VA_ARGS__); \ +} #define _ALGO_PRINTF(_fib, _fam, _aname, _gen, _func, _fmt, ...) \ printf("[fib_algo] %s.%u (%s#%u) %s: " _fmt "\n",\ print_family(_fam), _fib, _aname, _gen, _func, ## __VA_ARGS__) @@ -1971,7 +1973,7 @@ fib_module_register(struct fib_lookup_module *flm) { FIB_MOD_LOCK(); - ALGO_PRINTF("attaching %s to %s", flm->flm_name, + ALGO_PRINTF(LOG_INFO, "attaching %s to %s", flm->flm_name, print_family(flm->flm_family)); TAILQ_INSERT_TAIL(&all_algo_list, flm, entries); FIB_MOD_UNLOCK(); @@ -1995,7 +1997,7 @@ fib_module_unregister(struct fib_lookup_module *flm) return (EBUSY); } fib_error_clear_flm(flm); - ALGO_PRINTF("detaching %s from %s", flm->flm_name, + ALGO_PRINTF(LOG_INFO, "detaching %s from %s", flm->flm_name, print_family(flm->flm_family)); TAILQ_REMOVE(&all_algo_list, flm, entries); FIB_MOD_UNLOCK(); From owner-dev-commits-src-main@freebsd.org Sun Apr 25 11:29:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C03B5FE229; Sun, 25 Apr 2021 11:29: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 4FSm5f441Rz3GpK; Sun, 25 Apr 2021 11:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EB7F13786; Sun, 25 Apr 2021 11:29: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 13PBTgiS046712; Sun, 25 Apr 2021 11:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PBTgbx046711; Sun, 25 Apr 2021 11:29:42 GMT (envelope-from git) Date: Sun, 25 Apr 2021 11:29:42 GMT Message-Id: <202104251129.13PBTgbx046711@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: 67372fb3e06e - main - Fix NOINET[6] build after enabling FIB_ALGO in GENERIC. 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: 67372fb3e06ebaccfe7c093aa78009d161fa58e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 11:29:42 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=67372fb3e06ebaccfe7c093aa78009d161fa58e6 commit 67372fb3e06ebaccfe7c093aa78009d161fa58e6 Author: Alexander V. Chernikov AuthorDate: 2021-04-21 01:45:49 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-21 01:49:18 +0000 Fix NOINET[6] build after enabling FIB_ALGO in GENERIC. Submitted by: jbeich PR: 255389 --- sys/net/route/fib_algo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 43db482d73da..83fff1ec43e0 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -706,12 +706,16 @@ fill_change_entry(struct fib_data *fd, struct fib_change_entry *ce, struct rib_c int plen = 0; switch (fd->fd_family) { +#ifdef INET case AF_INET: rt_get_inet_prefix_plen(rc->rc_rt, &ce->addr4, &plen, &ce->scopeid); break; +#endif +#ifdef INET6 case AF_INET6: rt_get_inet6_prefix_plen(rc->rc_rt, &ce->addr6, &plen, &ce->scopeid); break; +#endif } ce->plen = plen; From owner-dev-commits-src-main@freebsd.org Sun Apr 25 12:43:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC7146216EC; Sun, 25 Apr 2021 12:43: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 4FSnkX4rYHz3LkG; Sun, 25 Apr 2021 12:43:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9904C14817; Sun, 25 Apr 2021 12:43: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 13PChGrd052758; Sun, 25 Apr 2021 12:43:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PChGJm052757; Sun, 25 Apr 2021 12:43:16 GMT (envelope-from git) Date: Sun, 25 Apr 2021 12:43:16 GMT Message-Id: <202104251243.13PChGJm052757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: b68e6569221e - main - rc: improve dependencies for growfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b68e6569221ecade8899eaab8e1b088947ef2f8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 12:43:16 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b68e6569221ecade8899eaab8e1b088947ef2f8a commit b68e6569221ecade8899eaab8e1b088947ef2f8a Author: Edward Tomasz Napierala AuthorDate: 2021-04-25 12:41:36 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-25 12:41:44 +0000 rc: improve dependencies for growfs Previously it depended on sysctl, which itself has no dependencies, so rcorder(8) had a bit too much flexibility when choosing when to run it. Make sure it runs just between 'fsck' and 'root'. Reviewed By: jmg, imp Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29748 --- libexec/rc/rc.d/growfs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs index 54bab2a60dfb..c2955c740d43 100755 --- a/libexec/rc/rc.d/growfs +++ b/libexec/rc/rc.d/growfs @@ -28,15 +28,17 @@ # # PROVIDE: growfs -# BEFORE: sysctl +# REQUIRE: fsck +# BEFORE: root # KEYWORD: firstboot # This allows us to distribute an image # and have it work on essentially any size drive. -# -# TODO: Figure out where this should really be ordered. -# I suspect it should go just after fsck but before mountcritlocal. -# + +# Note that this uses awk(1), and thus will not work if /usr is on a separate +# filesystem. We need to run early, because there might be not enough free +# space on rootfs for the boot to succeed, and on images we ship - which are +# the primary purpose of this script - there is no separate /usr anyway. . /etc/rc.subr From owner-dev-commits-src-main@freebsd.org Sun Apr 25 14:04:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51F33623F91; Sun, 25 Apr 2021 14:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FSqXf1sdbz3QBy; Sun, 25 Apr 2021 14:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28A5915636; Sun, 25 Apr 2021 14:04: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 13PE4ol4059511; Sun, 25 Apr 2021 14:04:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PE4o68059510; Sun, 25 Apr 2021 14:04:50 GMT (envelope-from git) Date: Sun, 25 Apr 2021 14:04:50 GMT Message-Id: <202104251404.13PE4o68059510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 5d1d844a7762 - main - kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d1d844a77622878cd05478d4ab504f70e067248 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 14:04:50 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1d844a77622878cd05478d4ab504f70e067248 commit 5d1d844a77622878cd05478d4ab504f70e067248 Author: Edward Tomasz Napierala AuthorDate: 2021-04-25 13:13:02 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-25 13:13:12 +0000 kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW This makes this API match other kern_xxxat() functions. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29776 --- sys/compat/cloudabi/cloudabi_file.c | 2 +- sys/compat/linux/linux_file.c | 15 ++++++++------- sys/kern/vfs_syscalls.c | 12 ++++++------ sys/sys/syscallsubr.h | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_file.c b/sys/compat/cloudabi/cloudabi_file.c index f7d93bc85cad..83987b79aa0c 100644 --- a/sys/compat/cloudabi/cloudabi_file.c +++ b/sys/compat/cloudabi/cloudabi_file.c @@ -185,7 +185,7 @@ cloudabi_sys_file_link(struct thread *td, error = kern_linkat(td, uap->fd1.fd, uap->fd2, path1, path2, UIO_SYSSPACE, (uap->fd1.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ? - FOLLOW : NOFOLLOW); + AT_SYMLINK_FOLLOW : 0); cloudabi_freestr(path1); cloudabi_freestr(path2); return (error); diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 6b02c2efb88e..1febb11b0131 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1111,7 +1111,7 @@ linux_link(struct thread *td, struct linux_link_args *args) if (!LUSECONVPATH(td)) { return (kern_linkat(td, AT_FDCWD, AT_FDCWD, args->path, args->to, - UIO_USERSPACE, FOLLOW)); + UIO_USERSPACE, AT_SYMLINK_FOLLOW)); } LCONVPATHEXIST(td, args->path, &path); /* Expand LCONVPATHCREATE so that `path' can be freed on errors */ @@ -1121,7 +1121,7 @@ linux_link(struct thread *td, struct linux_link_args *args) return (error); } error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE, - FOLLOW); + AT_SYMLINK_FOLLOW); LFREEPATH(path); LFREEPATH(to); return (error); @@ -1132,18 +1132,19 @@ int linux_linkat(struct thread *td, struct linux_linkat_args *args) { char *path, *to; - int error, olddfd, newdfd, follow; + int error, olddfd, newdfd, flag; if (args->flag & ~LINUX_AT_SYMLINK_FOLLOW) return (EINVAL); + flag = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? AT_SYMLINK_FOLLOW : + 0; + olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd; newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd; - follow = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? NOFOLLOW : - FOLLOW; if (!LUSECONVPATH(td)) { return (kern_linkat(td, olddfd, newdfd, args->oldname, - args->newname, UIO_USERSPACE, follow)); + args->newname, UIO_USERSPACE, flag)); } LCONVPATHEXIST_AT(td, args->oldname, &path, olddfd); /* Expand LCONVPATHCREATE so that `path' can be freed on errors */ @@ -1152,7 +1153,7 @@ linux_linkat(struct thread *td, struct linux_linkat_args *args) LFREEPATH(path); return (error); } - error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, follow); + error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, flag); LFREEPATH(path); LFREEPATH(to); return (error); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 26a8d31e4456..32e4c8688762 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1495,7 +1495,7 @@ sys_link(struct thread *td, struct link_args *uap) { return (kern_linkat(td, AT_FDCWD, AT_FDCWD, uap->path, uap->link, - UIO_USERSPACE, FOLLOW)); + UIO_USERSPACE, AT_SYMLINK_FOLLOW)); } #ifndef _SYS_SYSPROTO_H_ @@ -1518,8 +1518,7 @@ sys_linkat(struct thread *td, struct linkat_args *uap) return (EINVAL); return (kern_linkat(td, uap->fd1, uap->fd2, uap->path1, uap->path2, - UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | - AT_RESOLVE_BENEATH | AT_EMPTY_PATH))); + UIO_USERSPACE, flag)); } int hardlink_check_uid = 0; @@ -1563,15 +1562,16 @@ can_hardlink(struct vnode *vp, struct ucred *cred) int kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, - const char *path2, enum uio_seg segflag, int follow) + const char *path2, enum uio_seg segflag, int flag) { struct nameidata nd; int error; do { bwillwrite(); - NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag, - path1, fd1, &cap_linkat_source_rights, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag, + AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH), + segflag, path1, fd1, &cap_linkat_source_rights, td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 9e889e9d5465..471c38ab0e12 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -184,7 +184,7 @@ int kern_kldload(struct thread *td, const char *file, int *fileid); int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat); int kern_kldunload(struct thread *td, int fileid, int flags); int kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, - const char *path2, enum uio_seg segflg, int follow); + const char *path2, enum uio_seg segflg, int flag); int kern_listen(struct thread *td, int s, int backlog); int kern_lseek(struct thread *td, int fd, off_t offset, int whence); int kern_lutimes(struct thread *td, const char *path, enum uio_seg pathseg, From owner-dev-commits-src-main@freebsd.org Sun Apr 25 14:22:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5761F62444D; Sun, 25 Apr 2021 14:22: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 4FSqwh23dSz3R2c; Sun, 25 Apr 2021 14:22:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39EC015A3E; Sun, 25 Apr 2021 14:22: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 13PEMCqK084981; Sun, 25 Apr 2021 14:22:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PEMCNX084980; Sun, 25 Apr 2021 14:22:12 GMT (envelope-from git) Date: Sun, 25 Apr 2021 14:22:12 GMT Message-Id: <202104251422.13PEMCNX084980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Watson Subject: git: 8e491aaeac6e - main - Add code examples to cpuset(2), and improve cross referencing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rwatson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e491aaeac6eab92b1ba8f077f75cebac39adb1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 14:22:12 -0000 The branch main has been updated by rwatson: URL: https://cgit.FreeBSD.org/src/commit/?id=8e491aaeac6eab92b1ba8f077f75cebac39adb1c commit 8e491aaeac6eab92b1ba8f077f75cebac39adb1c Author: Robert Watson AuthorDate: 2021-04-25 14:22:00 +0000 Commit: Robert Watson CommitDate: 2021-04-25 14:22:00 +0000 Add code examples to cpuset(2), and improve cross referencing. MFC after: 1 week Reviewed by: jeff, jrtc27, kevans, bcr (manpages) Differential revision: https://reviews.freebsd.org/D27803 --- lib/libc/sys/cpuset.2 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/libc/sys/cpuset.2 b/lib/libc/sys/cpuset.2 index a2e5269ac042..8b17f537e7fa 100644 --- a/lib/libc/sys/cpuset.2 +++ b/lib/libc/sys/cpuset.2 @@ -1,5 +1,6 @@ .\" Copyright (c) 2008 Christian Brueffer .\" Copyright (c) 2008 Jeffrey Roberson +.\" Copyright (c) 2021 Robert N. M. Watson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -180,9 +181,72 @@ The actual contents of the sets may be retrieved or manipulated using .Xr cpuset_setaffinity 2 , .Xr cpuset_getdomain 2 , and .Xr cpuset_setdomain 2 . +The +.Xr cpuset 9 +macros may be used to manipulate masks of type +.Ft cpuset_t +get and set using those APIs. See those manual pages for more detail. .Sh RETURN VALUES .Rv -std +.Sh EXAMPLES +In this example, a CPU set mask is configured to limit execution to the first +CPU using +.Xr CPU_ZERO 9 +and +.Xr CPU_SET 9 , +members of the +.Xr cpuset 9 +programming interface. +Then, the mask is applied to a new anonymous CPU set associated with the +current process using +.Xr cpuset_setaffinity 2 . +This mask will be used by the current process, and inherited by any new +child processes. +.Bd -literal -offset indent +#include +#include + +#include + +cpuset_t cpuset_mask; + +/* Initialize a CPU mask and enable CPU 0. */ +CPU_ZERO(&cpuset_mask); +CPU_SET(0, &cpuset_mask); + +/* Set affinity for the CPU set for the current process. */ +if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, + sizeof(cpuset_mask), &cpuset_mask) < 0) + err(EX_OSERR, "cpuset_setaffinity"); +.Ed +.Pp +In the next example, a named CPU set is created containing the current +process, and its affinity similarly configured. +The resulting CPU set ID can then be used for further external management of +the affinity of the set. +.Bd -literal -offset indent +#include +#include + +#include + +cpusetid_t cpuset_id; +cpuset_t cpuset_mask; + +/* Create new cpuset for the current process. */ +if (cpuset(&cpuset_id) < 0) + err(EX_OSERR, "cpuset"); + +/* Initialize a CPU mask and enable CPU 0. */ +CPU_ZERO(&cpuset_mask); +CPU_SET(0, &cpuset_mask); + +/* Set affinity for the CPU set for the current process. */ +if (cpuset_setaffinity(CPU_LEVEL_SET, CPU_WHICH_CPUSET, cpuset_id, + sizeof(cpuset_mask), &cpuset_mask) < 0) + err(EX_OSERR, "cpuset_setaffinity"); +.Ed .Sh ERRORS The following error codes may be set in .Va errno : @@ -226,6 +290,8 @@ for allocation. .Xr cpuset_setdomain 2 , .Xr pthread_affinity_np 3 , .Xr pthread_attr_affinity_np 3 , +.Xr CPU_SET 9 , +.Xr CPU_ZERO 9 , .Xr cpuset 9 .Sh HISTORY The From owner-dev-commits-src-main@freebsd.org Sun Apr 25 19:53:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E5C35E5199; Sun, 25 Apr 2021 19:53: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 4FSzH641l9z4SG0; Sun, 25 Apr 2021 19:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C38519FA9; Sun, 25 Apr 2021 19:53: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 13PJrcxN022341; Sun, 25 Apr 2021 19:53:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PJrcdE022340; Sun, 25 Apr 2021 19:53:38 GMT (envelope-from git) Date: Sun, 25 Apr 2021 19:53:38 GMT Message-Id: <202104251953.13PJrcdE022340@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: 7d222ce3c10b - main - Fix NOINET[6], !VIMAGE builds after FIB_ALGO addition to GENERIC 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: 7d222ce3c10bdc23c8dc92d6b13e376ede5840d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 19:53:38 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=7d222ce3c10bdc23c8dc92d6b13e376ede5840d5 commit 7d222ce3c10bdc23c8dc92d6b13e376ede5840d5 Author: Alexander V. Chernikov AuthorDate: 2021-04-21 04:52:38 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-21 04:53:42 +0000 Fix NOINET[6],!VIMAGE builds after FIB_ALGO addition to GENERIC Reported by: jbeich PR: 255390 --- sys/net/route/fib_algo.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 83fff1ec43e0..5dff2690454d 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -108,19 +108,19 @@ SYSCTL_NODE(_net_route, OID_AUTO, algo, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, /* Algorithm sync policy */ /* Time interval to bucket updates */ -VNET_DEFINE(unsigned int, bucket_time_ms) = 50; -#define V_bucket_time_ms VNET(bucket_time_ms) +VNET_DEFINE_STATIC(unsigned int, update_bucket_time_ms) = 50; +#define V_update_bucket_time_ms VNET(update_bucket_time_ms) SYSCTL_UINT(_net_route_algo, OID_AUTO, bucket_time_ms, CTLFLAG_RW | CTLFLAG_VNET, - &VNET_NAME(bucket_time_ms), 0, "Time interval to calculate update rate"); + &VNET_NAME(update_bucket_time_ms), 0, "Time interval to calculate update rate"); /* Minimum update rate to delay sync */ -VNET_DEFINE(unsigned int, bucket_change_threshold_rate) = 500; +VNET_DEFINE_STATIC(unsigned int, bucket_change_threshold_rate) = 500; #define V_bucket_change_threshold_rate VNET(bucket_change_threshold_rate) SYSCTL_UINT(_net_route_algo, OID_AUTO, bucket_change_threshold_rate, CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(bucket_change_threshold_rate), 0, "Minimum update rate to delay sync"); /* Max allowed delay to sync */ -VNET_DEFINE(unsigned int, fib_max_sync_delay_ms) = 1000; +VNET_DEFINE_STATIC(unsigned int, fib_max_sync_delay_ms) = 1000; #define V_fib_max_sync_delay_ms VNET(fib_max_sync_delay_ms) SYSCTL_UINT(_net_route_algo, OID_AUTO, fib_max_sync_delay_ms, CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(fib_max_sync_delay_ms), 0, "Maximum time to delay sync (ms)"); @@ -589,7 +589,7 @@ update_rebuild_delay(struct fib_data *fd, enum fib_callout_action action) struct timeval tv; /* Fetch all variables at once to ensure consistent reads */ - uint32_t bucket_time_ms = V_bucket_time_ms; + uint32_t bucket_time_ms = V_update_bucket_time_ms; uint32_t threshold_rate = V_bucket_change_threshold_rate; uint32_t max_delay_ms = V_fib_max_sync_delay_ms; @@ -1618,10 +1618,14 @@ static struct fib_dp ** get_family_dp_ptr(int family) { switch (family) { +#ifdef INET case AF_INET: return (&V_inet_dp); +#endif +#ifdef INET6 case AF_INET6: return (&V_inet6_dp); +#endif } return (NULL); } From owner-dev-commits-src-main@freebsd.org Sun Apr 25 19:58:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FB625E52D5; Sun, 25 Apr 2021 19:58: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 4FSzNb72bcz4SVY; Sun, 25 Apr 2021 19:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E449919EB9; Sun, 25 Apr 2021 19:58: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 13PJwNnb022855; Sun, 25 Apr 2021 19:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PJwNro022854; Sun, 25 Apr 2021 19:58:23 GMT (envelope-from git) Date: Sun, 25 Apr 2021 19:58:23 GMT Message-Id: <202104251958.13PJwNro022854@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: 02695ea8909d - main - nfscl: fix delegation recall when the file is not open 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: 02695ea8909d818ceaa726f90f889889dfd39fac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 19:58:24 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=02695ea8909d818ceaa726f90f889889dfd39fac commit 02695ea8909d818ceaa726f90f889889dfd39fac Author: Rick Macklem AuthorDate: 2021-04-25 19:52:48 +0000 Commit: Rick Macklem CommitDate: 2021-04-25 19:55:00 +0000 nfscl: fix delegation recall when the file is not open Without this patch, if a NFSv4 server recalled a delegation when the file is not open, the renew thread would block in the NFS VOP_INACTIVE() trying to acquire the client state lock that it already holds. This patch fixes the problem by delaying the vrele() call until after the client state lock is released. This bug has been in the NFSv4 client for a long time, but since it only affects delegation when recalled due to another client opening the file, it got missed during previous testing. Until you have this patch in your client, you should avoid the use of delegations. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index e310deff6cf9..6cff58331c97 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -156,7 +156,8 @@ static void nfscl_freedeleg(struct nfscldeleghead *, struct nfscldeleg *); static int nfscl_errmap(struct nfsrv_descript *, u_int32_t); static void nfscl_cleanup_common(struct nfsclclient *, u_int8_t *); static int nfscl_recalldeleg(struct nfsclclient *, struct nfsmount *, - struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int); + struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int, + vnode_t *); static void nfscl_freeopenowner(struct nfsclowner *, int); static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, @@ -2562,6 +2563,7 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) struct nfsclds *dsp; bool retok; struct mount *mp; + vnode_t vp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2683,7 +2685,7 @@ tryagain: NFSUNLOCKCLSTATE(); newnfs_copycred(&dp->nfsdl_cred, cred); ret = nfscl_recalldeleg(clp, clp->nfsc_nmp, dp, - NULL, cred, p, 1); + NULL, cred, p, 1, &vp); if (!ret) { nfscl_cleandeleg(dp); TAILQ_REMOVE(&clp->nfsc_deleg, dp, @@ -2694,6 +2696,22 @@ tryagain: nfsstatsv1.cldelegates--; } NFSLOCKCLSTATE(); + /* + * The nfsc_lock must be released before doing + * vrele(), since it might call nfs_inactive(). + * For the unlikely case where the vnode failed + * to be acquired by nfscl_recalldeleg(), a + * VOP_RECLAIM() should be in progress and it + * will return the delegation. + */ + nfsv4_unlock(&clp->nfsc_lock, 0); + igotlock = 0; + if (vp != NULL) { + NFSUNLOCKCLSTATE(); + vrele(vp); + NFSLOCKCLSTATE(); + } + goto tryagain; } dp = ndp; } @@ -3943,16 +3961,18 @@ nfscl_lockt(vnode_t vp, struct nfsclclient *clp, u_int64_t off, static int nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, struct nfscldeleg *dp, vnode_t vp, struct ucred *cred, NFSPROC_T *p, - int called_from_renewthread) + int called_from_renewthread, vnode_t *vpp) { struct nfsclowner *owp, *lowp, *nowp; struct nfsclopen *op, *lop; struct nfscllockowner *lp; struct nfscllock *lckp; struct nfsnode *np; - int error = 0, ret, gotvp = 0; + int error = 0, ret; if (vp == NULL) { + KASSERT(vpp != NULL, ("nfscl_recalldeleg: vpp NULL")); + *vpp = NULL; /* * First, get a vnode for the file. This is needed to do RPCs. */ @@ -3966,7 +3986,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, return (0); } vp = NFSTOV(np); - gotvp = 1; + *vpp = vp; } else { np = VTONFS(vp); } @@ -3993,8 +4013,6 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, * return now, so that the dirty buffer will be flushed * later. */ - if (gotvp != 0) - vrele(vp); return (ret); } @@ -4018,11 +4036,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, owp, dp, cred, p); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4050,11 +4065,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, nfscl_freeopenowner(owp, 0); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4075,17 +4087,12 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, if (ret == NFSERR_STALESTATEID || ret == NFSERR_STALEDONTRECOVER || ret == NFSERR_STALECLIENTID || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret && !error) error = ret; } } - if (gotvp) - vrele(vp); return (error); } @@ -4497,7 +4504,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); @@ -4596,7 +4603,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); From owner-dev-commits-src-main@freebsd.org Sun Apr 25 21:19:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 370A45ED06A; Sun, 25 Apr 2021 21:19: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 4FT19c15KLz4f4Y; Sun, 25 Apr 2021 21:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17EB51B0EC; Sun, 25 Apr 2021 21:19: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 13PLJ0T6038648; Sun, 25 Apr 2021 21:19:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PLJ0UD038647; Sun, 25 Apr 2021 21:19:00 GMT (envelope-from git) Date: Sun, 25 Apr 2021 21:19:00 GMT Message-Id: <202104252119.13PLJ0UD038647@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: d55bf492f8f5 - main - Revert "Add workaround for a QoS-related bug in VMWare Workstation." 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: d55bf492f8f587e4a99f4dcb39a96159b4431782 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 21:19:00 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d55bf492f8f587e4a99f4dcb39a96159b4431782 commit d55bf492f8f587e4a99f4dcb39a96159b4431782 Author: Ed Maste AuthorDate: 2021-04-25 21:14:23 +0000 Commit: Ed Maste CommitDate: 2021-04-25 21:17:22 +0000 Revert "Add workaround for a QoS-related bug in VMWare Workstation." This reverts commit 77c2fe20df6a9a7c1a353e1a4ab2ba80fefab881. The VMware Workstation issue was fixed in 2019[1], and we'd rather not carry unnecessary local changes in OpenSSH. [1] https://communities.vmware.com/t5/VMware-Workstation-Pro/Regression-ssh-results-in-broken-pipe-upon-connecting-in-Vmware/m-p/486105/highlight/true#M25470 PR: 234426 Discussed with: yuripv Approved by: des MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- crypto/openssh/readconf.c | 22 ---------------------- secure/usr.bin/ssh/Makefile | 3 --- 2 files changed, 25 deletions(-) diff --git a/crypto/openssh/readconf.c b/crypto/openssh/readconf.c index 75fbd4ca222f..c1147a9e2e5f 100644 --- a/crypto/openssh/readconf.c +++ b/crypto/openssh/readconf.c @@ -16,9 +16,6 @@ __RCSID("$FreeBSD$"); #include -#ifdef VMWARE_GUEST_WORKAROUND -#include -#endif #include #include #include @@ -1983,15 +1980,6 @@ fill_default_options(Options * options) { char *all_cipher, *all_mac, *all_kex, *all_key, *all_sig; int r; -#ifdef VMWARE_GUEST_WORKAROUND - char scval[7]; /* "vmware\0" */ - size_t scsiz = sizeof(scval); - int vmwguest = 0; - - if (sysctlbyname("kern.vm_guest", scval, &scsiz, NULL, 0) == 0 && - strcmp(scval, "vmware") == 0) - vmwguest = 1; -#endif if (options->forward_agent == -1) options->forward_agent = 0; @@ -2126,18 +2114,8 @@ fill_default_options(Options * options) if (options->visual_host_key == -1) options->visual_host_key = 0; if (options->ip_qos_interactive == -1) -#ifdef VMWARE_GUEST_WORKAROUND - if (vmwguest) - options->ip_qos_interactive = IPTOS_LOWDELAY; - else -#endif options->ip_qos_interactive = IPTOS_DSCP_AF21; if (options->ip_qos_bulk == -1) -#ifdef VMWARE_GUEST_WORKAROUND - if (vmwguest) - options->ip_qos_bulk = IPTOS_THROUGHPUT; - else -#endif options->ip_qos_bulk = IPTOS_DSCP_CS1; if (options->request_tty == -1) options->request_tty = REQUEST_TTY_AUTO; diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 023fa4a55be9..614cc7627fc5 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -37,9 +37,6 @@ LIBADD+= crypto CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\" .endif -# Workaround VMware Workstation NAT bug -CFLAGS+=-DVMWARE_GUEST_WORKAROUND - .include .PATH: ${SSHDIR}